ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkImageRegistrationMethodv4.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 __itkImageRegistrationMethodv4_h
19 #define __itkImageRegistrationMethodv4_h
20 
21 #include "itkProcessObject.h"
22 
23 #include "itkAffineTransform.h"
24 #include "itkCompositeTransform.h"
25 #include "itkDataObjectDecorator.h"
29 #include "itkTransform.h"
31 
32 #include <vector>
33 
34 namespace itk
35 {
36 
88 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
89  AffineTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
90 class ITK_EXPORT ImageRegistrationMethodv4
91 :public ProcessObject
92 {
93 public:
99 
101  itkNewMacro( Self );
102 
104  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
105 
108 
110  typedef TFixedImage FixedImageType;
111  typedef typename FixedImageType::Pointer FixedImagePointer;
112  typedef TMovingImage MovingImageType;
113  typedef typename MovingImageType::Pointer MovingImagePointer;
114 
118 
119  typedef TOutputTransform OutputTransformType;
120  typedef typename OutputTransformType::Pointer OutputTransformPointer;
121  typedef typename OutputTransformType::ScalarType RealType;
122  typedef typename OutputTransformType::DerivativeType DerivativeType;
123  typedef typename DerivativeType::ValueType DerivativeValueType;
124 
127 
130 
137 
142 
148 
152  typedef std::vector<TransformParametersAdaptorPointer> TransformParametersAdaptorsContainerType;
153 
157 
159  enum MetricSamplingStrategyType { NONE, REGULAR, RANDOM };
160 
162 
164  itkSetInputMacro( FixedImage, FixedImageType );
165  itkGetInputMacro( FixedImage, FixedImageType );
167 
169  itkSetInputMacro( MovingImage, MovingImageType );
170  itkGetInputMacro( MovingImage, MovingImageType );
172 
174  itkSetObjectMacro( FixedInitialTransform, InitialTransformType );
175  itkGetConstObjectMacro( FixedInitialTransform, InitialTransformType );
177 
179  itkSetObjectMacro( MovingInitialTransform, InitialTransformType );
180  itkGetConstObjectMacro( MovingInitialTransform, InitialTransformType );
182 
184  itkSetObjectMacro( FixedInterpolator, FixedInterpolatorType );
185  itkGetConstObjectMacro( FixedInterpolator, FixedInterpolatorType );
187 
189  itkSetObjectMacro( MovingInterpolator, MovingInterpolatorType );
190  itkGetConstObjectMacro( MovingInterpolator, MovingInterpolatorType );
192 
194  itkSetObjectMacro( Metric, MetricType );
195  itkGetObjectMacro( Metric, MetricType );
197 
199  itkSetMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
200  itkGetConstMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
202 
204  void SetMetricSamplingPercentage( const RealType );
205 
207  itkSetMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
208  itkGetConstMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
210 
212  itkSetObjectMacro( Optimizer, OptimizerType );
213  itkGetObjectMacro( Optimizer, OptimizerType );
215 
217  void SetTransformParametersAdaptorsPerLevel( TransformParametersAdaptorsContainerType & );
218  const TransformParametersAdaptorsContainerType & GetTransformParametersAdaptorsPerLevel() const;
220 
228  void SetNumberOfLevels( const SizeValueType );
229  itkGetConstMacro( NumberOfLevels, SizeValueType );
231 
237  itkSetMacro( ShrinkFactorsPerLevel, ShrinkFactorsArrayType );
238  itkGetConstMacro( ShrinkFactorsPerLevel, ShrinkFactorsArrayType );
240 
246  itkSetMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
247  itkGetConstMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
249 
251  void StartRegistration() { this->GenerateData(); }
252 
255  using Superclass::MakeOutput;
257 
259  virtual const DecoratedOutputTransformType * GetOutput() const;
260 
262  itkGetConstMacro( CurrentLevel, SizeValueType );
263 
265  itkGetConstReferenceMacro( CurrentIteration, SizeValueType );
266 
267  /* Get the current metric value. This is a helper function for reporting observations. */
268  itkGetConstReferenceMacro( CurrentMetricValue, RealType );
269 
271  itkGetConstReferenceMacro( CurrentConvergenceValue, RealType );
272 
274  itkGetConstReferenceMacro( IsConverged, bool );
275 
276 protected:
278  virtual ~ImageRegistrationMethodv4();
279  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
280 
282  virtual void GenerateData();
283 
285  virtual void InitializeRegistrationAtEachLevel( const SizeValueType );
286 
288  virtual void SetMetricSamplePoints();
289 
296 
299 
302 
305 
307 
311 
314 
316 
318 
320 
321 private:
322  ImageRegistrationMethodv4( const Self & ); //purposely not implemented
323  void operator=( const Self & ); //purposely not implemented
324 };
325 } // end namespace itk
326 
327 #ifndef ITK_MANUAL_INSTANTIATION
328 #include "itkImageRegistrationMethodv4.hxx"
329 #endif
330 
331 #endif
332