ANIMA  4.0
animaMCMPairingMeanSquaresImageToImageMetric.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include <animaMCMImage.h>
6 #include <animaBaseTensorTools.h>
7 
8 namespace anima
9 {
10 
11 template < class TFixedImagePixelType, class TMovingImagePixelType, unsigned int ImageDimension >
13 public BaseOrientedModelImageToImageMetric< anima::MCMImage < TFixedImagePixelType, ImageDimension >, anima::MCMImage < TMovingImagePixelType, ImageDimension > >
14 {
15 public:
19 
22  typedef itk::SmartPointer<Self> Pointer;
23  typedef itk::SmartPointer<const Self> ConstPointer;
24 
28 
30  itkNewMacro(Self)
31 
32 
34 
35 
36  typedef typename TFixedImage::PixelType PixelType;
37 
38  typedef typename Superclass::TransformType TransformType;
39  typedef typename Superclass::TransformPointer TransformPointer;
40  typedef typename Superclass::TransformParametersType TransformParametersType;
41  typedef typename Superclass::OutputPointType OutputPointType;
42  typedef typename Superclass::InputPointType InputPointType;
43  typedef typename itk::ContinuousIndex <double, ImageDimension> ContinuousIndexType;
44 
46 
47  typedef typename Superclass::MeasureType MeasureType;
48  typedef typename Superclass::FixedImageType FixedImageType;
49  typedef typename Superclass::MovingImageType MovingImageType;
50  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
51  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
52 
54  using LECalculatorPointer = typename LECalculatorType::Pointer;
55 
57  MeasureType GetValue( const TransformParametersType & parameters ) const ITK_OVERRIDE;
58 
59  itkSetMacro(OneToOneMapping, bool)
60 
61  void PreComputeFixedValues();
62 
63 protected:
65  virtual ~MCMPairingMeanSquaresImageToImageMetric() {}
66 
67  bool CheckTensorCompatibility() const;
68  double ComputeTensorBasedMetricPart(unsigned int index, const MCModelPointer &movingValue) const;
69  double ComputeNonTensorBasedMetricPart(unsigned int index, const MCModelPointer &movingValue) const;
70 
71  bool isZero(PixelType &vector) const;
72 
73 private:
74  MCMPairingMeanSquaresImageToImageMetric(const Self&); //purposely not implemented
75  void operator=(const Self&); //purposely not implemented
76 
77  MCModelPointer m_ZeroDiffusionModel;
78  PixelType m_ZeroDiffusionVector;
79 
80  std::vector <InputPointType> m_FixedImagePoints;
81  std::vector <MCModelPointer> m_FixedImageValues;
82 
83  bool m_OneToOneMapping;
84 
85  LECalculatorPointer m_leCalculator;
86 };
87 
88 } // end namespace anima
89 
BaseCompartment::Vector3DType Vector3DType
itk::ContinuousIndex< double, ImageDimension > ContinuousIndexType
MultiCompartmentModel: holds several diffusion compartments, ordered by type It also handles weights ...
BaseOrientedModelImageToImageMetric< TFixedImage, TMovingImage > Superclass
double ComputeNonTensorBasedMetricPart(unsigned int index, const MCModelPointer &movingValue) const
anima::MCMImage< TMovingImagePixelType, ImageDimension > TMovingImage
anima::MCMImage< TFixedImagePixelType, ImageDimension > TFixedImage
double ComputeTensorBasedMetricPart(unsigned int index, const MCModelPointer &movingValue) const
MeasureType GetValue(const TransformParametersType &parameters) const ITK_OVERRIDE