go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkVarianceOverLastDimensionImageMetric.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
19#ifndef itkVarianceOverLastDimensionImageMetric_h
20#define itkVarianceOverLastDimensionImageMetric_h
21
22#include "itkSmoothingRecursiveGaussianImageFilter.h"
24#include "itkNearestNeighborInterpolateImageFunction.h"
26
27namespace itk
28{
29
51template <class TFixedImage, class TMovingImage>
52class ITK_TEMPLATE_EXPORT VarianceOverLastDimensionImageMetric
53 : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
54{
55public:
57
61 using Pointer = SmartPointer<Self>;
62 using ConstPointer = SmartPointer<const Self>;
63
64 using typename Superclass::FixedImageRegionType;
65 using FixedImageSizeType = typename FixedImageRegionType::SizeType;
66
68 itkNewMacro(Self);
69
72
74 itkSetMacro(SampleLastDimensionRandomly, bool);
75 itkSetMacro(NumSamplesLastDimension, unsigned int);
76 itkSetMacro(NumAdditionalSamplesFixed, unsigned int);
77 itkSetMacro(ReducedDimensionIndex, unsigned int);
78 itkSetMacro(UseZeroAverageDisplacementConstraint, bool);
79 itkSetMacro(GridSize, FixedImageSizeType);
80 itkSetMacro(TransformIsStackTransform, bool);
81
83 itkGetConstMacro(SampleLastDimensionRandomly, bool);
84 itkGetConstMacro(NumSamplesLastDimension, int);
85
87 using typename Superclass::CoordinateRepresentationType;
88 using typename Superclass::MovingImageType;
89 using typename Superclass::MovingImagePixelType;
90 using typename Superclass::MovingImageConstPointer;
91 using typename Superclass::FixedImageType;
92 using typename Superclass::FixedImageConstPointer;
93 using typename Superclass::TransformType;
94 using typename Superclass::TransformPointer;
95 using typename Superclass::InputPointType;
96 using typename Superclass::OutputPointType;
97 using typename Superclass::TransformParametersType;
98 using typename Superclass::TransformJacobianType;
99 using typename Superclass::InterpolatorType;
100 using typename Superclass::InterpolatorPointer;
101 using typename Superclass::RealType;
102 using typename Superclass::GradientPixelType;
103 using typename Superclass::GradientImageType;
104 using typename Superclass::GradientImagePointer;
105 using typename Superclass::FixedImageMaskType;
107 using typename Superclass::MovingImageMaskType;
109 using typename Superclass::MeasureType;
110 using typename Superclass::DerivativeType;
111 using typename Superclass::DerivativeValueType;
112 using typename Superclass::ParametersType;
113 using typename Superclass::FixedImagePixelType;
115 using typename Superclass::ImageSamplerType;
116 using typename Superclass::ImageSamplerPointer;
124
126 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
127
129 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
130
132 MeasureType
133 GetValue(const TransformParametersType & parameters) const override;
134
136 void
137 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
138
140 void
141 GetValueAndDerivative(const TransformParametersType & parameters,
142 MeasureType & Value,
143 DerivativeType & Derivative) const override;
144
148 void
149 Initialize() override;
150
151protected:
154 void
155 PrintSelf(std::ostream & os, Indent indent) const override;
156
160 using typename Superclass::FixedImageIndexType;
163 using typename Superclass::FixedImagePointType;
165 typename itk::ContinuousIndex<CoordinateRepresentationType, FixedImageDimension>;
171
175 void
176 EvaluateTransformJacobianInnerProduct(const TransformJacobianType & jacobian,
177 const MovingImageDerivativeType & movingImageDerivative,
178 DerivativeType & imageJacobian) const override;
179
180private:
182 void
183 SampleRandom(const int n, const int m, std::vector<int> & numbers) const;
184
186 bool m_SampleLastDimensionRandomly{ false };
187 unsigned int m_NumSamplesLastDimension{ 10 };
188 unsigned int m_NumAdditionalSamplesFixed{};
189 unsigned int m_ReducedDimensionIndex{};
190
192 bool m_UseZeroAverageDisplacementConstraint{ true };
193
195 float m_InitialVariance{};
196
198 FixedImageSizeType m_GridSize{};
199
201 bool m_TransformIsStackTransform{ false };
202};
203
204} // end namespace itk
205
206#ifndef ITK_MANUAL_INSTANTIATION
207# include "itkVarianceOverLastDimensionImageMetric.hxx"
208#endif
209
210#endif // end #ifndef itkVarianceOverLastDimensionImageMetric_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 FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename FixedImageType::IndexType FixedImageIndexType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
This class is a base class for any image sampler.
Base class for all ITK limiter function objects.
Compute the sum of variances over the slowest varying dimension in the moving image.
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
~VarianceOverLastDimensionImageMetric() override=default
typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
void SampleRandom(const int n, const int m, std::vector< int > &numbers) const
void PrintSelf(std::ostream &os, Indent indent) const override
MeasureType GetValue(const TransformParametersType &parameters) const override
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const override
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
ITK_DISALLOW_COPY_AND_MOVE(VarianceOverLastDimensionImageMetric)
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo