go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedMeanSquaresImageToImageMetric.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkAdvancedMeanSquaresImageToImageMetric_h
19#define itkAdvancedMeanSquaresImageToImageMetric_h
20
22
23#include "itkSmoothingRecursiveGaussianImageFilter.h" // needed for SelfHessian
24#include "itkImageGridSampler.h" // needed for SelfHessian
25#include "itkNearestNeighborInterpolateImageFunction.h" // needed for SelfHessian
26
27namespace itk
28{
29
55template <class TFixedImage, class TMovingImage>
57 : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
58{
59public:
61
65 using Pointer = SmartPointer<Self>;
66 using ConstPointer = SmartPointer<const Self>;
67
69 itkNewMacro(Self);
70
73
75 using typename Superclass::CoordinateRepresentationType;
76 using typename Superclass::MovingImageType;
77 using typename Superclass::MovingImagePixelType;
78 using typename Superclass::MovingImageConstPointer;
79 using typename Superclass::FixedImageType;
80 using typename Superclass::FixedImageConstPointer;
81 using typename Superclass::FixedImageRegionType;
82 using typename Superclass::TransformType;
83 using typename Superclass::TransformPointer;
84 using typename Superclass::InputPointType;
85 using typename Superclass::OutputPointType;
86 using typename Superclass::TransformParametersType;
87 using typename Superclass::TransformJacobianType;
89 using typename Superclass::InterpolatorType;
90 using typename Superclass::InterpolatorPointer;
91 using typename Superclass::RealType;
92 using typename Superclass::GradientPixelType;
93 using typename Superclass::GradientImageType;
94 using typename Superclass::GradientImagePointer;
95 using typename Superclass::GradientImageFilterType;
96 using typename Superclass::GradientImageFilterPointer;
97 using typename Superclass::FixedImageMaskType;
98 using typename Superclass::FixedImageMaskPointer;
99 using typename Superclass::MovingImageMaskType;
100 using typename Superclass::MovingImageMaskPointer;
101 using typename Superclass::MeasureType;
102 using typename Superclass::DerivativeType;
103 using typename Superclass::DerivativeValueType;
104 using typename Superclass::ParametersType;
105 using typename Superclass::FixedImagePixelType;
107 using typename Superclass::ImageSamplerType;
108 using typename Superclass::ImageSamplerPointer;
116 using typename Superclass::HessianValueType;
117 using typename Superclass::HessianType;
118 using typename Superclass::ThreaderType;
119 using typename Superclass::ThreadInfoType;
120
123
125 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
126
128 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
129
131 virtual MeasureType
132 GetValueSingleThreaded(const TransformParametersType & parameters) const;
133
134 MeasureType
135 GetValue(const TransformParametersType & parameters) const override;
136
138 void
139 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
140
142 void
143 GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
144 MeasureType & value,
145 DerivativeType & derivative) const;
146
147 void
148 GetValueAndDerivative(const TransformParametersType & parameters,
149 MeasureType & value,
150 DerivativeType & derivative) const override;
151
153 void
154 GetSelfHessian(const TransformParametersType & parameters, HessianType & H) const override;
155
157 itkSetMacro(SelfHessianSmoothingSigma, double);
158 itkGetConstMacro(SelfHessianSmoothingSigma, double);
159
161 itkSetMacro(SelfHessianNoiseRange, double);
162 itkGetConstMacro(SelfHessianNoiseRange, double);
163
165 itkSetMacro(NumberOfSamplesForSelfHessian, unsigned int);
166 itkGetConstMacro(NumberOfSamplesForSelfHessian, unsigned int);
167
172 void
173 Initialize() override;
174
182 itkSetMacro(UseNormalization, bool);
183 itkGetConstMacro(UseNormalization, bool);
184
190 itkSetMacro(UseOpenMP, bool);
191
192protected:
195
196 void
197 PrintSelf(std::ostream & os, Indent indent) const override;
198
202 using typename Superclass::FixedImageIndexType;
205 using typename Superclass::FixedImagePointType;
212
214 using SmootherType = SmoothingRecursiveGaussianImageFilter<FixedImageType, FixedImageType>;
215 using FixedImageInterpolatorType = BSplineInterpolateImageFunction<FixedImageType, CoordinateRepresentationType>;
217 NearestNeighborInterpolateImageFunction<FixedImageType, CoordinateRepresentationType>;
219
221
224 void
225 UpdateValueAndDerivativeTerms(const RealType fixedImageValue,
226 const RealType movingImageValue,
227 const DerivativeType & imageJacobian,
228 const NonZeroJacobianIndicesType & nzji,
229 MeasureType & measure,
230 DerivativeType & deriv) const;
231
234 void
235 UpdateSelfHessianTerms(const DerivativeType & imageJacobian,
236 const NonZeroJacobianIndicesType & nzji,
237 HessianType & H) const;
238
240 void
241 ThreadedGetValue(ThreadIdType threadID) override;
242
244 void
245 AfterThreadedGetValue(MeasureType & value) const override;
246
248 void
249 ThreadedGetValueAndDerivative(ThreadIdType threadID) override;
250
252 void
253 AfterThreadedGetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const override;
254
255private:
260};
261
262} // end namespace itk
263
264#ifndef ITK_MANUAL_INSTANTIATION
265# include "itkAdvancedMeanSquaresImageToImageMetric.hxx"
266#endif
267
268#endif // end #ifndef itkAdvancedMeanSquaresImageToImageMetric_h
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename TransformType::OutputPointType MovingImagePointType
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageType::PixelType FixedImagePixelType
typename DerivativeType::ValueType DerivativeValueType
typename DerivativeType::ValueType HessianValueType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ThreaderType::WorkUnitInfo ThreadInfoType
typename FixedImageType::IndexType FixedImageIndexType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskSpatialObject2Type
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
vnl_sparse_matrix< HessianValueType > HessianType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskSpatialObject2Type
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
typename AdvancedTransformType::NumberOfParametersType NumberOfParametersType
Compute Mean square difference between two images, based on AdvancedImageToImageMetric....
void ThreadedGetValueAndDerivative(ThreadIdType threadID) override
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
BSplineInterpolateImageFunction< FixedImageType, CoordinateRepresentationType > FixedImageInterpolatorType
void AfterThreadedGetValue(MeasureType &value) const override
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
void UpdateSelfHessianTerms(const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, HessianType &H) const
SmoothingRecursiveGaussianImageFilter< FixedImageType, FixedImageType > SmootherType
void ThreadedGetValue(ThreadIdType threadID) override
void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const override
~AdvancedMeanSquaresImageToImageMetric() override=default
virtual MeasureType GetValueSingleThreaded(const TransformParametersType &parameters) const
void GetSelfHessian(const TransformParametersType &parameters, HessianType &H) const override
NearestNeighborInterpolateImageFunction< FixedImageType, CoordinateRepresentationType > DummyFixedImageInterpolatorType
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const override
ITK_DISALLOW_COPY_AND_MOVE(AdvancedMeanSquaresImageToImageMetric)
void PrintSelf(std::ostream &os, Indent indent) const override
vnl_sparse_matrix< HessianValueType > HessianType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
void UpdateValueAndDerivativeTerms(const RealType fixedImageValue, const RealType movingImageValue, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, MeasureType &measure, DerivativeType &deriv) const
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
MeasureType GetValue(const TransformParametersType &parameters) const override
Samples image voxels on a regular grid.
This class is a base class for any image sampler.
Base class for all ITK limiter function objects.


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo