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:
48
53 typedef SmartPointer< const Self > ConstPointer;
54
56 itkNewMacro( Self );
57
60
63 #if defined( _MSC_VER ) && ( _MSC_VER == 1300 )
64 typedef double RealType;
65 #else
67 #endif
68
70 typedef typename TransformType::ScalarType ScalarType;
72 typedef typename TransformType::ConstPointer TransformConstPointer;
76 typedef typename InterpolatorType::Pointer InterpolatorPointer;
86 typedef typename TFixedImage::PixelType FixedImagePixelType;
87 typedef typename TMovingImage::PixelType MovedImagePixelType;
88 typedef typename itk::Optimizer OptimizerType;
89 typedef typename OptimizerType::ScalesType ScalesType;
90
91 itkStaticConstMacro( FixedImageDimension, unsigned int, TFixedImage::ImageDimension );
92
94 typedef typename itk::AdvancedCombinationTransform<
95 ScalarType, FixedImageDimension > CombinationTransformType;
97 typedef itk::Image< FixedImagePixelType,
98 itkGetStaticConstMacro( FixedImageDimension ) > TransformedMovingImageType;
99 typedef itk::Image< unsigned char,
100 itkGetStaticConstMacro( FixedImageDimension ) > MaskImageType;
101 typedef typename MaskImageType::Pointer MaskImageTypePointer;
102 typedef itk::ResampleImageFilter<
104 typedef typename TransformMovingImageFilterType::Pointer TransformMovingImageFilterPointer;
108
110 typedef itk::Image< RealType,
111 itkGetStaticConstMacro( FixedImageDimension ) > FixedGradientImageType;
112 typedef itk::CastImageFilter< FixedImageType,
114 typedef typename CastFixedImageFilterType::Pointer CastFixedImageFilterPointer;
115 typedef typename FixedGradientImageType::PixelType FixedGradientPixelType;
116
118 itkStaticConstMacro( MovedImageDimension, unsigned int, MovingImageType::ImageDimension );
119 typedef itk::Image< RealType,
120 itkGetStaticConstMacro( MovedImageDimension ) > MovedGradientImageType;
121 typedef itk::CastImageFilter< TransformedMovingImageType,
123 typedef typename CastMovedImageFilterType::Pointer CastMovedImageFilterPointer;
124 typedef typename MovedGradientImageType::PixelType MovedGradientPixelType;
125
127 void GetDerivative( const TransformParametersType & parameters,
128 DerivativeType & derivative ) const override;
129
131 MeasureType GetValue( const TransformParametersType & parameters ) const override;
132
135 MeasureType & Value, DerivativeType & derivative ) const override;
136
140 void Initialize( void ) override;
141
143 void WriteGradientImagesToFiles( void ) const;
144
146 itkSetMacro( Scales, ScalesType );
147 itkGetConstReferenceMacro( Scales, ScalesType );
148
152 itkSetMacro( DerivativeDelta, double );
153 itkGetConstReferenceMacro( DerivativeDelta, double );
154
156 void SetTransformParameters( const TransformParametersType & parameters ) const;
157
158protected:
159
162 void PrintSelf( std::ostream & os, Indent indent ) const override;
163
165 void ComputeMeanMovedGradient( void ) const;
166
167 void ComputeMeanFixedGradient( void ) const;
168
171
172 typedef NeighborhoodOperatorImageFilter<
174 typedef NeighborhoodOperatorImageFilter<
176
177private:
178
179 NormalizedGradientCorrelationImageToImageMetric( const Self & ); // purposely not implemented
180 void operator=( const Self & ); // purposely not implemented
181
185
187 mutable MovedGradientPixelType m_MeanMovedGradient[ MovedImageDimension ];
188
190 mutable FixedGradientPixelType m_MeanFixedGradient[ FixedImageDimension ];
191
194
197
198 SobelOperator< FixedGradientPixelType,
199 itkGetStaticConstMacro( FixedImageDimension ) >
200 m_FixedSobelOperators[ FixedImageDimension ];
201
202 typename FixedSobelFilter::Pointer m_FixedSobelFilters
203 [ itkGetStaticConstMacro( FixedImageDimension ) ];
204
207
210 SobelOperator< MovedGradientPixelType,
211 itkGetStaticConstMacro( MovedImageDimension ) >
212 m_MovedSobelOperators[ MovedImageDimension ];
213
214 typename MovedSobelFilter::Pointer m_MovedSobelFilters[
215 itkGetStaticConstMacro( MovedImageDimension ) ];
216
217};
218
219} // end namespace itk
220
221#ifndef ITK_MANUAL_INSTANTIATION
222#include "itkNormalizedGradientCorrelationImageToImageMetric.hxx"
223#endif
224
225#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.
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::TransformJacobianType TransformJacobianType
Superclass::TransformPointer TransformPointer
MovingImageType::RegionType MovingImageRegionType
Superclass::InterpolatorType InterpolatorType
Superclass::FixedImageRegionType FixedImageRegionType
Projective interpolation of an image at specified positions.
An metric based on the itk::NormalizedGradientCorrelationImageToImageMetric.
MovedSobelFilter::Pointer m_MovedSobelFilters[itkGetStaticConstMacro(MovedImageDimension)]
itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType
FixedSobelFilter::Pointer m_FixedSobelFilters[itkGetStaticConstMacro(FixedImageDimension)]
void PrintSelf(std::ostream &os, Indent indent) const override
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
itk::Image< FixedImagePixelType, itkGetStaticConstMacro(FixedImageDimension) > TransformedMovingImageType
itk::AdvancedRayCastInterpolateImageFunction< MovingImageType, ScalarType > RayCastInterpolatorType
itk::CastImageFilter< FixedImageType, FixedGradientImageType > CastFixedImageFilterType
SobelOperator< FixedGradientPixelType, itkGetStaticConstMacro(FixedImageDimension) > m_FixedSobelOperators[FixedImageDimension]
ZeroFluxNeumannBoundaryCondition< FixedGradientImageType > m_FixedBoundCond
ZeroFluxNeumannBoundaryCondition< MovedGradientImageType > m_MovedBoundCond
NeighborhoodOperatorImageFilter< FixedGradientImageType, FixedGradientImageType > FixedSobelFilter
itk::AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
itk::Image< RealType, itkGetStaticConstMacro(MovedImageDimension) > MovedGradientImageType
void SetTransformParameters(const TransformParametersType &parameters) const
MeasureType ComputeMeasure(const TransformParametersType &parameters) const
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
itkStaticConstMacro(MovedImageDimension, unsigned int, MovingImageType::ImageDimension)
SobelOperator< MovedGradientPixelType, itkGetStaticConstMacro(MovedImageDimension) > m_MovedSobelOperators[MovedImageDimension]
MeasureType GetValue(const TransformParametersType &parameters) const override
NeighborhoodOperatorImageFilter< MovedGradientImageType, MovedGradientImageType > MovedSobelFilter
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const override
itk::Image< unsigned char, itkGetStaticConstMacro(FixedImageDimension) > MaskImageType
itk::Image< RealType, itkGetStaticConstMacro(FixedImageDimension) > FixedGradientImageType
itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > CastMovedImageFilterType


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo