ITK  6.0.0
Insight Toolkit
itkSyNImageRegistrationMethod.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
26namespace itk
27{
28
66template <typename TFixedImage,
67 typename TMovingImage,
68 typename TOutputTransform = DisplacementFieldTransform<double, TFixedImage::ImageDimension>,
69 typename TVirtualImage = TFixedImage,
70 typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension>>
71class ITK_TEMPLATE_EXPORT SyNImageRegistrationMethod
72 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet>
73{
74public:
75 ITK_DISALLOW_COPY_AND_MOVE(SyNImageRegistrationMethod);
76
82
84 itkNewMacro(Self);
85
87 static constexpr unsigned int ImageDimension = TFixedImage::ImageDimension;
88
90 itkOverrideGetNameOfClassMacro(SyNImageRegistrationMethod);
91
93 using FixedImageType = TFixedImage;
95 using typename Superclass::FixedImagesContainerType;
96 using MovingImageType = TMovingImage;
98 using typename Superclass::MovingImagesContainerType;
99
100 using typename Superclass::PointSetType;
102 using typename Superclass::PointSetsContainerType;
103
105 using typename Superclass::ImageMetricType;
108
110 using typename Superclass::FixedImageMaskType;
112 using typename Superclass::FixedImageMasksContainerType;
113 using typename Superclass::MovingImageMaskType;
115 using typename Superclass::MovingImageMasksContainerType;
116
117 using VirtualImageType = typename Superclass::VirtualImageType;
118 using typename Superclass::VirtualImageBaseType;
119 using typename Superclass::VirtualImageBaseConstPointer;
120
121 using typename Superclass::MultiMetricType;
122 using typename Superclass::MetricType;
124 using typename Superclass::PointSetMetricType;
125
126 using typename Superclass::InitialTransformType;
127 using OutputTransformType = TOutputTransform;
129 using RealType = typename OutputTransformType::ScalarType;
130 using DerivativeType = typename OutputTransformType::DerivativeType;
131 using DerivativeValueType = typename DerivativeType::ValueType;
132 using DisplacementFieldType = typename OutputTransformType::DisplacementFieldType;
134 using DisplacementVectorType = typename DisplacementFieldType::PixelType;
135
136 using typename Superclass::CompositeTransformType;
138
139 using typename Superclass::DecoratedOutputTransformType;
141
144
146
148 itkSetMacro(LearningRate, RealType);
149 itkGetConstMacro(LearningRate, RealType);
153 itkSetMacro(NumberOfIterationsPerLevel, NumberOfIterationsArrayType);
154 itkGetConstMacro(NumberOfIterationsPerLevel, NumberOfIterationsArrayType);
158 itkSetMacro(ConvergenceThreshold, RealType);
159 itkGetConstMacro(ConvergenceThreshold, RealType);
163 itkSetMacro(ConvergenceWindowSize, unsigned int);
164 itkGetConstMacro(ConvergenceWindowSize, unsigned int);
171 itkSetMacro(DownsampleImagesForMetricDerivatives, bool);
172 itkGetConstMacro(DownsampleImagesForMetricDerivatives, bool);
178 itkSetMacro(AverageMidPointGradients, bool);
179 itkGetConstMacro(AverageMidPointGradients, bool);
185 itkSetMacro(GaussianSmoothingVarianceForTheUpdateField, RealType);
186 itkGetConstReferenceMacro(GaussianSmoothingVarianceForTheUpdateField, RealType);
192 itkSetMacro(GaussianSmoothingVarianceForTheTotalField, RealType);
193 itkGetConstReferenceMacro(GaussianSmoothingVarianceForTheTotalField, RealType);
197 itkGetModifiableObjectMacro(FixedToMiddleTransform, OutputTransformType);
198 itkGetModifiableObjectMacro(MovingToMiddleTransform, OutputTransformType);
202 itkSetObjectMacro(FixedToMiddleTransform, OutputTransformType);
203 itkSetObjectMacro(MovingToMiddleTransform, OutputTransformType);
206protected:
208 ~SyNImageRegistrationMethod() override = default;
209 void
210 PrintSelf(std::ostream & os, Indent indent) const override;
211
213 void
214 GenerateData() override;
215
219 virtual void
221
226 void
228
232 const TransformBaseType *,
235 const TransformBaseType *,
238 MeasureType &);
242 const TransformBaseType *,
245 const TransformBaseType *,
248 MeasureType &);
249
256
257 RealType m_LearningRate{ 0.25 };
258
259 OutputTransformPointer m_MovingToMiddleTransform{ nullptr };
260 OutputTransformPointer m_FixedToMiddleTransform{ nullptr };
261
262 RealType m_ConvergenceThreshold{ static_cast<RealType>(1.0e-6) };
263 unsigned int m_ConvergenceWindowSize{ 10 };
264
265 NumberOfIterationsArrayType m_NumberOfIterationsPerLevel{};
266 bool m_DownsampleImagesForMetricDerivatives{ true };
267 bool m_AverageMidPointGradients{ false };
268
269private:
270 RealType m_GaussianSmoothingVarianceForTheUpdateField{ 3.0 };
271 RealType m_GaussianSmoothingVarianceForTheTotalField{ 0.5 };
272};
273} // end namespace itk
274
275#ifndef ITK_MANUAL_INSTANTIATION
276# include "itkSyNImageRegistrationMethod.hxx"
277#endif
278
279#endif
typename Superclass::TransformType TransformType
Provides local/dense/high-dimensionality transformation via a a displacement field.
Implementation of an image mask as spatial object.
Interface method for the current registration framework.
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Interface method for the performing greedy SyN image registration.
virtual DisplacementFieldPointer GaussianSmoothDisplacementField(const DisplacementFieldType *, const RealType)
typename OutputTransformType::ScalarType RealType
void PrintSelf(std::ostream &os, Indent indent) const override
typename ImageMaskSpatialObjectType::ImageType FixedMaskImageType
typename CompositeTransformType::TransformType TransformBaseType
typename ImageMetricType::Pointer ImageMetricPointer
virtual DisplacementFieldPointer ComputeUpdateField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType, const MovingImageMasksContainerType, MeasureType &)
typename DerivativeType::ValueType DerivativeValueType
virtual DisplacementFieldPointer ScaleUpdateField(const DisplacementFieldType *)
typename ImageMaskSpatialObjectType::ImageType MovingMaskImageType
typename FixedImageType::Pointer FixedImagePointer
typename DisplacementFieldType::Pointer DisplacementFieldPointer
void InitializeRegistrationAtEachLevel(const SizeValueType) override
typename MovingImageType::Pointer MovingImagePointer
virtual DisplacementFieldPointer ComputeMetricGradientField(const FixedImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const MovingImagesContainerType, const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType, const MovingImageMasksContainerType, MeasureType &)
typename DisplacementFieldType::PixelType DisplacementVectorType
~SyNImageRegistrationMethod() override=default
typename Superclass::VirtualImageType VirtualImageType
typename DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
typename MetricType::Pointer MetricPointer
typename OutputTransformType::DisplacementFieldType DisplacementFieldType
typename OutputTransformType::Pointer OutputTransformPointer
virtual DisplacementFieldPointer InvertDisplacementField(const DisplacementFieldType *, const DisplacementFieldType *=nullptr)
typename DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
typename ImageMetricType::MeasureType MeasureType
typename OutputTransformType::DerivativeType DerivativeType
typename PointSetType::Pointer PointSetPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86