go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkNormalizedGradientCorrelationImageToImageMetric.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 itkNormalizedGradientCorrelationImageToImageMetric_h
19#define itkNormalizedGradientCorrelationImageToImageMetric_h
20
22#include "itkSobelOperator.h"
23#include "itkNeighborhoodOperatorImageFilter.h"
24#include "itkPoint.h"
25#include "itkCastImageFilter.h"
26#include "itkResampleImageFilter.h"
27#include "itkOptimizer.h"
30
31namespace itk
32{
33
43template <class TFixedImage, class TMovingImage>
45 : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
46{
47public:
49
53 using Pointer = SmartPointer<Self>;
54 using ConstPointer = SmartPointer<const Self>;
55
57 itkNewMacro(Self);
58
61
64#if defined(_MSC_VER) && (_MSC_VER == 1300)
65 using RealType = double;
66#else
67 using typename Superclass::RealType;
68#endif
69
70 using typename Superclass::TransformType;
71 using ScalarType = typename TransformType::ScalarType;
72 using typename Superclass::TransformPointer;
73 using TransformConstPointer = typename TransformType::ConstPointer;
74 using typename Superclass::TransformParametersType;
75 using typename Superclass::TransformJacobianType;
76 using typename Superclass::InterpolatorType;
77 using InterpolatorPointer = typename InterpolatorType::Pointer;
78 using typename Superclass::MeasureType;
79 using typename Superclass::DerivativeType;
80 using typename Superclass::FixedImageType;
81 using typename Superclass::FixedImageRegionType;
82 using typename Superclass::MovingImageType;
84 using typename Superclass::FixedImageConstPointer;
85 using typename Superclass::MovingImageConstPointer;
86 using typename Superclass::MovingImagePointer;
87 using FixedImagePixelType = typename TFixedImage::PixelType;
88 using MovedImagePixelType = typename TMovingImage::PixelType;
89 using ScalesType = typename Optimizer::ScalesType;
90
91 itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension);
92
95 using CombinationTransformPointer = typename CombinationTransformType::Pointer;
96 using TransformedMovingImageType = itk::Image<FixedImagePixelType, Self::FixedImageDimension>;
97 using MaskImageType = itk::Image<unsigned char, Self::FixedImageDimension>;
98 using MaskImageTypePointer = typename MaskImageType::Pointer;
99 using TransformMovingImageFilterType = itk::ResampleImageFilter<MovingImageType, TransformedMovingImageType>;
100 using TransformMovingImageFilterPointer = typename TransformMovingImageFilterType::Pointer;
102 using RayCastInterpolatorPointer = typename RayCastInterpolatorType::Pointer;
103
105 using FixedGradientImageType = itk::Image<RealType, Self::FixedImageDimension>;
106 using CastFixedImageFilterType = itk::CastImageFilter<FixedImageType, FixedGradientImageType>;
107 using CastFixedImageFilterPointer = typename CastFixedImageFilterType::Pointer;
108 using FixedGradientPixelType = typename FixedGradientImageType::PixelType;
109
111 itkStaticConstMacro(MovedImageDimension, unsigned int, MovingImageType::ImageDimension);
112 using MovedGradientImageType = itk::Image<RealType, Self::MovedImageDimension>;
113 using CastMovedImageFilterType = itk::CastImageFilter<TransformedMovingImageType, MovedGradientImageType>;
114 using CastMovedImageFilterPointer = typename CastMovedImageFilterType::Pointer;
115 using MovedGradientPixelType = typename MovedGradientImageType::PixelType;
116
118 void
119 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
120
122 MeasureType
123 GetValue(const TransformParametersType & parameters) const override;
124
126 void
127 GetValueAndDerivative(const TransformParametersType & parameters,
128 MeasureType & Value,
129 DerivativeType & derivative) const override;
130
134 void
135 Initialize() override;
136
138 void
140
142 itkSetMacro(Scales, ScalesType);
143 itkGetConstReferenceMacro(Scales, ScalesType);
144
148 itkSetMacro(DerivativeDelta, double);
149 itkGetConstReferenceMacro(DerivativeDelta, double);
150
152 void
153 SetTransformParameters(const TransformParametersType & parameters) const;
154
155protected:
158 void
159 PrintSelf(std::ostream & os, Indent indent) const override;
160
162 void
164
165 void
167
169 MeasureType
170 ComputeMeasure(const TransformParametersType & parameters) const;
171
172 using FixedSobelFilter = NeighborhoodOperatorImageFilter<FixedGradientImageType, FixedGradientImageType>;
173 using MovedSobelFilter = NeighborhoodOperatorImageFilter<MovedGradientImageType, MovedGradientImageType>;
174
175private:
179
181 mutable MovedGradientPixelType m_MeanMovedGradient[MovedImageDimension];
182
184 mutable FixedGradientPixelType m_MeanFixedGradient[FixedImageDimension];
185
188
191
192 SobelOperator<FixedGradientPixelType, Self::FixedImageDimension> m_FixedSobelOperators[FixedImageDimension];
193
194 typename FixedSobelFilter::Pointer m_FixedSobelFilters[Self::FixedImageDimension];
195
196 ZeroFluxNeumannBoundaryCondition<MovedGradientImageType> m_MovedBoundCond;
197 ZeroFluxNeumannBoundaryCondition<FixedGradientImageType> m_FixedBoundCond;
198
201 SobelOperator<MovedGradientPixelType, Self::MovedImageDimension> m_MovedSobelOperators[MovedImageDimension];
202
203 typename MovedSobelFilter::Pointer m_MovedSobelFilters[Self::MovedImageDimension];
204};
205
206} // end namespace itk
207
208#ifndef ITK_MANUAL_INSTANTIATION
209# include "itkNormalizedGradientCorrelationImageToImageMetric.hxx"
210#endif
211
212#endif
This class combines two transforms: an 'initial transform' with a 'current transform'.
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename MovingImageType::RegionType MovingImageRegionType
typename MovingImageType::Pointer MovingImagePointer
Projective interpolation of an image at specified positions.
An metric based on the itk::NormalizedGradientCorrelationImageToImageMetric.
NeighborhoodOperatorImageFilter< MovedGradientImageType, MovedGradientImageType > MovedSobelFilter
ZeroFluxNeumannBoundaryCondition< FixedGradientImageType > m_FixedBoundCond
void PrintSelf(std::ostream &os, Indent indent) const override
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
itk::Image< FixedImagePixelType, Self::FixedImageDimension > TransformedMovingImageType
NeighborhoodOperatorImageFilter< FixedGradientImageType, FixedGradientImageType > FixedSobelFilter
ITK_DISALLOW_COPY_AND_MOVE(NormalizedGradientCorrelationImageToImageMetric)
itk::CastImageFilter< FixedImageType, FixedGradientImageType > CastFixedImageFilterType
void SetTransformParameters(const TransformParametersType &parameters) const
MeasureType ComputeMeasure(const TransformParametersType &parameters) const
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > CastMovedImageFilterType
itkStaticConstMacro(MovedImageDimension, unsigned int, MovingImageType::ImageDimension)
MeasureType GetValue(const TransformParametersType &parameters) const override
ZeroFluxNeumannBoundaryCondition< MovedGradientImageType > m_MovedBoundCond
typename itk::AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const override
typename itk::AdvancedRayCastInterpolateImageFunction< MovingImageType, ScalarType > RayCastInterpolatorType
itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType


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