ANIMA  4.0
animaGMMT2RelaxometryEstimationImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <itkVectorImage.h>
5 #include <itkImage.h>
6 
7 namespace anima
8 {
9 
10 template <class TPixelScalarType>
12 public anima::MaskedImageToImageFilter<itk::Image <TPixelScalarType, 3>, itk::Image <TPixelScalarType, 3> >
13 {
14 public:
17  typedef itk::Image <TPixelScalarType, 3> TInputImage;
18  typedef itk::Image <TPixelScalarType, 3> TOutputImage;
20  typedef itk::SmartPointer<Self> Pointer;
21  typedef itk::SmartPointer<const Self> ConstPointer;
22 
24  itkNewMacro(Self)
25 
26 
28 
29 
30  typedef TInputImage InputImageType;
31  typedef typename InputImageType::IndexType IndexType;
32  typedef TOutputImage OutputImageType;
33  typedef itk::VectorImage <TPixelScalarType, 3> VectorOutputImageType;
34  typedef typename VectorOutputImageType::PixelType OutputVectorType;
35  typedef typename InputImageType::Pointer InputImagePointer;
36  typedef typename OutputImageType::Pointer OutputImagePointer;
37  typedef typename VectorOutputImageType::Pointer VectorOutputImagePointer;
38 
40  typedef typename Superclass::MaskImageType MaskImageType;
41  typedef typename Superclass::InputImageRegionType InputImageRegionType;
42  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
43 
44  itkSetMacro(EchoSpacing, double)
45 
46  void SetT1Map(InputImageType *map) {m_T1Map = map;}
47  InputImageType *GetT1Map() {return m_T1Map;}
48 
49  itkSetMacro(AverageSignalThreshold, double)
50 
51  InputImageType *GetM0OutputImage() {return this->GetOutput(0);}
52  InputImageType *GetMWFOutputImage() {return this->GetOutput(1);}
53  InputImageType *GetB1OutputImage() {return this->GetOutput(2);}
54  InputImageType *GetSigmaSquareOutputImage() {return this->GetOutput(3);}
55  VectorOutputImageType *GetWeightsImage() {return m_WeightsImage;}
56 
57  itkSetMacro(T2ExcitationFlipAngle, double)
58  itkSetMacro(GaussianIntegralTolerance, double)
59 
60  void SetGaussianMeans(std::string fileName);
61  void SetGaussianVariances(std::string fileName);
62 
63  void SetT2FlipAngles(std::vector <double> & flipAngles) {m_T2FlipAngles = flipAngles;}
64  void SetT2FlipAngles(double singleAngle, unsigned int numAngles) {m_T2FlipAngles = std::vector <double> (numAngles,singleAngle);}
65 
66 protected:
68  : Superclass()
69  {
70  // There are 4 outputs: M0, MWF, B1, sigma square
71  this->SetNumberOfRequiredOutputs(4);
72 
73  for (unsigned int i = 0;i < 4;++i)
74  this->SetNthOutput(i, this->MakeOutput(i));
75 
76  m_AverageSignalThreshold = 0;
77  m_EchoSpacing = 1;
78 
79  m_GaussianMeans.resize(3);
80  m_GaussianMeans[0] = 20;
81  m_GaussianMeans[1] = 100;
82  m_GaussianMeans[2] = 2000;
83 
84  m_GaussianVariances.resize(3);
85  m_GaussianVariances[0] = 25;
86  m_GaussianVariances[1] = 100;
87  m_GaussianVariances[2] = 6400;
88 
89  m_GaussianIntegralTolerance = 1.0e-8;
90 
91  m_T2ExcitationFlipAngle = M_PI / 6;
92  }
93 
95 
96  void CheckComputationMask() ITK_OVERRIDE;
97 
98  void BeforeThreadedGenerateData() ITK_OVERRIDE;
99  void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE;
100 
101 private:
102  ITK_DISALLOW_COPY_AND_ASSIGN(GMMT2RelaxometryEstimationImageFilter);
103 
104  double m_AverageSignalThreshold;
105 
106  // T1 relaxometry specific values
107  InputImagePointer m_T1Map;
108 
109  // GMM values for integral
110  std::vector <double> m_GaussianMeans;
111  std::vector <double> m_GaussianVariances;
112  double m_GaussianIntegralTolerance;
113 
114  // Additional result images
115  VectorOutputImagePointer m_WeightsImage;
116 
117  // T2 relaxometry specific values
118  double m_EchoSpacing;
119  std::vector <double> m_T2FlipAngles;
120  double m_T2ExcitationFlipAngle;
121 };
122 
123 } // end namespace anima
124 
void SetT2FlipAngles(double singleAngle, unsigned int numAngles)
anima::MaskedImageToImageFilter< TInputImage, TOutputImage > Superclass
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE