ANIMA  4.0
animaMTPairingCorrelationImageToImageMetric.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 
18 template < class TFixedImagePixelType, class TMovingImagePixelType, unsigned int ImageDimension >
20 public BaseOrientedModelImageToImageMetric < anima::MCMImage < TFixedImagePixelType, ImageDimension >, anima::MCMImage < TMovingImagePixelType, ImageDimension > >
21 {
22 public:
26 
29  typedef itk::SmartPointer<Self> Pointer;
30  typedef itk::SmartPointer<const Self> ConstPointer;
31 
35 
37  itkNewMacro(Self)
38 
39 
41 
42 
43  typedef typename TFixedImage::PixelType PixelType;
44 
45  typedef typename Superclass::TransformType TransformType;
46  typedef typename Superclass::TransformPointer TransformPointer;
47  typedef typename Superclass::TransformParametersType TransformParametersType;
48  typedef typename Superclass::OutputPointType OutputPointType;
49  typedef typename Superclass::InputPointType InputPointType;
50  typedef typename itk::ContinuousIndex <double, ImageDimension> ContinuousIndexType;
51 
53 
54  typedef typename Superclass::MeasureType MeasureType;
55  typedef typename Superclass::FixedImageType FixedImageType;
56  typedef typename Superclass::MovingImageType MovingImageType;
57  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
58  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
59 
61  using LECalculatorPointer = typename LECalculatorType::Pointer;
62 
64  MeasureType GetValue(const TransformParametersType &parameters) const ITK_OVERRIDE;
65 
66  void PreComputeFixedValues();
67 
68 protected:
70  virtual ~MTPairingCorrelationImageToImageMetric() {}
71 
72  bool CheckTensorCompatibility() const;
73  double ComputeMapping(const std::vector < std::vector <double> > &refImageCompartmentWeights, const std::vector < std::vector <PixelType> > &refImageLogTensors,
74  const std::vector < std::vector <double> > &movingImageCompartmentWeights, const std::vector < std::vector <PixelType> > &movingImageLogTensors) const;
75 
76  bool isZero(PixelType &vector) const;
77 
78 private:
79  MTPairingCorrelationImageToImageMetric(const Self&); //purposely not implemented
80  void operator=(const Self&); //purposely not implemented
81 
82  MCModelPointer m_ZeroDiffusionModel;
83 
84  std::vector <InputPointType> m_FixedImagePoints;
85  std::vector < std::vector <double> > m_FixedImageCompartmentWeights;
86  std::vector < std::vector <PixelType> > m_FixedImageLogTensors;
87  unsigned int m_NumberOfFixedCompartments;
88 
89  LECalculatorPointer m_leCalculator;
90 };
91 
92 } // end namespace anima
93 
anima::MCMImage< TMovingImagePixelType, ImageDimension > TMovingImage
itk::ContinuousIndex< double, ImageDimension > ContinuousIndexType
anima::MCMImage< TFixedImagePixelType, ImageDimension > TFixedImage
BaseCompartment::Vector3DType Vector3DType
BaseOrientedModelImageToImageMetric< TFixedImage, TMovingImage > Superclass
MultiCompartmentModel: holds several diffusion compartments, ordered by type It also handles weights ...
MeasureType GetValue(const TransformParametersType &parameters) const ITK_OVERRIDE
Multi-tensor correlation similarity measure as defined by Taquet et al, based on pairing of the indiv...
double ComputeMapping(const std::vector< std::vector< double > > &refImageCompartmentWeights, const std::vector< std::vector< PixelType > > &refImageLogTensors, const std::vector< std::vector< double > > &movingImageCompartmentWeights, const std::vector< std::vector< PixelType > > &movingImageLogTensors) const