ANIMA  4.0
animaMCMCorrelationImageToImageMetric.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include <animaMCMImage.h>
6 
7 namespace anima
8 {
9 
10 template < class TFixedImagePixelType, class TMovingImagePixelType, unsigned int ImageDimension >
12 public BaseOrientedModelImageToImageMetric< anima::MCMImage < TFixedImagePixelType, ImageDimension >, anima::MCMImage < TMovingImagePixelType, ImageDimension > >
13 {
14 public:
18 
21  typedef itk::SmartPointer<Self> Pointer;
22  typedef itk::SmartPointer<const Self> ConstPointer;
23 
27 
29  itkNewMacro(Self)
30 
31 
33 
34 
35  typedef typename TFixedImage::PixelType PixelType;
36 
37  typedef typename Superclass::TransformType TransformType;
38  typedef typename Superclass::TransformPointer TransformPointer;
39  typedef typename Superclass::TransformParametersType TransformParametersType;
40  typedef typename Superclass::OutputPointType OutputPointType;
41  typedef typename Superclass::InputPointType InputPointType;
42  typedef typename itk::ContinuousIndex <double, ImageDimension> ContinuousIndexType;
43 
45 
46  typedef typename Superclass::MeasureType MeasureType;
47  typedef typename Superclass::FixedImageType FixedImageType;
48  typedef typename Superclass::MovingImageType MovingImageType;
49  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
50  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
51 
53  MeasureType GetValue(const TransformParametersType & parameters) const ITK_OVERRIDE;
54 
55  void SetSmallDelta(double val);
56  void SetBigDelta(double val);
57  void SetGradientStrengths(std::vector <double> &val);
58  void SetGradientDirections(std::vector <GradientType> &val);
59 
60  itkSetMacro(ForceApproximation, bool)
61  itkSetMacro(LowerBoundGaussianSigma, double)
62  itkSetMacro(UpperBoundGaussianSigma, double)
63 
64  void PreComputeFixedValues();
65 
66 protected:
68  virtual ~MCMCorrelationImageToImageMetric() {}
69 
71  void UpdateSphereWeights();
72 
73  bool CheckTensorCompatibility() const;
74  double ComputeTensorBasedMetric(const std::vector <MCModelPointer> &movingValues) const;
75  double ComputeNonTensorBasedMetric(const std::vector <MCModelPointer> &movingValues) const;
76 
77  bool isZero(PixelType &vector) const;
78 
79 private:
80  MCMCorrelationImageToImageMetric(const Self&); //purposely not implemented
81  void operator=(const Self&); //purposely not implemented
82 
83  std::vector <InputPointType> m_FixedImagePoints;
84  std::vector <MCModelPointer> m_FixedImageValues;
85 
86  // Optional parameters for the case when compartments are not tensor compatible
87  std::vector <double> m_GradientStrengths;
88  double m_SmallDelta, m_BigDelta;
89  std::vector <GradientType> m_GradientDirections;
90 
91  // Parameters for numerical integration on non tensor compatible models
92  std::vector <double> m_SphereWeights;
93  std::vector <unsigned int> m_BValWeightsIndexes;
94 
95  MCModelPointer m_ZeroDiffusionModel;
96  PixelType m_ZeroDiffusionVector;
97 
98  bool m_ForceApproximation;
99 
100  // Lower and upper bounds of Gaussian sigma for smoothing
101  double m_LowerBoundGaussianSigma;
102  double m_UpperBoundGaussianSigma;
103 };
104 
105 } // end namespace anima
106 
Superclass::MovingImageConstPointer MovingImageConstPointer
STL namespace.
double ComputeNonTensorBasedMetric(const std::vector< MCModelPointer > &movingValues) const
Superclass::TransformParametersType TransformParametersType
BaseOrientedModelImageToImageMetric< TFixedImage, TMovingImage > Superclass
void UpdateSphereWeights()
Compute base integration weights for non tensor integration.
void SetGradientDirections(std::vector< GradientType > &val)
BaseCompartment::Vector3DType Vector3DType
anima::MCMImage< TFixedImagePixelType, ImageDimension > TFixedImage
anima::MCMImage< TMovingImagePixelType, ImageDimension > TMovingImage
itk::ContinuousIndex< double, ImageDimension > ContinuousIndexType
MultiCompartmentModel: holds several diffusion compartments, ordered by type It also handles weights ...
Superclass::CoordinateRepresentationType CoordinateRepresentationType
double ComputeTensorBasedMetric(const std::vector< MCModelPointer > &movingValues) const
MeasureType GetValue(const TransformParametersType &parameters) const ITK_OVERRIDE