4 #include <itkImageRegionConstIterator.h> 5 #include <itkImageRegionIterator.h> 10 template <
class TPixelType>
12 MCMScalarMapsImageFilter <TPixelType>
15 typedef itk::ImageRegionConstIterator <InputImageType> InputIteratorType;
16 typedef itk::ImageRegionIterator <OutputImageType> OutputIteratorType;
18 InputIteratorType inItr(this->GetInput(), outputRegionForThread);
19 unsigned int numOutputs = this->GetNumberOfIndexedOutputs();
20 std::vector <OutputIteratorType> outItrs(numOutputs);
22 for (
unsigned int i = 0;i < numOutputs;++i)
23 outItrs[i] = OutputIteratorType(this->GetOutput(i), outputRegionForThread);
28 unsigned int numCompartments = mcmPtr->GetNumberOfCompartments();
29 unsigned int numIsoCompartments = mcmPtr->GetNumberOfIsotropicCompartments();
31 while (!inItr.IsAtEnd())
33 voxelValue = inItr.Get();
34 if (isZero(voxelValue))
37 for (
unsigned int i = 0;i < numOutputs;++i)
46 mcmPtr->SetModelVector(voxelValue);
47 double anisoWeight = 0.0;
48 double faCompartments = 0.0;
49 double mdCompartments = 0.0;
50 double parDiffCompartments = 0.0;
51 double perpDiffCompartments = 0.0;
52 double isoRWeight = 0.0;
53 double fwWeight = 0.0;
55 for (
unsigned int i = numIsoCompartments;i < numCompartments;++i)
57 double weight = mcmPtr->GetCompartmentWeight(i);
61 anisoWeight += weight;
68 for (
unsigned int i = 0;i < numIsoCompartments;++i)
70 double weight = mcmPtr->GetCompartmentWeight(i);
76 if (m_IncludeIsotropicWeights)
91 if ((!m_IncludeIsotropicWeights)&&(anisoWeight > 0.0))
93 mdCompartments /= anisoWeight;
94 faCompartments /= anisoWeight;
95 parDiffCompartments /= anisoWeight;
96 perpDiffCompartments /= anisoWeight;
99 outItrs[0].Set(fwWeight);
100 outItrs[1].Set(isoRWeight);
101 outItrs[2].Set(anisoWeight);
102 outItrs[3].Set(faCompartments);
103 outItrs[4].Set(mdCompartments);
104 outItrs[5].Set(parDiffCompartments);
105 outItrs[6].Set(perpDiffCompartments);
108 for (
unsigned int i = 0;i < numOutputs;++i)
MCMPointer & GetDescriptionModel()
virtual double GetApparentFractionalAnisotropy()
InputImageType::PixelType PixelType
virtual double GetApparentMeanDiffusivity()
InputImageType::RegionType InputRegionType
virtual double GetApparentPerpendicularDiffusivity()
Get approximation to perpendicular diffusivity of the compartment (may be different from radial diffu...
MCModelType::Pointer MCModelPointer
virtual DiffusionModelCompartmentType GetCompartmentType()=0
Utility function to return compartment type without needing dynamic casts.
virtual double GetApparentParallelDiffusivity()
Get approximation to parallel diffusivity of the compartment (may be different from axial diffusivity...