ITK  4.3.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 >
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  itkGetObjectMacro(Optimizer, OptimizerType);
152 
154  itkSetObjectMacro(Metric, MetricType);
155  itkGetObjectMacro(Metric, MetricType);
157 
159  itkSetMacro(FixedImageRegion, FixedImageRegionType);
160  itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
162 
164  itkSetObjectMacro(Transform, TransformType);
165  itkGetObjectMacro(Transform, TransformType);
167 
169  itkSetObjectMacro(Interpolator, InterpolatorType);
170  itkGetObjectMacro(Interpolator, InterpolatorType);
172 
174  itkSetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
175  itkGetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
177 
179  itkSetObjectMacro(MovingImagePyramid, MovingImagePyramidType);
180  itkGetObjectMacro(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);
222 
225  ModifiedTimeType GetMTime() const;
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:
245  void PrintSelf(std::ostream & os, Indent indent) const;
246 
249  void GenerateData();
250 
255  void Initialize()
256  throw ( ExceptionObject );
257 
259  void PreparePyramids(void);
260 
262  itkSetMacro(CurrentLevel, SizeValueType);
263 
264 private:
265  MultiResolutionImageRegistrationMethod(const Self &); //purposely not
266  // implemented
267  void operator=(const Self &); //purposely not
268 
269  // implemented
270 
271  MetricPointer m_Metric;
272  OptimizerType::Pointer m_Optimizer;
273 
274  MovingImageConstPointer m_MovingImage;
276 
277  TransformPointer m_Transform;
278  InterpolatorPointer m_Interpolator;
279 
280  MovingImagePyramidPointer m_MovingImagePyramid;
281  FixedImagePyramidPointer m_FixedImagePyramid;
282 
283  ParametersType m_InitialTransformParameters;
284  ParametersType m_InitialTransformParametersOfNextLevel;
285  ParametersType m_LastTransformParameters;
286 
287  FixedImageRegionType m_FixedImageRegion;
288  std::vector< FixedImageRegionType > m_FixedImageRegionPyramid;
289 
290  SizeValueType m_NumberOfLevels;
291  SizeValueType m_CurrentLevel;
292 
293  bool m_Stop;
294 
295  ScheduleType m_FixedImagePyramidSchedule;
296  ScheduleType m_MovingImagePyramidSchedule;
297 
298  bool m_ScheduleSpecified;
299  bool m_NumberOfLevelsSpecified;
300 };
301 } // end namespace itk
302 
303 #ifndef ITK_MANUAL_INSTANTIATION
304 #include "itkMultiResolutionImageRegistrationMethod.hxx"
305 #endif
306 
307 #endif
308