ANIMA  4.0
animaPyramidalSymmetryConstrainedRegistrationBridge.h
Go to the documentation of this file.
1 #pragma once
2 #include <cmath>
3 
4 #include <itkImage.h>
7 #include <itkAffineTransform.h>
8 #include <itkProcessObject.h>
9 
10 enum Metric
11 {
15 };
16 
17 namespace anima
18 {
19 
20 template <typename ScalarType = double>
21 class PyramidalSymmetryConstrainedRegistrationBridge : public itk::ProcessObject
22 {
23 public:
24  typedef itk::Image <double,3> InputImageType;
25  typedef typename InputImageType::Pointer InputImagePointer;
26  typedef typename InputImageType::RegionType InputImageRegionType;
27 
33 
34  typedef itk::AffineTransform<ScalarType,3> BaseTransformType;
35  typedef typename BaseTransformType::Pointer BaseTransformPointer;
36 
39 
42  typedef itk::ProcessObject Superclass;
43 
44  typedef itk::SmartPointer<Self> Pointer;
45  typedef itk::SmartPointer<const Self> ConstPointer;
46 
47  itkNewMacro(Self)
48 
49  itkTypeMacro(PyramidalSymmetryConstrainedRegistrationBridge,itk::ProcessObject)
50 
51  void Update() ITK_OVERRIDE;
52 
53  void WriteOutputs();
54 
58  void SetReferenceImage(InputImagePointer referenceImage) {m_ReferenceImage = referenceImage;}
59  void SetFloatingImage(InputImagePointer FloatingImage) {m_FloatingImage = FloatingImage;}
60 
61  std::string GetResultFile() {return m_resultFile;}
62  void SetResultFile(std::string resultFile) {m_resultFile=resultFile;}
63 
64  std::string GetOutputTransformFile() {return m_outputTransformFile;}
65  void SetOutputTransformFile(std::string outputTransformFile) {m_outputTransformFile=outputTransformFile;}
66 
67  Metric GetMetric() {return m_Metric;}
68  void SetMetric(Metric metric) {m_Metric=metric;}
69 
70  unsigned int GetOptimizerMaximumIterations() {return m_OptimizerMaximumIterations;}
71  void SetOptimizerMaximumIterations(unsigned int OptimizerMaximumIterations) {m_OptimizerMaximumIterations=OptimizerMaximumIterations;}
72 
73  double GetUpperBoundAngle() {return m_UpperBoundAngle;}
74  void SetUpperBoundAngle(double val) {m_UpperBoundAngle = val;}
75 
76  double GetTranslateUpperBound() {return m_TranslateUpperBound;}
77  void SetTranslateUpperBound(double val) {m_TranslateUpperBound = val;}
78 
79  double GetHistogramSize() {return m_HistogramSize;}
80  void SetHistogramSize(double HistogramSize) {m_HistogramSize = HistogramSize;}
81 
82  unsigned int GetNumberOfPyramidLevels() {return m_NumberOfPyramidLevels;}
83  void SetNumberOfPyramidLevels(unsigned int NumberOfPyramidLevels) {m_NumberOfPyramidLevels=NumberOfPyramidLevels;}
84 
85  void SetFastRegistration(bool arg) {m_FastRegistration = arg;}
86 
87  void SetRefSymmetryTransform(BaseTransformType *trsf) {m_RefSymmetryTransform = trsf;}
88  void SetFloSymmetryTransform(BaseTransformType *trsf) {m_FloSymmetryTransform = trsf;}
89 
90 protected:
93 
94  void SetupPyramids();
95 
96 private:
97  ITK_DISALLOW_COPY_AND_ASSIGN(PyramidalSymmetryConstrainedRegistrationBridge);
98 
99  //Symmetry constrained transform
100  TransformPointer m_OutputTransform;
101  BaseTransformPointer m_OutputRealignTransform;
102 
103  //Transform to realign image onto its mid-sagittal plane
104  BaseTransformPointer m_RefSymmetryTransform, m_FloSymmetryTransform, m_InitialTransform;
105 
106  InputImagePointer m_OutputImage;
107 
108  Metric m_Metric;
109 
110  double m_ReferenceMinimalValue, m_FloatingMinimalValue;
111  double m_TranslateUpperBound;
112  double m_UpperBoundAngle;
113  unsigned int m_OptimizerMaximumIterations;
114  unsigned int m_HistogramSize;
115  unsigned int m_NumberOfPyramidLevels;
116  bool m_FastRegistration;
117 
118  std::string m_outputTransformFile;
119  std::string m_resultFile;
120 
121  InputImagePointer m_ReferenceImage, m_FloatingImage;
122  PyramidPointer m_ReferencePyramid, m_FloatingPyramid;
123 };
124 
125 } // end of namespace anima
126 
Superclass::ParametersType ParametersType
Computes a pyramid of images using the provided resampler to perform resampling.
anima::PyramidImageFilter< InputImageType, InputImageType > PyramidType
itk::SmartPointer< Self > Pointer