NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkMultiResolutionImageRegistrationWrapper.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkMultiResolutionImageRegistrationWrapper_h
16 #define itkMultiResolutionImageRegistrationWrapper_h
17 
18 #include <itkProcessObject.h>
19 #include <itkNumericTraits.h>
20 #include <itkDataObjectDecorator.h>
21 #include <itkImageToImageMetric.h>
22 #include <itkSingleValuedNonLinearOptimizer.h>
23 #include <itkRecursiveMultiResolutionPyramidImageFilter.h>
25 #include <itkBinaryThresholdImageFilter.h>
26 
27 namespace itk
28 {
29 
40 template <typename TInputImageType, class TPyramidFilter = RecursiveMultiResolutionPyramidImageFilter< TInputImageType, TInputImageType > >
41 class ITK_EXPORT MultiResolutionImageRegistrationWrapper : public ProcessObject
42 {
43 public:
46  typedef ProcessObject Superclass;
47  typedef SmartPointer<Self> Pointer;
48  typedef SmartPointer<const Self> ConstPointer;
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(MultiResolutionImageRegistrationWrapper, ProcessObject);
55 
58  typedef typename SingleResType::Pointer SingleResPointer;
59 
61  typedef TInputImageType InputImageType;
63  typedef typename InputImageType::Pointer InputImagePointer;
64  typedef typename InputImageType::ConstPointer InputImageConstPointer;
66 
68  typedef ImageToImageMetric< InputImageType, InputImageType > MetricType;
69  typedef typename MetricType::Pointer MetricPointer;
70 
74 
77  typedef DataObjectDecorator< TransformType > TransformOutputType;
78  typedef typename TransformOutputType::Pointer TransformOutputPointer;
79  typedef typename TransformOutputType::ConstPointer TransformOutputConstPointer;
80 
82  typedef typename MetricType::InterpolatorType InterpolatorType;
83  typedef typename InterpolatorType::Pointer InterpolatorPointer;
84 
86  typedef SingleValuedNonLinearOptimizer OptimizerType;
87 
89  typedef BinaryThresholdImageFilter<InputImageType, InputImageType> ThresholdFilterType;
90  typedef typename ThresholdFilterType::Pointer ThresholdFilterPointer;
91 
93  typedef TPyramidFilter ImagePyramidType;
94  typedef typename ImagePyramidType::Pointer ImagePyramidPointer;
95  typedef typename ImagePyramidType::ScheduleType ImagePyramidScheduleType;
96 
99  typedef typename MetricType::TransformParametersType ParametersType;
100 
102  typedef typename DataObject::Pointer DataObjectPointer;
103 
105  typedef typename ImagePyramidType::ScheduleType ScheduleType;
106 
108  virtual void StartRegistration();
109 
111  virtual void StopRegistration();
112 
114  itkSetObjectMacro( SingleResMethod, SingleResType );
115  itkGetObjectMacro( SingleResMethod, SingleResType );
116 
118  itkSetConstObjectMacro( FixedImage, InputImageType );
119  itkGetConstObjectMacro( FixedImage, InputImageType );
120 
122  itkSetConstObjectMacro( FixedMask, InputImageType );
123  itkGetConstObjectMacro( FixedMask, InputImageType );
124 
126  itkSetConstObjectMacro( MovingImage, InputImageType );
127  itkGetConstObjectMacro( MovingImage, InputImageType );
128 
130  itkSetConstObjectMacro( MovingMask, InputImageType );
131  itkGetConstObjectMacro( MovingMask, InputImageType );
132 
134  itkSetMacro( NumberOfLevels, unsigned int );
135  itkGetMacro( NumberOfLevels, unsigned int );
136 
140  itkSetMacro ( StartLevel, unsigned int);
141  itkGetMacro ( StartLevel, unsigned int);
142 
146  itkSetMacro ( StopLevel, unsigned int);
147  itkGetMacro ( StopLevel, unsigned int);
148 
150  itkGetMacro( CurrentLevel, unsigned int );
151 
153  //itkSetMacro( InitialTransformParameters, ParametersType );
154  //itkGetConstReferenceMacro( InitialTransformParameters, ParametersType );
155  virtual void SetInitialTransformParameters(const ParametersType& parameters)
156  {
157  this->m_InitialTransformParametersOfNextLevel = parameters;
158  }
159  virtual const ParametersType& GetInitialTransformParameters() const
160  {
161  return this->m_InitialTransformParametersOfNextLevel;
162  }
163 
169  itkSetMacro( InitialTransformParametersOfNextLevel, ParametersType );
170  itkGetConstReferenceMacro( InitialTransformParametersOfNextLevel, ParametersType );
171 
176  //itkGetConstReferenceMacro( LastTransformParameters, ParametersType );
177  virtual const ParametersType& GetLastTransformParameters() const
178  {
179  return this->m_SingleResMethod->GetLastTransformParameters();
180  }
181 
183  const TransformOutputType * GetOutput() const;
184 
187  virtual DataObjectPointer MakeOutput(unsigned int idx);
188 
191  unsigned long GetMTime() const override;
192 
194  ScheduleType* GetSchedule() { return m_Schedule;}
195  void SetSchedule(ScheduleType* schedule)
196  {
197  this->m_Schedule = schedule;
198  this->m_UserSpecifiedSchedule = true;
199  }
200 
204  itkSetMacro ( MaskBeforePyramid, bool);
205  itkGetMacro ( MaskBeforePyramid, bool);
206 
207  itkSetMacro (UseOriginalImageAtFinalLevel, bool);
208  itkGetMacro (UseOriginalImageAtFinalLevel, bool);
209 
210  itkSetMacro (IsAutoAdjustMovingSamping, bool);
211  itkGetMacro (IsAutoAdjustMovingSamping, bool);
212 
213 protected:
216  void PrintSelf(std::ostream& os, Indent indent) const override;
217 
221  void GenerateData () override;
222 
226  virtual void PreparePyramids();
227 
232  virtual void Initialize() throw (ExceptionObject);
233 
238  virtual void BeforeSingleResolutionRegistration() {};
239 
244  virtual void AfterSingleResolutionRegistration() {};
245 
246  unsigned int m_NumberOfLevels;
247  unsigned int m_StartLevel;
248  unsigned int m_StopLevel;
249  unsigned int m_CurrentLevel;
251  SingleResPointer m_SingleResMethod;
252 
258 
259  InputImageConstPointer m_FixedImage;
260  InputImageConstPointer m_FixedMask;
261  InputImageConstPointer m_MovingImage;
262  InputImageConstPointer m_MovingMask;
263 
264  ImagePyramidPointer m_FixedImagePyramid;
265  ImagePyramidPointer m_FixedMaskPyramid;
266  ImagePyramidPointer m_MovingImagePyramid;
267  ImagePyramidPointer m_MovingMaskPyramid;
268 
269  ThresholdFilterPointer m_FixedMaskThresholder;
270  ThresholdFilterPointer m_MovingMaskThresholder;
271 
272  bool m_Stop;
273 
274  ScheduleType* m_Schedule;
275 
277 
278  // Automatically adjust the sampling in moving image
279  // depending on the resolution.
281 
282 private:
283  MultiResolutionImageRegistrationWrapper(const Self&); //purposely not implemented
284  void operator=(const Self&); //purposely not implemented
285 
286 };
287 
288 
289 } // end namespace itk
290 
291 
292 #ifndef ITK_MANUAL_INSTANTIATION
293 #include "itkMultiResolutionImageRegistrationWrapper.txx"
294 #endif
295 
296 #endif
297 
298 
299 
ImagePyramidPointer m_MovingMaskPyramid
Definition: itkMultiResolutionImageRegistrationWrapper.h:267
ImagePyramidPointer m_MovingImagePyramid
Definition: itkMultiResolutionImageRegistrationWrapper.h:266
ImagePyramidType::ScheduleType ScheduleType
Definition: itkMultiResolutionImageRegistrationWrapper.h:105
ParametersType m_InitialTransformParametersOfNextLevel
Definition: itkMultiResolutionImageRegistrationWrapper.h:250
Base class for NifTK Image Registration Methods employing a binary mask.
Definition: itkMaskedImageRegistrationMethod.h:55
SingleResPointer m_SingleResMethod
Definition: itkMultiResolutionImageRegistrationWrapper.h:251
ThresholdFilterPointer m_FixedMaskThresholder
Definition: itkMultiResolutionImageRegistrationWrapper.h:269
SmartPointer< const Self > ConstPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:48
ScheduleType * m_Schedule
Definition: itkMultiResolutionImageRegistrationWrapper.h:274
InterpolatorType::Pointer InterpolatorPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:83
ThresholdFilterPointer m_MovingMaskThresholder
Definition: itkMultiResolutionImageRegistrationWrapper.h:270
virtual ~MultiResolutionImageRegistrationWrapper()
Definition: itkMultiResolutionImageRegistrationWrapper.h:215
DataObjectDecorator< TransformType > TransformOutputType
Definition: itkMultiResolutionImageRegistrationWrapper.h:77
TransformOutputType::ConstPointer TransformOutputConstPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:79
virtual void SetInitialTransformParameters(const ParametersType &parameters)
Definition: itkMultiResolutionImageRegistrationWrapper.h:155
Definition: niftkITKAffineResampleImage.cxx:74
TPyramidFilter ImagePyramidType
Definition: itkMultiResolutionImageRegistrationWrapper.h:93
unsigned int m_CurrentLevel
Definition: itkMultiResolutionImageRegistrationWrapper.h:249
itk::EulerAffineTransform< double, 2, 2 > TransformType
Definition: EulerAffine2DJacobianTest.cxx:27
virtual const ParametersType & GetInitialTransformParameters() const
Definition: itkMultiResolutionImageRegistrationWrapper.h:159
bool m_UserSpecifiedSchedule
Definition: itkMultiResolutionImageRegistrationWrapper.h:257
ImageToImageMetric< InputImageType, InputImageType > MetricType
Definition: itkMultiResolutionImageRegistrationWrapper.h:68
ImagePyramidType::ScheduleType ImagePyramidScheduleType
Definition: itkMultiResolutionImageRegistrationWrapper.h:95
DataObject::Pointer DataObjectPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:102
InputImageType::ConstPointer InputImageConstPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:64
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
bool m_MaskBeforePyramid
Definition: itkMultiResolutionImageRegistrationWrapper.h:276
bool m_IsAutoAdjustMovingSamping
Definition: itkMultiResolutionImageRegistrationWrapper.h:280
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
MaskedImageRegistrationMethod< TInputImageType > SingleResType
Definition: itkMultiResolutionImageRegistrationWrapper.h:54
ThresholdFilterType::Pointer ThresholdFilterPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:90
bool m_Stop
Definition: itkMultiResolutionImageRegistrationWrapper.h:272
ImagePyramidType::Pointer ImagePyramidPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:94
BinaryThresholdImageFilter< InputImageType, InputImageType > ThresholdFilterType
Definition: itkMultiResolutionImageRegistrationWrapper.h:89
unsigned int m_StartLevel
Definition: itkMultiResolutionImageRegistrationWrapper.h:247
ProcessObject Superclass
Definition: itkMultiResolutionImageRegistrationWrapper.h:46
InputImageConstPointer m_FixedImage
Definition: itkMultiResolutionImageRegistrationWrapper.h:259
InputImageConstPointer m_MovingMask
Definition: itkMultiResolutionImageRegistrationWrapper.h:262
ImagePyramidPointer m_FixedMaskPyramid
Definition: itkMultiResolutionImageRegistrationWrapper.h:265
SingleResType::Pointer SingleResPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:58
ScheduleType * GetSchedule()
Definition: itkMultiResolutionImageRegistrationWrapper.h:194
MultiResolutionImageRegistrationWrapper Self
Definition: itkMultiResolutionImageRegistrationWrapper.h:45
InputImageConstPointer m_MovingImage
Definition: itkMultiResolutionImageRegistrationWrapper.h:261
InputImageType::RegionType InputImageRegionType
Definition: itkMultiResolutionImageRegistrationWrapper.h:65
InputImageConstPointer m_FixedMask
Definition: itkMultiResolutionImageRegistrationWrapper.h:260
TInputImageType InputImageType
Definition: itkMultiResolutionImageRegistrationWrapper.h:61
unsigned int m_StopLevel
Definition: itkMultiResolutionImageRegistrationWrapper.h:248
MetricType::Pointer MetricPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:69
void SetSchedule(ScheduleType *schedule)
Definition: itkMultiResolutionImageRegistrationWrapper.h:195
virtual const ParametersType & GetLastTransformParameters() const
Definition: itkMultiResolutionImageRegistrationWrapper.h:177
ImagePyramidPointer m_FixedImagePyramid
Definition: itkMultiResolutionImageRegistrationWrapper.h:264
MetricType::TransformParametersType ParametersType
Definition: itkMultiResolutionImageRegistrationWrapper.h:99
MetricType::InterpolatorType InterpolatorType
Definition: itkMultiResolutionImageRegistrationWrapper.h:82
TransformOutputType::Pointer TransformOutputPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:78
InputImageType::PixelType InputImagePixelType
Definition: itkMultiResolutionImageRegistrationWrapper.h:62
SingleValuedNonLinearOptimizer OptimizerType
Definition: itkMultiResolutionImageRegistrationWrapper.h:86
TransformType::Pointer TransformPointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:73
SmartPointer< Self > Pointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:47
SmartPointer< Self > Pointer
Definition: itkEulerAffineTransform.h:49
InputImageType::Pointer InputImagePointer
Definition: itkMultiResolutionImageRegistrationWrapper.h:63
UCL Base class for multi-resolution image registration methods.
Definition: itkMultiResolutionImageRegistrationWrapper.h:41
MetricType::TransformType TransformType
Definition: itkMultiResolutionImageRegistrationWrapper.h:72
bool m_UseOriginalImageAtFinalLevel
Definition: itkMultiResolutionImageRegistrationWrapper.h:256