ITK  4.9.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 
25 
26 namespace itk
27 {
28 
66 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
67  DisplacementFieldTransform<double, TFixedImage::ImageDimension>,
68  typename TVirtualImage = TFixedImage,
69  typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension> >
71 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet>
72 {
73 public:
76  typedef ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform,
77  TVirtualImage, TPointSet> Superclass;
80 
82  itkNewMacro( Self );
83 
85  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
86 
88  itkTypeMacro( SyNImageRegistrationMethod, SimpleImageRegistrationMethod );
89 
91  typedef TFixedImage FixedImageType;
92  typedef typename FixedImageType::Pointer FixedImagePointer;
94  typedef TMovingImage MovingImageType;
95  typedef typename MovingImageType::Pointer MovingImagePointer;
97 
99  typedef typename PointSetType::Pointer PointSetPointer;
101 
106 
114 
118 
123 
125  typedef TOutputTransform OutputTransformType;
126  typedef typename OutputTransformType::Pointer OutputTransformPointer;
127  typedef typename OutputTransformType::ScalarType RealType;
128  typedef typename OutputTransformType::DerivativeType DerivativeType;
129  typedef typename DerivativeType::ValueType DerivativeValueType;
130  typedef typename OutputTransformType::DisplacementFieldType DisplacementFieldType;
131  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
132  typedef typename DisplacementFieldType::PixelType DisplacementVectorType;
133 
136 
139 
142 
144 
146  itkSetMacro( LearningRate, RealType );
147  itkGetConstMacro( LearningRate, RealType );
149 
151  itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
152  itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
154 
156  itkSetMacro( ConvergenceThreshold, RealType );
157  itkGetConstMacro( ConvergenceThreshold, RealType );
159 
161  itkSetMacro( ConvergenceWindowSize, unsigned int );
162  itkGetConstMacro( ConvergenceWindowSize, unsigned int );
164 
169  itkSetMacro( DownsampleImagesForMetricDerivatives, bool );
170  itkGetConstMacro( DownsampleImagesForMetricDerivatives, bool );
172 
176  itkSetMacro( AverageMidPointGradients, bool );
177  itkGetConstMacro( AverageMidPointGradients, bool );
179 
184  itkSetMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
185  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheUpdateField, RealType );
187 
192  itkSetMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
193  itkGetConstReferenceMacro( GaussianSmoothingVarianceForTheTotalField, RealType );
195 
197  itkGetModifiableObjectMacro( FixedToMiddleTransform, OutputTransformType );
198  itkGetModifiableObjectMacro( MovingToMiddleTransform, OutputTransformType );
200 
202  itkSetObjectMacro( FixedToMiddleTransform, OutputTransformType);
203  itkSetObjectMacro( MovingToMiddleTransform, OutputTransformType);
205 
206 protected:
208  virtual ~SyNImageRegistrationMethod();
209  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
210 
212  virtual void GenerateData() ITK_OVERRIDE;
213 
215  virtual void StartOptimization();
216 
221  virtual void InitializeRegistrationAtEachLevel( const SizeValueType ) ITK_OVERRIDE;
222 
224  const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType,
225  const TransformBaseType *, const FixedImageMasksContainerType, const MovingImageMasksContainerType, MeasureType & );
226  virtual DisplacementFieldPointer ComputeMetricGradientField( const FixedImagesContainerType,
227  const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType,
228  const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType,
229  const MovingImageMasksContainerType, MeasureType & );
230 
232  virtual DisplacementFieldPointer GaussianSmoothDisplacementField( const DisplacementFieldType *, const RealType );
233  virtual DisplacementFieldPointer InvertDisplacementField( const DisplacementFieldType *, const DisplacementFieldType * = ITK_NULLPTR );
234 
235  RealType m_LearningRate;
236 
239 
242 
246 
247 private:
248  SyNImageRegistrationMethod( const Self & ) ITK_DELETE_FUNCTION;
249  void operator=( const Self & ) ITK_DELETE_FUNCTION;
250 
253 };
254 } // end namespace itk
255 
256 #ifndef ITK_MANUAL_INSTANTIATION
257 #include "itkSyNImageRegistrationMethod.hxx"
258 #endif
259 
260 #endif
virtual DisplacementFieldPointer ComputeUpdateField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType, const MovingImageMasksContainerType, MeasureType &)
Superclass::MovingImageMasksContainerType MovingImageMasksContainerType
Transform< RealType, ImageDimension, ImageDimension > InitialTransformType
Implementation of an image mask as spatial object.
Superclass::PointSetMetricType PointSetMetricType
Light weight base class for most itk classes.
Superclass::MeasureType MeasureType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::FixedImageMasksContainerType FixedImageMasksContainerType
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
ImageMaskSpatialObjectType::ImageType FixedMaskImageType
Superclass::VirtualImageType VirtualImageType
Superclass::InitialTransformType InitialTransformType
ImageMetricType::FixedImageMaskType FixedImageMaskType
Superclass::FixedImageMaskType FixedImageMaskType
NumberOfIterationsArrayType m_NumberOfIterationsPerLevel
DisplacementFieldTransform< RealType, ImageDimension > DisplacementFieldTransformType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
DisplacementFieldType::PixelType DisplacementVectorType
std::vector< MovingImageMaskConstPointer > MovingImageMasksContainerType
ImageToImageMetricv4< FixedImageType, MovingImageType, VirtualImageType, RealType > ImageMetricType
Superclass::VirtualImageBaseConstPointer VirtualImageBaseConstPointer
ImageMaskSpatialObject< ImageDimension > ImageMaskSpatialObjectType
Interface method for the performing greedy SyN image registration.
Superclass::VirtualImageBaseType VirtualImageBaseType
Superclass::CompositeTransformType CompositeTransformType
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
Superclass::PointSetsContainerType PointSetsContainerType
Superclass::FixedImagesContainerType FixedImagesContainerType
ImageMetricType::MovingImageMaskType MovingImageMaskType
Superclass::MovingImagesContainerType MovingImagesContainerType
ImageMaskSpatialObjectType::ImageType MovingMaskImageType
ImageRegistrationMethodv4< TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet > Superclass
virtual void GenerateData() override
DisplacementFieldType::Pointer DisplacementFieldPointer
OutputTransformType::DerivativeType DerivativeType
std::vector< MovingImagePointer > MovingImagesContainerType
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
virtual DisplacementFieldPointer ComputeMetricGradientField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType, const MovingImageMasksContainerType, MeasureType &)