ANIMA  4.0
animaMEstimateSVFImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <itkImageToImageFilter.h>
5 #include <itkImage.h>
6 
7 namespace anima
8 {
9 
10 template <class TScalarType, unsigned int NDegreesOfFreedom, unsigned int NDimensions = 3>
12 public itk::ImageToImageFilter< itk::Image < itk::Vector <TScalarType,NDegreesOfFreedom>, NDimensions > , itk::Image < itk::Vector <TScalarType,NDegreesOfFreedom>, NDimensions > >
13 {
14 public:
17  typedef itk::Image <TScalarType, NDimensions> WeightImageType;
18  typedef typename WeightImageType::Pointer WeightImagePointer;
19  typedef itk::Image < itk::Vector <TScalarType,NDegreesOfFreedom>, NDimensions > TInputImage;
20  typedef itk::Image < itk::Vector <TScalarType,NDegreesOfFreedom>, NDimensions > TOutputImage;
21  typedef itk::ImageToImageFilter <TInputImage, TOutputImage> Superclass;
22  typedef itk::SmartPointer <Self> Pointer;
23  typedef itk::SmartPointer <const Self> ConstPointer;
24 
26  itkNewMacro(Self)
27 
28 
29  itkTypeMacro(MEstimateSVFImageFilter, ImageToImageFilter)
30 
31  typedef typename TOutputImage::PixelType OutputPixelType;
32  typedef typename TInputImage::PixelType InputPixelType;
33  typedef typename TInputImage::IndexType InputIndexType;
34  typedef typename TInputImage::PointType InputPointType;
35 
37  typedef typename TInputImage::Pointer InputImagePointer;
38  typedef typename TOutputImage::Pointer OutputImagePointer;
39 
41  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
42 
43  itkSetMacro(WeightImage, WeightImagePointer)
44 
45  itkSetMacro(FluidSigma, double)
46  itkSetMacro(MEstimateFactor, double)
47  void SetDistanceBoundary (double num) {m_SqrDistanceBoundary = num * num;}
48 
49  itkSetMacro(ConvergenceThreshold, double)
50  itkSetMacro(MaxNumIterations, unsigned int)
51 
52 protected:
54  {
55  m_FluidSigma = 4.0;
56  m_MEstimateFactor = 1.0;
57  m_AverageResidualValue = 1.0;
58  m_SqrDistanceBoundary = 9.0 * m_FluidSigma * m_FluidSigma;
59  }
60 
62 
63  void BeforeThreadedGenerateData() ITK_OVERRIDE;
64  void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE;
65 
66 private:
67  ITK_DISALLOW_COPY_AND_ASSIGN(MEstimateSVFImageFilter);
68 
69  bool checkConvergenceThreshold (OutputPixelType &outValOld, OutputPixelType &outVal);
70 
71  WeightImagePointer m_WeightImage;
72 
73  double m_FluidSigma, m_MEstimateFactor;
74  double m_SqrDistanceBoundary;
75  std::vector <unsigned int> m_NeighborhoodHalfSizes;
76  unsigned int m_MaxNumIterations;
77  double m_ConvergenceThreshold;
78 
79  std::vector <double> m_InternalSpatialKernelWeights;
80  std::vector <InputIndexType> m_InternalSpatialKernelIndexes;
81 
82  //Internal parameter
83  double m_AverageResidualValue;
84 };
85 
86 } // end namespace anima
87 
Superclass::OutputImageRegionType OutputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
itk::Image< TScalarType, NDimensions > WeightImageType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
itk::Image< itk::Vector< TScalarType, NDegreesOfFreedom >, NDimensions > TInputImage
itk::SmartPointer< const Self > ConstPointer
itk::Image< itk::Vector< TScalarType, NDegreesOfFreedom >, NDimensions > TOutputImage