ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMultiResolutionImageRegistrationMethod.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMultiResolutionImageRegistrationMethod_h
19 #define itkMultiResolutionImageRegistrationMethod_h
20 
21 #include "itkProcessObject.h"
22 #include "itkImageToImageMetric.h"
25 #include "itkNumericTraits.h"
26 #include "itkDataObjectDecorator.h"
27 
28 namespace itk
29 {
71 template< typename TFixedImage, typename TMovingImage >
72 class ITK_TEMPLATE_EXPORT MultiResolutionImageRegistrationMethod:public ProcessObject
73 {
74 public:
80 
82  itkNewMacro(Self);
83 
86 
88  typedef TFixedImage FixedImageType;
89  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
90  typedef typename FixedImageType::RegionType FixedImageRegionType;
91 
93  typedef TMovingImage MovingImageType;
94  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
95 
99 
103 
109 
113 
116 
120 
123 
127 
131 
134 
136  void StopRegistration();
137 
139  itkSetConstObjectMacro(FixedImage, FixedImageType);
140  itkGetConstObjectMacro(FixedImage, FixedImageType);
142 
144  itkSetConstObjectMacro(MovingImage, MovingImageType);
145  itkGetConstObjectMacro(MovingImage, MovingImageType);
147 
149  itkSetObjectMacro(Optimizer, OptimizerType);
150  itkGetModifiableObjectMacro(Optimizer, OptimizerType);
152 
154  itkSetObjectMacro(Metric, MetricType);
155  itkGetModifiableObjectMacro(Metric, MetricType);
157 
159  itkSetMacro(FixedImageRegion, FixedImageRegionType);
160  itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
162 
164  itkSetObjectMacro(Transform, TransformType);
165  itkGetModifiableObjectMacro(Transform, TransformType);
167 
169  itkSetObjectMacro(Interpolator, InterpolatorType);
170  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
172 
174  itkSetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
175  itkGetModifiableObjectMacro(FixedImagePyramid, FixedImagePyramidType);
177 
179  itkSetObjectMacro(MovingImagePyramid, MovingImagePyramidType);
180  itkGetModifiableObjectMacro(MovingImagePyramid, MovingImagePyramidType);
182 
184  void SetSchedules(const ScheduleType & fixedSchedule,
185  const ScheduleType & movingSchedule);
186 
187  itkGetConstMacro(FixedImagePyramidSchedule, ScheduleType);
188  itkGetConstMacro(MovingImagePyramidSchedule, ScheduleType);
189 
191  void SetNumberOfLevels(SizeValueType numberOfLevels);
192 
193  itkGetConstMacro(NumberOfLevels, SizeValueType);
194 
196  itkGetConstMacro(CurrentLevel, SizeValueType);
197 
199  itkSetMacro(InitialTransformParameters, ParametersType);
200  itkGetConstReferenceMacro(InitialTransformParameters, ParametersType);
202 
206  itkSetMacro(InitialTransformParametersOfNextLevel, ParametersType);
207  itkGetConstReferenceMacro(InitialTransformParametersOfNextLevel, ParametersType);
209 
212  itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
213 
215  const TransformOutputType * GetOutput() const;
216 
220  using Superclass::MakeOutput;
221  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE;
222 
225  virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE;
226 
227 #ifdef ITKV3_COMPATIBILITY
228  // StartRegistration is an old API from before
229  // this RegistrationMethod was a subclass of ProcessObject.
230  // Historically, one could call StartRegistration() instead of
231  // calling Update(). However, when called directly by the user, the
232  // inputs to the RegistrationMethod may not be up to date. This
233  // may cause an unexpected behavior.
234  //
235  // Since we cannot eliminate StartRegistration for backward
236  // compatibility reasons, we check whether StartRegistration was
237  // called directly or whether Update() (which in turn called
238  // StartRegistration()).
239  void StartRegistration(void) { this->Update(); }
240 #endif
241 
242 protected:
244  virtual ~MultiResolutionImageRegistrationMethod() ITK_OVERRIDE {}
245  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
246 
249  virtual void GenerateData() ITK_OVERRIDE;
250 
255  void Initialize();
256 
258  void PreparePyramids();
259 
261  itkSetMacro(CurrentLevel, SizeValueType);
262 
263 private:
264  ITK_DISALLOW_COPY_AND_ASSIGN(MultiResolutionImageRegistrationMethod);
265 
266  MetricPointer m_Metric;
267  OptimizerType::Pointer m_Optimizer;
268 
269  MovingImageConstPointer m_MovingImage;
271 
272  TransformPointer m_Transform;
273  InterpolatorPointer m_Interpolator;
274 
275  MovingImagePyramidPointer m_MovingImagePyramid;
276  FixedImagePyramidPointer m_FixedImagePyramid;
277 
278  ParametersType m_InitialTransformParameters;
279  ParametersType m_InitialTransformParametersOfNextLevel;
280  ParametersType m_LastTransformParameters;
281 
282  FixedImageRegionType m_FixedImageRegion;
283  std::vector< FixedImageRegionType > m_FixedImageRegionPyramid;
284 
285  SizeValueType m_NumberOfLevels;
286  SizeValueType m_CurrentLevel;
287 
288  bool m_Stop;
289 
290  ScheduleType m_FixedImagePyramidSchedule;
291  ScheduleType m_MovingImagePyramidSchedule;
292 
293  bool m_ScheduleSpecified;
294  bool m_NumberOfLevelsSpecified;
295 };
296 } // end namespace itk
297 
298 #ifndef ITK_MANUAL_INSTANTIATION
299 #include "itkMultiResolutionImageRegistrationMethod.hxx"
300 #endif
301 
302 #endif
Light weight base class for most itk classes.
ImageToImageMetric< FixedImageType, MovingImageType > MetricType
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
This class is a base for the Optimization methods that optimize a single valued function.
MultiResolutionPyramidImageFilter< MovingImageType, MovingImageType > MovingImagePyramidType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Framework for creating images in a multi-resolution pyramid.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
MultiResolutionPyramidImageFilter< FixedImageType, FixedImageType > FixedImagePyramidType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Class to hold and manage different parameter types used during optimization.
Decorates any subclass of itkObject with a DataObject API.
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
Base class for multi-resolution image registration methods.
Base class for all image interpolaters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Computes similarity between regions of two images.