ANIMA  4.0
animaPyramidalDenseSVFMatchingBridge.h
Go to the documentation of this file.
1 #pragma once
3 
4 #include <itkImage.h>
7 #include <itkAffineTransform.h>
9 #include <rpiDisplacementFieldTransform.h>
10 
11 namespace anima
12 {
13 
14 template <unsigned int ImageDimension = 3>
15 class PyramidalDenseSVFMatchingBridge : public itk::ProcessObject
16 {
17 public:
18  typedef itk::Image <double,ImageDimension> InputImageType;
19  typedef typename InputImageType::IOPixelType InputPixelType;
20  typedef typename InputImageType::Pointer InputImagePointer;
21  typedef typename InputImageType::ConstPointer InputImageConstPointer;
22 
23  typedef itk::Image <unsigned char, ImageDimension> MaskImageType;
24  typedef typename MaskImageType::Pointer MaskImagePointer;
27 
31 
33  typedef typename BaseTransformType::Pointer BaseTransformPointer;
34  typedef typename BaseTransformType::VectorFieldType VelocityFieldType;
35  typedef typename VelocityFieldType::PixelType VectorType;
36 
37  typedef itk::AffineTransform<typename BaseAgregatorType::InternalScalarType,ImageDimension> AffineTransformType;
38  typedef typename AffineTransformType::Pointer AffineTransformPointer;
39 
40  typedef rpi::DisplacementFieldTransform<typename BaseAgregatorType::ScalarType, ImageDimension> DisplacementFieldTransformType;
41  typedef typename DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer;
42 
45 
48 
51  typedef itk::ProcessObject Superclass;
52 
53  typedef itk::SmartPointer<Self> Pointer;
54  typedef itk::SmartPointer<const Self> ConstPointer;
55 
56  itkNewMacro(Self)
57  itkTypeMacro(PyramidalDenseSVFMatchingBridge,itk::ProcessObject)
58 
60  {
64  };
65 
66  enum Transform
67  {
72  };
73 
74  enum Metric
75  {
79  };
80 
81  enum Optimizer
82  {
85  };
86 
87  enum Agregator
88  {
89  Baloo = 0,
91  };
92 
93  void Update() ITK_OVERRIDE;
94 
95  void Abort();
96 
97  void WriteOutputs();
98 
102  void SetReferenceImage(InputImagePointer referenceImage) {m_ReferenceImage = referenceImage;}
103  void SetFloatingImage(InputImagePointer FloatingImage) {m_FloatingImage = FloatingImage;}
104 
105  InputImagePointer GetOutputImage() {return m_OutputImage;}
106 
110  BaseTransformPointer GetOutputTransform() {return m_OutputTransform;}
111 
115  DisplacementFieldTransformPointer GetOutputDisplacementFieldTransform();
116 
117  void SetProgressCallback(itk::CStyleCommand::Pointer callback ) {m_progressCallback = callback;}
118 
123  std::string GetResultFile() {return m_resultFile;}
124  void SetResultFile(std::string resultFile) {m_resultFile=resultFile;}
125 
126  std::string GetOutputTransformFile() {return m_outputTransformFile;}
127  void SetOutputTransformFile(std::string outputTransformFile) {m_outputTransformFile=outputTransformFile;}
128 
129  unsigned int GetBlockSize() {return m_BlockSize;}
130  void SetBlockSize(int blockSize) {m_BlockSize=blockSize;}
131 
132  unsigned int GetBlockSpacing() {return m_BlockSpacing;}
133  void SetBlockSpacing(unsigned int blockSpacing) {m_BlockSpacing=blockSpacing;}
134 
135  double GetStDevThreshold() {return m_StDevThreshold;}
136  void SetStDevThreshold(double StDevThreshold) {m_StDevThreshold=StDevThreshold;}
137 
138  SymmetryType GetSymmetryType() {return m_SymmetryType;}
139  void SetSymmetryType(SymmetryType sym) {m_SymmetryType=sym;}
140 
141  Transform GetTransform() {return m_Transform;}
142  void SetTransform(Transform transform) {m_Transform=transform;}
143 
144  unsigned int GetAffineDirection() {return m_AffineDirection;}
145  void SetAffineDirection(unsigned int val) {m_AffineDirection = val;}
146 
147  Metric GetMetric() {return m_Metric;}
148  void SetMetric(Metric metric) {m_Metric=metric;}
149 
150  Optimizer GetOptimizer() {return m_Optimizer;}
151  void SetOptimizer(Optimizer optimizer) {m_Optimizer=optimizer;}
152 
153  unsigned int GetMaximumIterations() {return m_MaximumIterations;}
154  void SetMaximumIterations(unsigned int MaximumIterations) {m_MaximumIterations=MaximumIterations;}
155 
156  double GetMinimalTransformError() {return m_MinimalTransformError;}
157  void SetMinimalTransformError(double MinimalTransformError) {m_MinimalTransformError=MinimalTransformError;}
158 
159  unsigned int GetOptimizerMaximumIterations() {return m_OptimizerMaximumIterations;}
160  void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations) {m_OptimizerMaximumIterations=OptimizerMaximumIterations;}
161 
162  double GetSearchRadius() {return m_SearchRadius;}
163  void SetSearchRadius(double SearchRadius) {m_SearchRadius=SearchRadius;}
164 
165  double GetSearchAngleRadius() {return m_SearchAngleRadius;}
166  void SetSearchAngleRadius(double SearchAngleRadius) {m_SearchAngleRadius=SearchAngleRadius;}
167 
168  double GetSearchScaleRadius() {return m_SearchScaleRadius;}
169  void SetSearchScaleRadius(double SearchScaleRadius) {m_SearchScaleRadius=SearchScaleRadius;}
170 
171  double GetFinalRadius() {return m_FinalRadius;}
172  void SetFinalRadius(double FinalRadius) {m_FinalRadius=FinalRadius;}
173 
174  double GetStepSize() {return m_StepSize;}
175  void SetStepSize(double StepSize) {m_StepSize=StepSize;}
176 
177  double GetTranslateUpperBound() {return m_TranslateUpperBound;}
178  void SetTranslateUpperBound(double TranslateUpperBound) {m_TranslateUpperBound=TranslateUpperBound;}
179 
180  double GetAngleUpperBound() {return m_AngleUpperBound;}
181  void SetAngleUpperBound(double AngleUpperBound) {m_AngleUpperBound=AngleUpperBound;}
182 
183  double GetScaleUpperBound() {return m_ScaleUpperBound;}
184  void SetScaleUpperBound(double ScaleUpperBound) {m_ScaleUpperBound=ScaleUpperBound;}
185 
186  Agregator GetAgregator() {return m_Agregator;}
187  void SetAgregator(Agregator agregator) {m_Agregator=agregator;}
188 
189  double GetExtrapolationSigma() {return m_ExtrapolationSigma;}
190  void SetExtrapolationSigma(double extrapolationSigma) {m_ExtrapolationSigma = extrapolationSigma;}
191 
192  double GetElasticSigma() {return m_ElasticSigma;}
193  void SetElasticSigma(double elasticSigma) {m_ElasticSigma = elasticSigma;}
194 
195  double GetOutlierSigma() {return m_OutlierSigma;}
196  void SetOutlierSigma(double outlierSigma) {m_OutlierSigma = outlierSigma;}
197 
198  double GetMEstimateConvergenceThreshold() {return m_MEstimateConvergenceThreshold;}
199  void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold) {m_MEstimateConvergenceThreshold = mEstimateConvergenceThreshold;}
200 
201  double GetNeighborhoodApproximation() {return m_NeighborhoodApproximation;}
202  void SetNeighborhoodApproximation(double neighborhoodApproximation) {m_NeighborhoodApproximation = neighborhoodApproximation;}
203 
204  unsigned int GetBCHCompositionOrder() {return m_BCHCompositionOrder;}
205  void SetBCHCompositionOrder(unsigned int order) {m_BCHCompositionOrder = order;}
206 
207  unsigned int GetExponentiationOrder() {return m_ExponentiationOrder;}
208  void SetExponentiationOrder(unsigned int order) {m_ExponentiationOrder = order;}
209 
210  unsigned int GetNumberOfPyramidLevels() {return m_NumberOfPyramidLevels;}
211  void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels) {m_NumberOfPyramidLevels=NumberOfPyramidLevels;}
212 
213  unsigned int GetLastPyramidLevel() {return m_LastPyramidLevel;}
214  void SetLastPyramidLevel(unsigned int LastPyramidLevel) {m_LastPyramidLevel=LastPyramidLevel;}
215 
216  double GetPercentageKept() {return m_PercentageKept;}
217  void SetPercentageKept(double PercentageKept) {m_PercentageKept=PercentageKept;}
218 
219  void SetBlockGenerationMask(MaskImageType *mask) {m_BlockGenerationMask = mask;}
220 
221  void SetVerbose(bool value) {m_Verbose = value;}
222 
223 protected:
226 
227  void SetupPyramids();
228 
229  void EmitProgress(int prog);
230  static void ManageProgress( itk::Object* caller, const itk::EventObject& event, void* clientData );
231 
232 private:
233  ITK_DISALLOW_COPY_AND_ASSIGN(PyramidalDenseSVFMatchingBridge);
234 
235  BaseTransformPointer m_OutputTransform;
236  InputImagePointer m_OutputImage;
237 
238  InputImagePointer m_ReferenceImage, m_FloatingImage;
239  MaskImagePointer m_BlockGenerationMask;
240  PyramidPointer m_ReferencePyramid, m_FloatingPyramid;
241  MaskPyramidPointer m_BlockGenerationPyramid;
242 
243  std::string m_outputTransformFile;
244  std::string m_resultFile;
245 
246  unsigned int m_BlockSize;
247  unsigned int m_BlockSpacing;
248  double m_StDevThreshold;
249 
250  SymmetryType m_SymmetryType;
251  Transform m_Transform;
252  unsigned int m_AffineDirection;
253  Metric m_Metric;
254  Optimizer m_Optimizer;
255 
256  double m_ReferenceMinimalValue, m_FloatingMinimalValue;
257  unsigned int m_MaximumIterations;
258  double m_MinimalTransformError;
259  unsigned int m_OptimizerMaximumIterations;
260  double m_SearchRadius;
261  double m_SearchAngleRadius;
262  double m_SearchScaleRadius;
263  double m_FinalRadius;
264  double m_StepSize;
265  double m_TranslateUpperBound;
266  double m_AngleUpperBound;
267  double m_ScaleUpperBound;
268  Agregator m_Agregator;
269  double m_ExtrapolationSigma;
270  double m_ElasticSigma;
271  double m_OutlierSigma;
272  double m_MEstimateConvergenceThreshold;
273  double m_NeighborhoodApproximation;
274  unsigned int m_BCHCompositionOrder;
275  unsigned int m_ExponentiationOrder;
276 
277  unsigned int m_NumberOfPyramidLevels;
278  unsigned int m_LastPyramidLevel;
279  double m_PercentageKept;
280 
281  bool m_Abort;
282  bool m_Verbose;
283 
284  itk::ProgressReporter *m_progressReporter;
285  itk::CStyleCommand::Pointer m_progressCallback;
286  itk::CStyleCommand::Pointer m_callback;
287 
288  BaseBlockMatchRegistrationPointer m_bmreg;
289 };
290 
291 }// end of namespace anima
292 
itk::Image< unsigned char, ImageDimension > MaskImageType
void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations)
BaseTransformAgregator< ImageDimension > BaseAgregatorType
anima::BaseBMRegistrationMethod< InputImageType > BaseBlockMatchRegistrationType
void SetMEstimateConvergenceThreshold(double mEstimateConvergenceThreshold)
itk::AffineTransform< typename BaseAgregatorType::InternalScalarType, ImageDimension > AffineTransformType
rpi::DisplacementFieldTransform< typename BaseAgregatorType::ScalarType, ImageDimension > DisplacementFieldTransformType
void SetMinimalTransformError(double MinimalTransformError)
BalooSVFTransformAgregator< ImageDimension > BalooAgregatorType
Computes a pyramid of images using the provided resampler to perform resampling.
void SetMaximumIterations(unsigned int MaximumIterations)
DenseSVFTransformAgregator< ImageDimension > MEstimateAgregatorType
void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels)
anima::PyramidImageFilter< InputImageType, InputImageType > PyramidType
void SetOutputTransformFile(std::string outputTransformFile)
void SetReferenceImage(InputImagePointer referenceImage)
static void ManageProgress(itk::Object *caller, const itk::EventObject &event, void *clientData)
void SetNeighborhoodApproximation(double neighborhoodApproximation)
void SetProgressCallback(itk::CStyleCommand::Pointer callback)
void SetFloatingImage(InputImagePointer FloatingImage)
DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
itk::StationaryVelocityFieldTransform< ScalarType, NDimensions > BaseOutputTransformType
DisplacementFieldTransformPointer GetOutputDisplacementFieldTransform()
BaseBlockMatchRegistrationType::Pointer BaseBlockMatchRegistrationPointer
anima::PyramidImageFilter< MaskImageType, MaskImageType > MaskPyramidType
MEstimateAgregatorType::BaseOutputTransformType BaseTransformType
itk::SmartPointer< Self > Pointer