ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkSyNImageRegistrationMethod.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 __itkSyNImageRegistrationMethod_h
19 #define __itkSyNImageRegistrationMethod_h
20 
22 
24 
25 namespace itk
26 {
27 //Forward-declare these because of module dependency conflict.
28 //They will soon be moved to a different module, at which
29 // time this can be removed.
30 template <unsigned int VDimension, class TDataHolder>
31 class ImageToData;
32 template <class TDataHolder>
33 class Array1DToData;
34 
72 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
73  DisplacementFieldTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
75 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform>
76 {
77 public:
83 
85  itkNewMacro( Self );
86 
88  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
89 
91  itkTypeMacro( SyNImageRegistrationMethod, SimpleImageRegistrationMethod );
92 
94  typedef TFixedImage FixedImageType;
95  typedef typename FixedImageType::Pointer FixedImagePointer;
96  typedef TMovingImage MovingImageType;
97  typedef typename MovingImageType::Pointer MovingImagePointer;
98 
100  typedef typename Superclass::MetricType MetricType;
104 
105  typedef TOutputTransform OutputTransformType;
106  typedef typename OutputTransformType::Pointer OutputTransformPointer;
107  typedef typename OutputTransformType::ScalarType RealType;
108  typedef typename OutputTransformType::DerivativeType DerivativeType;
109  typedef typename DerivativeType::ValueType DerivativeValueType;
110  typedef typename OutputTransformType::DisplacementFieldType DisplacementFieldType;
111  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
112  typedef typename DisplacementFieldType::PixelType DisplacementVectorType;
113 
114  typedef typename Superclass::CompositeTransformType CompositeTransformType;
116 
117  typedef typename Superclass::DecoratedOutputTransformType DecoratedOutputTransformType;
119 
121 
123  itkSetMacro( LearningRate, RealType );
124  itkGetConstMacro( LearningRate, RealType );
126 
128  itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
129  itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
131 
133  itkSetMacro( ConvergenceThreshold, RealType );
134  itkGetConstMacro( ConvergenceThreshold, RealType );
136 
138  itkSetMacro( ConvergenceWindowSize, unsigned int );
139  itkGetConstMacro( ConvergenceWindowSize, unsigned int );
141 
146  itkSetMacro( DownsampleImagesForMetricDerivatives, bool );
147  itkGetConstMacro( DownsampleImagesForMetricDerivatives, bool );
149 
153  itkSetMacro( AverageMidPointGradients, bool );
154  itkGetConstMacro( AverageMidPointGradients, bool );
156 
161  itkSetMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
162  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
164 
169  itkSetMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
170  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
172 
173 protected:
175  virtual ~SyNImageRegistrationMethod();
176  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
177 
179  virtual void GenerateData();
180 
182  virtual void StartOptimization();
183 
188  virtual void InitializeRegistrationAtEachLevel( const SizeValueType );
189 
190  virtual DisplacementFieldPointer ComputeUpdateField( const TFixedImage *, const TransformBaseType *, const TMovingImage *, const TransformBaseType *, MeasureType & );
191  virtual DisplacementFieldPointer GaussianSmoothDisplacementField( const DisplacementFieldType *, const RealType );
192  virtual DisplacementFieldPointer InvertDisplacementField( const DisplacementFieldType *, const DisplacementFieldType * = NULL );
193 
195 
198 
201 
205 
206 private:
207  SyNImageRegistrationMethod( const Self & ); //purposely not implemented
208  void operator=( const Self & ); //purposely not implemented
209 
212 };
213 } // end namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkSyNImageRegistrationMethod.hxx"
217 #endif
218 
219 #endif
220