ANIMA  4.0
animaPyramidalDenseMCMSVFMatchingBridge.h
Go to the documentation of this file.
1 #pragma once
3 
4 #include <animaMCMImage.h>
7 #include <itkAffineTransform.h>
9 #include <rpiDisplacementFieldTransform.h>
10 
13 #include <animaMCMBlockMatcher.h>
14 
16 {
20 };
21 
23 {
27 };
28 
30 {
31  None = 0,
34 };
35 
36 enum Metric
37 {
43 };
44 
46 {
49 };
50 
52 {
53  Baloo = 0,
55 };
56 
57 namespace anima
58 {
59 
60 template <unsigned int ImageDimension = 3>
61 class PyramidalDenseMCMSVFMatchingBridge : public itk::ProcessObject
62 {
63 public:
65  typedef typename InputImageType::IOPixelType InputPixelType;
68  typedef typename InputImageType::InternalPixelType InputInternalPixelType;
69 
73 
75  typedef typename BaseTransformType::Pointer BaseTransformPointer;
76  typedef typename BaseTransformType::VectorFieldType VelocityFieldType;
77  typedef typename VelocityFieldType::PixelType VectorType;
78 
79  typedef itk::AffineTransform<typename BaseAgregatorType::InternalScalarType,ImageDimension> AffineTransformType;
80  typedef typename AffineTransformType::Pointer AffineTransformPointer;
81 
82  typedef rpi::DisplacementFieldTransform<typename BaseAgregatorType::ScalarType, ImageDimension> DisplacementFieldTransformType;
83  typedef typename DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer;
84 
87 
90 
93 
96 
99  typedef itk::ProcessObject Superclass;
100 
101  typedef itk::SmartPointer<Self> Pointer;
102  typedef itk::SmartPointer<const Self> ConstPointer;
103 
104  itkNewMacro(Self)
105 
106  itkTypeMacro(PyramidalDenseMCMSVFMatchingBridge,itk::ProcessObject)
107 
108  void Update() ITK_OVERRIDE;
109 
110  void WriteOutputs();
111 
115  void SetReferenceImage(InputImagePointer referenceImage) {m_ReferenceImage = referenceImage;}
116  void SetFloatingImage(InputImagePointer FloatingImage) {m_FloatingImage = FloatingImage;}
117 
118  InputImagePointer GetOutputImage() {return m_OutputImage;}
119 
123  BaseTransformPointer GetOutputTransform() {return m_OutputTransform;}
124 
129  std::string GetResultFile() {return m_resultFile;}
130  void SetResultFile(std::string resultFile) {m_resultFile=resultFile;}
131 
132  std::string GetOutputTransformFile() {return m_outputTransformFile;}
133  void SetOutputTransformFile(std::string outputTransformFile) {m_outputTransformFile=outputTransformFile;}
134 
135  unsigned int GetBlockSize() {return m_BlockSize;}
136  void SetBlockSize(int blockSize) {m_BlockSize=blockSize;}
137 
138  unsigned int GetBlockSpacing() {return m_BlockSpacing;}
139  void SetBlockSpacing(unsigned int blockSpacing) {m_BlockSpacing=blockSpacing;}
140 
141  double GetStDevThreshold() {return m_StDevThreshold;}
142  void SetStDevThreshold(double StDevThreshold) {m_StDevThreshold = StDevThreshold;}
143 
144  SymmetryType GetSymmetryType() {return m_SymmetryType;}
145  void SetSymmetryType(SymmetryType sym) {m_SymmetryType=sym;}
146 
147  Transform GetTransform() {return m_Transform;}
148  void SetTransform(Transform transform) {m_Transform=transform;}
149 
150  Metric GetMetric() {return m_Metric;}
151  void SetMetric(Metric metric) {m_Metric=metric;}
152 
153  MetricOrientationType GetMetricOrientation() {return m_MetricOrientation;}
154  void SetMetricOrientation(MetricOrientationType metricOr) {m_MetricOrientation = metricOr;}
155 
156  bool GetFiniteStrainImageReorientation() {return m_FiniteStrainImageReorientation;}
157  void SetFiniteStrainImageReorientation(bool reor) {m_FiniteStrainImageReorientation = reor;}
158 
159  Optimizer GetOptimizer() {return m_Optimizer;}
160  void SetOptimizer(Optimizer optimizer) {m_Optimizer=optimizer;}
161 
162  unsigned int GetMaximumIterations() {return m_MaximumIterations;}
163  void SetMaximumIterations(unsigned int MaximumIterations) {m_MaximumIterations=MaximumIterations;}
164 
165  double GetMinimalTransformError() {return m_MinimalTransformError;}
166  void SetMinimalTransformError(double MinimalTransformError) {m_MinimalTransformError=MinimalTransformError;}
167 
168  unsigned int GetOptimizerMaximumIterations() {return m_OptimizerMaximumIterations;}
169  void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations) {m_OptimizerMaximumIterations=OptimizerMaximumIterations;}
170 
171  double GetSearchRadius() {return m_SearchRadius;}
172  void SetSearchRadius(double SearchRadius) {m_SearchRadius=SearchRadius;}
173 
174  double GetSearchAngleRadius() {return m_SearchAngleRadius;}
175  void SetSearchAngleRadius(double SearchAngleRadius) {m_SearchAngleRadius=SearchAngleRadius;}
176 
177  double GetSearchScaleRadius() {return m_SearchScaleRadius;}
178  void SetSearchScaleRadius(double SearchScaleRadius) {m_SearchScaleRadius=SearchScaleRadius;}
179 
180  double GetFinalRadius() {return m_FinalRadius;}
181  void SetFinalRadius(double FinalRadius) {m_FinalRadius=FinalRadius;}
182 
183  double GetStepSize() {return m_StepSize;}
184  void SetStepSize(double StepSize) {m_StepSize=StepSize;}
185 
186  double GetTranslateUpperBound() {return m_TranslateUpperBound;}
187  void SetTranslateUpperBound(double TranslateUpperBound) {m_TranslateUpperBound=TranslateUpperBound;}
188 
189  double GetAngleUpperBound() {return m_AngleUpperBound;}
190  void SetAngleUpperBound(double AngleUpperBound) {m_AngleUpperBound=AngleUpperBound;}
191 
192  double GetScaleUpperBound() {return m_ScaleUpperBound;}
193  void SetScaleUpperBound(double ScaleUpperBound) {m_ScaleUpperBound=ScaleUpperBound;}
194 
195  Agregator GetAgregator() {return m_Agregator;}
196  void SetAgregator(Agregator agregator) {m_Agregator=agregator;}
197 
198  double GetExtrapolationSigma() {return m_ExtrapolationSigma;}
199  void SetExtrapolationSigma(double extrapolationSigma) {m_ExtrapolationSigma = extrapolationSigma;}
200 
201  double GetElasticSigma() {return m_ElasticSigma;}
202  void SetElasticSigma(double elasticSigma) {m_ElasticSigma = elasticSigma;}
203 
204  double GetOutlierSigma() {return m_OutlierSigma;}
205  void SetOutlierSigma(double outlierSigma) {m_OutlierSigma = outlierSigma;}
206 
207  double GetMEstimateConvergenceThreshold() {return m_MEstimateConvergenceThreshold;}
208  void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold) {m_MEstimateConvergenceThreshold = mEstimateConvergenceThreshold;}
209 
210  double GetNeighborhoodApproximation() {return m_NeighborhoodApproximation;}
211  void SetNeighborhoodApproximation(double neighborhoodApproximation) {m_NeighborhoodApproximation = neighborhoodApproximation;}
212 
213  unsigned int GetBCHCompositionOrder() {return m_BCHCompositionOrder;}
214  void SetBCHCompositionOrder(unsigned int order) {m_BCHCompositionOrder = order;}
215 
216  unsigned int GetExponentiationOrder() {return m_ExponentiationOrder;}
217  void SetExponentiationOrder(unsigned int order) {m_ExponentiationOrder = order;}
218 
219  unsigned int GetNumberOfPyramidLevels() {return m_NumberOfPyramidLevels;}
220  void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels) {m_NumberOfPyramidLevels=NumberOfPyramidLevels;}
221 
222  unsigned int GetLastPyramidLevel() {return m_LastPyramidLevel;}
223  void SetLastPyramidLevel(unsigned int LastPyramidLevel) {m_LastPyramidLevel=LastPyramidLevel;}
224 
225  double GetPercentageKept() {return m_PercentageKept;}
226  void SetPercentageKept(double PercentageKept) {m_PercentageKept=PercentageKept;}
227 
228  void SetSmallDelta(double val) {m_SmallDelta = val;}
229  void SetBigDelta(double val) {m_BigDelta = val;}
230  void SetGradientStrengths(std::vector <double> &val) {m_GradientStrengths = val;}
231 
232  void SetGradientDirections(std::vector <vnl_vector_fixed <double,3> > &grads) {m_GradientDirections = grads;}
233 
234 protected:
237 
238  void SetupPyramids();
239 
240  virtual InterpolatorType *CreateInterpolator(InputImageType *image);
241  virtual BlockMatcherType *CreateBlockMatcher();
242 
243 private:
244  ITK_DISALLOW_COPY_AND_ASSIGN(PyramidalDenseMCMSVFMatchingBridge);
245 
246  BaseTransformPointer m_OutputTransform;
247  InputImagePointer m_OutputImage;
248 
249  InputImagePointer m_ReferenceImage, m_FloatingImage;
250  PyramidPointer m_ReferencePyramid, m_FloatingPyramid;
251 
252  std::string m_outputTransformFile;
253  std::string m_resultFile;
254 
255  unsigned int m_BlockSize;
256  unsigned int m_BlockSpacing;
257  double m_StDevThreshold;
258 
259  SymmetryType m_SymmetryType;
260  Transform m_Transform;
261  Metric m_Metric;
262  MetricOrientationType m_MetricOrientation;
263  bool m_FiniteStrainImageReorientation;
264  Optimizer m_Optimizer;
265 
266  unsigned int m_MaximumIterations;
267  double m_MinimalTransformError;
268  unsigned int m_OptimizerMaximumIterations;
269  double m_SearchRadius;
270  double m_SearchAngleRadius;
271  double m_SearchScaleRadius;
272  double m_FinalRadius;
273  double m_StepSize;
274  double m_TranslateUpperBound;
275  double m_AngleUpperBound;
276  double m_ScaleUpperBound;
277  Agregator m_Agregator;
278  double m_ExtrapolationSigma;
279  double m_ElasticSigma;
280  double m_OutlierSigma;
281  double m_MEstimateConvergenceThreshold;
282  double m_NeighborhoodApproximation;
283  unsigned int m_BCHCompositionOrder;
284  unsigned int m_ExponentiationOrder;
285 
286  unsigned int m_NumberOfPyramidLevels;
287  unsigned int m_LastPyramidLevel;
288  double m_PercentageKept;
289 
290  // Variables for metric approximation
291  std::vector < vnl_vector_fixed <double,3> > m_GradientDirections;
292  double m_SmallDelta, m_BigDelta;
293  std::vector <double> m_GradientStrengths;
294 
295  BaseBlockMatchRegistrationPointer m_bmreg;
296 };
297 
298 } // end of namespace anima
299 
MEstimateAgregatorType::BaseOutputTransformType BaseTransformType
anima::BaseBMRegistrationMethod< InputImageType > BaseBlockMatchRegistrationType
void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations)
Computes a pyramid of images using the provided resampler to perform resampling.
anima::MCMImage< double, ImageDimension > InputImageType
anima::PyramidImageFilter< InputImageType, InputImageType > PyramidType
BaseBlockMatchRegistrationType::Pointer BaseBlockMatchRegistrationPointer
itk::SmartPointer< const Self > ConstPointer
Definition: animaMCMImage.h:16
DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
void SetGradientDirections(std::vector< vnl_vector_fixed< double, 3 > > &grads)
virtual InterpolatorType * CreateInterpolator(InputImageType *image)
itk::AffineTransform< typename BaseAgregatorType::InternalScalarType, ImageDimension > AffineTransformType
DenseSVFTransformAgregator< ImageDimension > MEstimateAgregatorType
rpi::DisplacementFieldTransform< typename BaseAgregatorType::ScalarType, ImageDimension > DisplacementFieldTransformType
BalooSVFTransformAgregator< ImageDimension > BalooAgregatorType
anima::MCMLinearInterpolateImageFunction< InputImageType > InterpolatorType
itk::StationaryVelocityFieldTransform< ScalarType, NDimensions > BaseOutputTransformType
MultiCompartmentModel: holds several diffusion compartments, ordered by type It also handles weights ...
void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels)
BaseTransformAgregator< ImageDimension > BaseAgregatorType
anima::MCMBlockMatcher< InputImageType > BlockMatcherType
void SetNeighborhoodApproximation(double neighborhoodApproximation)
itk::SmartPointer< Self > Pointer
itk::SmartPointer< Self > Pointer
Definition: animaMCMImage.h:15
void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold)