ITK  4.3.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 "itkCompositeTransform.h"
24 #include "itkDataObjectDecorator.h"
29 #include "itkTransform.h"
31 
32 #include <vector>
33 
34 namespace itk
35 {
36 
87 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform>
88 class ITK_EXPORT ImageRegistrationMethodv4
89 :public ProcessObject
90 {
91 public:
97 
99  itkNewMacro( Self );
100 
102  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
103 
106 
108  typedef TFixedImage FixedImageType;
109  typedef typename FixedImageType::Pointer FixedImagePointer;
110  typedef std::vector<FixedImagePointer> FixedImagesContainerType;
111  typedef TMovingImage MovingImageType;
112  typedef typename MovingImageType::Pointer MovingImagePointer;
113  typedef std::vector<MovingImagePointer> MovingImagesContainerType;
114 
118 
122 
123  typedef TOutputTransform OutputTransformType;
124  typedef typename OutputTransformType::Pointer OutputTransformPointer;
125  typedef typename OutputTransformType::ScalarType RealType;
126  typedef typename OutputTransformType::DerivativeType DerivativeType;
127  typedef typename DerivativeType::ValueType DerivativeValueType;
128 
131 
134 
141 
146 
150  typedef std::vector<TransformParametersAdaptorPointer> TransformParametersAdaptorsContainerType;
151 
155 
157  enum MetricSamplingStrategyType { NONE, REGULAR, RANDOM };
158 
160 
162  virtual void SetFixedImage( const FixedImageType *image )
163  {
164  this->SetFixedImage( 0, image );
165  }
166  virtual const FixedImageType * GetFixedImage() const
167  {
168  return this->GetFixedImage( 0 );
169  }
170  virtual void SetFixedImage( SizeValueType, const FixedImageType * );
171  virtual const FixedImageType * GetFixedImage( SizeValueType ) const;
173 
175  virtual void SetMovingImage( const MovingImageType *image )
176  {
177  this->SetMovingImage( 0, image );
178  }
179  virtual const MovingImageType * GetMovingImage() const
180  {
181  return this->GetMovingImage( 0 );
182  }
183  virtual void SetMovingImage( SizeValueType, const MovingImageType * );
184  virtual const MovingImageType * GetMovingImage( SizeValueType ) const;
186 
188  itkSetObjectMacro( Optimizer, OptimizerType );
189  itkGetObjectMacro( Optimizer, OptimizerType );
191 
193  itkSetObjectMacro( Metric, MetricType );
194  itkGetObjectMacro( Metric, MetricType );
196 
198  itkSetMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
199  itkGetConstMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
201 
203  void SetMetricSamplingPercentage( const RealType );
204 
206  itkSetMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
207  itkGetConstMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
209 
211  itkSetObjectMacro( FixedInitialTransform, InitialTransformType );
212  itkGetConstObjectMacro( FixedInitialTransform, InitialTransformType );
214 
216  itkSetObjectMacro( MovingInitialTransform, InitialTransformType );
217  itkGetConstObjectMacro( MovingInitialTransform, InitialTransformType );
219 
221  void SetTransformParametersAdaptorsPerLevel( TransformParametersAdaptorsContainerType & );
222  const TransformParametersAdaptorsContainerType & GetTransformParametersAdaptorsPerLevel() const;
224 
232  void SetNumberOfLevels( const SizeValueType );
233  itkGetConstMacro( NumberOfLevels, SizeValueType );
235 
241  itkSetMacro( ShrinkFactorsPerLevel, ShrinkFactorsArrayType );
242  itkGetConstMacro( ShrinkFactorsPerLevel, ShrinkFactorsArrayType );
244 
250  itkSetMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
251  itkGetConstMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
253 
258  itkSetMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits, bool );
259  itkGetConstMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits, bool );
260  itkBooleanMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits );
262 
265  using Superclass::MakeOutput;
267 
269  virtual const DecoratedOutputTransformType * GetOutput() const;
270 
272  itkGetConstMacro( CurrentLevel, SizeValueType );
273 
275  itkGetConstReferenceMacro( CurrentIteration, SizeValueType );
276 
277  /* Get the current metric value. This is a helper function for reporting observations. */
278  itkGetConstReferenceMacro( CurrentMetricValue, RealType );
279 
281  itkGetConstReferenceMacro( CurrentConvergenceValue, RealType );
282 
284  itkGetConstReferenceMacro( IsConverged, bool );
285 
286 #ifdef ITKV3_COMPATIBILITY
287 
302  void StartRegistration(void) { this->Update(); }
303 #endif
304 
305 protected:
307  virtual ~ImageRegistrationMethodv4();
308  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
309 
311  virtual void GenerateData();
312 
314  virtual void InitializeRegistrationAtEachLevel( const SizeValueType );
315 
317  virtual void SetMetricSamplePoints();
318 
325 
330 
332 
336 
340 
343 
345 
347 
349 
350 private:
351  ImageRegistrationMethodv4( const Self & ); //purposely not implemented
352  void operator=( const Self & ); //purposely not implemented
353 };
354 } // end namespace itk
355 
356 #ifndef ITK_MANUAL_INSTANTIATION
357 #include "itkImageRegistrationMethodv4.hxx"
358 #endif
359 
360 #endif
361