ITK  4.8.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 
65 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
66  DisplacementFieldTransform<double, TFixedImage::ImageDimension>,
67  typename TVirtualImage = TFixedImage,
68  typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension> >
70 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet>
71 {
72 public:
75  typedef ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform,
76  TVirtualImage, TPointSet> Superclass;
79 
81  itkNewMacro( Self );
82 
84  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
85 
87  itkTypeMacro( SyNImageRegistrationMethod, SimpleImageRegistrationMethod );
88 
90  typedef TFixedImage FixedImageType;
91  typedef typename FixedImageType::Pointer FixedImagePointer;
93  typedef TMovingImage MovingImageType;
94  typedef typename MovingImageType::Pointer MovingImagePointer;
96 
98  typedef typename PointSetType::Pointer PointSetPointer;
100 
107 
111 
116 
118  typedef TOutputTransform OutputTransformType;
119  typedef typename OutputTransformType::Pointer OutputTransformPointer;
120  typedef typename OutputTransformType::ScalarType RealType;
121  typedef typename OutputTransformType::DerivativeType DerivativeType;
122  typedef typename DerivativeType::ValueType DerivativeValueType;
123  typedef typename OutputTransformType::DisplacementFieldType DisplacementFieldType;
124  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
125  typedef typename DisplacementFieldType::PixelType DisplacementVectorType;
126 
129 
132 
135 
137 
139  itkSetMacro( LearningRate, RealType );
140  itkGetConstMacro( LearningRate, RealType );
142 
144  itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
145  itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
147 
149  itkSetMacro( ConvergenceThreshold, RealType );
150  itkGetConstMacro( ConvergenceThreshold, RealType );
152 
154  itkSetMacro( ConvergenceWindowSize, unsigned int );
155  itkGetConstMacro( ConvergenceWindowSize, unsigned int );
157 
162  itkSetMacro( DownsampleImagesForMetricDerivatives, bool );
163  itkGetConstMacro( DownsampleImagesForMetricDerivatives, bool );
165 
169  itkSetMacro( AverageMidPointGradients, bool );
170  itkGetConstMacro( AverageMidPointGradients, bool );
172 
177  itkSetMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
178  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
180 
185  itkSetMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
186  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
188 
190  itkGetModifiableObjectMacro( FixedToMiddleTransform, OutputTransformType );
191  itkGetModifiableObjectMacro( MovingToMiddleTransform, OutputTransformType );
193 
195  itkSetObjectMacro( FixedToMiddleTransform, OutputTransformType);
196  itkSetObjectMacro( MovingToMiddleTransform, OutputTransformType);
198 
199 protected:
201  virtual ~SyNImageRegistrationMethod();
202  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
203 
205  virtual void GenerateData() ITK_OVERRIDE;
206 
208  virtual void StartOptimization();
209 
214  virtual void InitializeRegistrationAtEachLevel( const SizeValueType ) ITK_OVERRIDE;
215 
217  const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType,
218  const TransformBaseType *, const FixedImageMaskType *, MeasureType & );
219  virtual DisplacementFieldPointer ComputeMetricGradientField( const FixedImagesContainerType,
220  const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType,
221  const PointSetsContainerType, const TransformBaseType *, const FixedImageMaskType *, MeasureType & );
222 
224  virtual DisplacementFieldPointer GaussianSmoothDisplacementField( const DisplacementFieldType *, const RealType );
225  virtual DisplacementFieldPointer InvertDisplacementField( const DisplacementFieldType *, const DisplacementFieldType * = ITK_NULLPTR );
226 
227  RealType m_LearningRate;
228 
231 
234 
238 
239 private:
240  SyNImageRegistrationMethod( const Self & ); //purposely not implemented
241  void operator=( const Self & ); //purposely not implemented
242 
245 };
246 } // end namespace itk
247 
248 #ifndef ITK_MANUAL_INSTANTIATION
249 #include "itkSyNImageRegistrationMethod.hxx"
250 #endif
251 
252 #endif
Transform< RealType, ImageDimension, ImageDimension > InitialTransformType
Superclass::PointSetMetricType PointSetMetricType
Light weight base class for most itk classes.
Superclass::MeasureType MeasureType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
ImageMetricType::FixedImageMaskType FixedImageMaskType
virtual DisplacementFieldPointer ScaleUpdateField(const DisplacementFieldType *)
DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
virtual void InitializeRegistrationAtEachLevel(const SizeValueType) override
Provides local/dense/high-dimensionaltiy transformation via a a displacement field.
OutputTransformType::Pointer OutputTransformPointer
Superclass::VirtualImageType VirtualImageType
Superclass::InitialTransformType InitialTransformType
NumberOfIterationsArrayType m_NumberOfIterationsPerLevel
DisplacementFieldTransform< RealType, ImageDimension > DisplacementFieldTransformType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual DisplacementFieldPointer ComputeUpdateField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMaskType *, MeasureType &)
DisplacementFieldType::PixelType DisplacementVectorType
ImageMetricType::MovingImageMaskType MovingImageMaskType
ImageToImageMetricv4< FixedImageType, MovingImageType, VirtualImageType, RealType > ImageMetricType
Superclass::VirtualImageBaseConstPointer VirtualImageBaseConstPointer
Interface method for the performing greedy SyN image registration.
Superclass::VirtualImageBaseType VirtualImageBaseType
Superclass::CompositeTransformType CompositeTransformType
Superclass::PointSetsContainerType PointSetsContainerType
Superclass::FixedImagesContainerType FixedImagesContainerType
Implementation of the composite pattern.
Superclass::MovingImagesContainerType MovingImagesContainerType
ImageRegistrationMethodv4< TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet > Superclass
virtual void GenerateData() override
DisplacementFieldType::Pointer DisplacementFieldPointer
OutputTransformType::DerivativeType DerivativeType
std::vector< MovingImagePointer > MovingImagesContainerType
virtual DisplacementFieldPointer ComputeMetricGradientField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMaskType *, MeasureType &)
ObjectToObjectMetricBaseTemplate< RealType > MetricType
virtual DisplacementFieldPointer GaussianSmoothDisplacementField(const DisplacementFieldType *, const RealType)
CompositeTransformType::TransformType TransformBaseType
OutputTransformType::DisplacementFieldType DisplacementFieldType
Superclass::DecoratedOutputTransformType DecoratedOutputTransformType
virtual DisplacementFieldPointer InvertDisplacementField(const DisplacementFieldType *, const DisplacementFieldType *=nullptr)
OutputTransformType::ScalarType RealType
DataObjectDecorator< OutputTransformType > DecoratedOutputTransformType
Superclass::TransformType TransformType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::vector< FixedImagePointer > FixedImagesContainerType
VirtualImageBaseType::ConstPointer VirtualImageBaseConstPointer
DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
Interface method for the current registration framework.
PointSetToPointSetMetricv4< PointSetType, PointSetType, RealType > PointSetMetricType
CompositeTransform< RealType, ImageDimension > CompositeTransformType
OutputTransformType::ScalarType RealType
std::vector< PointSetConstPointer > PointSetsContainerType
OutputTransformType::Pointer OutputTransformPointer
ObjectToObjectMultiMetricv4< ImageDimension, ImageDimension, VirtualImageType, RealType > MultiMetricType
ImageBase< ImageDimension > VirtualImageBaseType