ANIMA  4.0
animaPyramidalDenseTensorSVFMatchingBridge.h
Go to the documentation of this file.
1 #pragma once
3 
4 #include <itkVectorImage.h>
7 #include <itkAffineTransform.h>
9 #include <rpiDisplacementFieldTransform.h>
10 
12 {
16 };
17 
19 {
23 };
24 
25 enum Metric
26 {
31 };
32 
34 {
35  None = 0,
38 };
39 
41 {
44 };
45 
47 {
48  Baloo = 0,
50 };
51 
52 namespace anima
53 {
54 
55 template <unsigned int ImageDimension = 3>
56 class PyramidalDenseTensorSVFMatchingBridge : public itk::ProcessObject
57 {
58 public:
59  typedef itk::VectorImage <double,ImageDimension> InputImageType;
60  typedef typename InputImageType::IOPixelType InputPixelType;
61  typedef typename InputImageType::Pointer InputImagePointer;
62  typedef typename InputImageType::ConstPointer InputImageConstPointer;
63  typedef typename InputImageType::InternalPixelType InputInternalPixelType;
64 
65  typedef itk::Image <unsigned char, ImageDimension> MaskImageType;
66  typedef typename MaskImageType::Pointer MaskImagePointer;
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  typedef itk::ProcessObject Superclass;
94 
95  typedef itk::SmartPointer<Self> Pointer;
96  typedef itk::SmartPointer<const Self> ConstPointer;
97 
98  itkNewMacro(Self)
99 
100  itkTypeMacro(PyramidalDenseTensorSVFMatchingBridge,itk::ProcessObject)
101 
102  void Update() ITK_OVERRIDE;
103 
104  void WriteOutputs();
105 
109  void SetReferenceImage(InputImageConstPointer referenceImage) {m_ReferenceImage = referenceImage;}
110  void SetFloatingImage(InputImageConstPointer FloatingImage) {m_FloatingImage = FloatingImage;}
111 
112  InputImageType * GetReferenceImage() {return const_cast <InputImageType *> (m_ReferenceImage.GetPointer());}
113  InputImageType * GetFloatingImage() {return const_cast <InputImageType *> (m_FloatingImage.GetPointer());}
114 
115  InputImagePointer GetOutputImage() {return m_OutputImage;}
116 
120  BaseTransformPointer GetOutputTransform() {return m_OutputTransform;}
121 
126  std::string GetResultFile() {return m_resultFile;}
127  void SetResultFile(std::string resultFile) {m_resultFile=resultFile;}
128 
129  std::string GetOutputTransformFile() {return m_outputTransformFile;}
130  void SetOutputTransformFile(std::string outputTransformFile) {m_outputTransformFile=outputTransformFile;}
131 
132  unsigned int GetBlockSize() {return m_BlockSize;}
133  void SetBlockSize(int blockSize) {m_BlockSize=blockSize;}
134 
135  unsigned int GetBlockSpacing() {return m_BlockSpacing;}
136  void SetBlockSpacing(unsigned int blockSpacing) {m_BlockSpacing=blockSpacing;}
137 
138  double GetStDevThreshold() {return m_StDevThreshold;}
139  void SetStDevThreshold(double StDevThreshold) {m_StDevThreshold = StDevThreshold;}
140 
141  SymmetryType GetSymmetryType() {return m_SymmetryType;}
142  void SetSymmetryType(SymmetryType sym) {m_SymmetryType=sym;}
143 
144  Transform GetTransform() {return m_Transform;}
145  void SetTransform(Transform transform) {m_Transform=transform;}
146 
147  Metric GetMetric() {return m_Metric;}
148  void SetMetric(Metric metric) {m_Metric=metric;}
149 
150  MetricOrientationType GetMetricOrientation() {return m_MetricOrientation;}
151  void SetMetricOrientation(MetricOrientationType metricOr) {m_MetricOrientation = metricOr;}
152 
153  bool GetFiniteStrainImageReorientation() {return m_FiniteStrainImageReorientation;}
154  void SetFiniteStrainImageReorientation(bool reor) {m_FiniteStrainImageReorientation = reor;}
155 
156  Optimizer GetOptimizer() {return m_Optimizer;}
157  void SetOptimizer(Optimizer optimizer) {m_Optimizer=optimizer;}
158 
159  unsigned int GetMaximumIterations() {return m_MaximumIterations;}
160  void SetMaximumIterations(unsigned int MaximumIterations) {m_MaximumIterations=MaximumIterations;}
161 
162  double GetMinimalTransformError() {return m_MinimalTransformError;}
163  void SetMinimalTransformError(double MinimalTransformError) {m_MinimalTransformError=MinimalTransformError;}
164 
165  unsigned int GetOptimizerMaximumIterations() {return m_OptimizerMaximumIterations;}
166  void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations) {m_OptimizerMaximumIterations=OptimizerMaximumIterations;}
167 
168  double GetSearchRadius() {return m_SearchRadius;}
169  void SetSearchRadius(double SearchRadius) {m_SearchRadius=SearchRadius;}
170 
171  double GetSearchAngleRadius() {return m_SearchAngleRadius;}
172  void SetSearchAngleRadius(double SearchAngleRadius) {m_SearchAngleRadius=SearchAngleRadius;}
173 
174  double GetSearchScaleRadius() {return m_SearchScaleRadius;}
175  void SetSearchScaleRadius(double SearchScaleRadius) {m_SearchScaleRadius=SearchScaleRadius;}
176 
177  double GetFinalRadius() {return m_FinalRadius;}
178  void SetFinalRadius(double FinalRadius) {m_FinalRadius=FinalRadius;}
179 
180  double GetStepSize() {return m_StepSize;}
181  void SetStepSize(double StepSize) {m_StepSize=StepSize;}
182 
183  double GetTranslateUpperBound() {return m_TranslateUpperBound;}
184  void SetTranslateUpperBound(double TranslateUpperBound) {m_TranslateUpperBound=TranslateUpperBound;}
185 
186  double GetAngleUpperBound() {return m_AngleUpperBound;}
187  void SetAngleUpperBound(double AngleUpperBound) {m_AngleUpperBound=AngleUpperBound;}
188 
189  double GetScaleUpperBound() {return m_ScaleUpperBound;}
190  void SetScaleUpperBound(double ScaleUpperBound) {m_ScaleUpperBound=ScaleUpperBound;}
191 
192  Agregator GetAgregator() {return m_Agregator;}
193  void SetAgregator(Agregator agregator) {m_Agregator=agregator;}
194 
195  double GetExtrapolationSigma() {return m_ExtrapolationSigma;}
196  void SetExtrapolationSigma(double extrapolationSigma) {m_ExtrapolationSigma = extrapolationSigma;}
197 
198  double GetElasticSigma() {return m_ElasticSigma;}
199  void SetElasticSigma(double elasticSigma) {m_ElasticSigma = elasticSigma;}
200 
201  double GetOutlierSigma() {return m_OutlierSigma;}
202  void SetOutlierSigma(double outlierSigma) {m_OutlierSigma = outlierSigma;}
203 
204  double GetMEstimateConvergenceThreshold() {return m_MEstimateConvergenceThreshold;}
205  void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold) {m_MEstimateConvergenceThreshold = mEstimateConvergenceThreshold;}
206 
207  double GetNeighborhoodApproximation() {return m_NeighborhoodApproximation;}
208  void SetNeighborhoodApproximation(double neighborhoodApproximation) {m_NeighborhoodApproximation = neighborhoodApproximation;}
209 
210  unsigned int GetBCHCompositionOrder() {return m_BCHCompositionOrder;}
211  void SetBCHCompositionOrder(unsigned int order) {m_BCHCompositionOrder = order;}
212 
213  unsigned int GetExponentiationOrder() {return m_ExponentiationOrder;}
214  void SetExponentiationOrder(unsigned int order) {m_ExponentiationOrder = order;}
215 
216  unsigned int GetNumberOfPyramidLevels() {return m_NumberOfPyramidLevels;}
217  void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels) {m_NumberOfPyramidLevels=NumberOfPyramidLevels;}
218 
219  unsigned int GetLastPyramidLevel() {return m_LastPyramidLevel;}
220  void SetLastPyramidLevel(unsigned int LastPyramidLevel) {m_LastPyramidLevel=LastPyramidLevel;}
221 
222  double GetPercentageKept() {return m_PercentageKept;}
223  void SetPercentageKept(double PercentageKept) {m_PercentageKept=PercentageKept;}
224 
225  void SetBlockGenerationMask(MaskImageType *mask) {m_BlockGenerationMask = mask;}
226 
227 protected:
230 
231  void SetupPyramids();
232 
233 private:
234  ITK_DISALLOW_COPY_AND_ASSIGN(PyramidalDenseTensorSVFMatchingBridge);
235 
236  BaseTransformPointer m_OutputTransform;
237  InputImagePointer m_OutputImage;
238 
239  InputImageConstPointer m_ReferenceImage, m_FloatingImage;
240  MaskImagePointer m_BlockGenerationMask;
241  PyramidPointer m_ReferencePyramid, m_FloatingPyramid;
242  MaskPyramidPointer m_BlockGenerationPyramid;
243 
244  std::string m_outputTransformFile;
245  std::string m_resultFile;
246 
247  unsigned int m_BlockSize;
248  unsigned int m_BlockSpacing;
249  double m_StDevThreshold;
250 
251  SymmetryType m_SymmetryType;
252  Transform m_Transform;
253  Metric m_Metric;
254  MetricOrientationType m_MetricOrientation;
255  bool m_FiniteStrainImageReorientation;
256  Optimizer m_Optimizer;
257 
258  unsigned int m_MaximumIterations;
259  double m_MinimalTransformError;
260  unsigned int m_OptimizerMaximumIterations;
261  double m_SearchRadius;
262  double m_SearchAngleRadius;
263  double m_SearchScaleRadius;
264  double m_FinalRadius;
265  double m_StepSize;
266  double m_TranslateUpperBound;
267  double m_AngleUpperBound;
268  double m_ScaleUpperBound;
269  Agregator m_Agregator;
270  double m_ExtrapolationSigma;
271  double m_ElasticSigma;
272  double m_OutlierSigma;
273  double m_MEstimateConvergenceThreshold;
274  double m_NeighborhoodApproximation;
275  unsigned int m_BCHCompositionOrder;
276  unsigned int m_ExponentiationOrder;
277 
278  unsigned int m_NumberOfPyramidLevels;
279  unsigned int m_LastPyramidLevel;
280  double m_PercentageKept;
281 
282  BaseBlockMatchRegistrationPointer m_bmreg;
283 };
284 
285 } // end of namespace anima
286 
BaseBlockMatchRegistrationType::Pointer BaseBlockMatchRegistrationPointer
void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold)
void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations)
Computes a pyramid of images using the provided resampler to perform resampling.
DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
itk::AffineTransform< typename BaseAgregatorType::InternalScalarType, ImageDimension > AffineTransformType
MEstimateAgregatorType::BaseOutputTransformType BaseTransformType
DenseSVFTransformAgregator< ImageDimension > MEstimateAgregatorType
itk::StationaryVelocityFieldTransform< ScalarType, NDimensions > BaseOutputTransformType
anima::PyramidImageFilter< InputImageType, InputImageType > PyramidType
itk::SmartPointer< Self > Pointer
rpi::DisplacementFieldTransform< typename BaseAgregatorType::ScalarType, ImageDimension > DisplacementFieldTransformType
BalooSVFTransformAgregator< ImageDimension > BalooAgregatorType
anima::PyramidImageFilter< MaskImageType, MaskImageType > MaskPyramidType
anima::BaseBMRegistrationMethod< InputImageType > BaseBlockMatchRegistrationType