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 
31 namespace itk
32 {
33 
43 template< class TFixedImage, class TMovingImage >
45  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
46 {
47 public:
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
66  typedef typename Superclass::RealType RealType;
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  virtual void GetDerivative( const TransformParametersType & parameters,
128  DerivativeType & derivative ) const;
129 
131  virtual MeasureType GetValue( const TransformParametersType & parameters ) const;
132 
134  virtual void GetValueAndDerivative( const TransformParametersType & parameters,
135  MeasureType & Value, DerivativeType & derivative ) const;
136 
140  virtual void Initialize( void ) throw ( ExceptionObject );
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 
158 protected:
159 
161  virtual ~NormalizedGradientCorrelationImageToImageMetric() {}
162  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
163 
165  void ComputeMeanMovedGradient( void ) const;
166 
167  void ComputeMeanFixedGradient( void ) const;
168 
170  MeasureType ComputeMeasure( const TransformParametersType & parameters ) const;
171 
172  typedef NeighborhoodOperatorImageFilter<
174  typedef NeighborhoodOperatorImageFilter<
176 
177 private:
178 
179  NormalizedGradientCorrelationImageToImageMetric( const Self & ); // purposely not implemented
180  void operator=( const Self & ); // purposely not implemented
181 
182  ScalesType m_Scales;
184  CombinationTransformPointer m_CombinationTransform;
185 
187  mutable MovedGradientPixelType m_MeanMovedGradient[ MovedImageDimension ];
188 
190  mutable FixedGradientPixelType m_MeanFixedGradient[ FixedImageDimension ];
191 
193  TransformMovingImageFilterPointer m_TransformMovingImageFilter;
194 
196  CastFixedImageFilterPointer m_CastFixedImageFilter;
197 
198  SobelOperator< FixedGradientPixelType,
199  itkGetStaticConstMacro( FixedImageDimension ) >
200  m_FixedSobelOperators[ FixedImageDimension ];
201 
202  typename FixedSobelFilter::Pointer m_FixedSobelFilters
203  [ itkGetStaticConstMacro( FixedImageDimension ) ];
204 
207 
209  CastMovedImageFilterPointer m_CastMovedImageFilter;
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'.
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
MeasureType ComputeMeasure(const TransformParametersType &parameters) const
MovedSobelFilter::Pointer m_MovedSobelFilters[itkGetStaticConstMacro(MovedImageDimension)]
Superclass::TransformParametersType TransformParametersType
itk::Image< RealType, itkGetStaticConstMacro(MovedImageDimension) > MovedGradientImageType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
NeighborhoodOperatorImageFilter< FixedGradientImageType, FixedGradientImageType > FixedSobelFilter
virtual void PrintSelf(std::ostream &os, Indent indent) const
Superclass::FixedImageRegionType FixedImageRegionType
itk::Image< FixedImagePixelType, itkGetStaticConstMacro(FixedImageDimension) > TransformedMovingImageType
virtual void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const
FixedSobelFilter::Pointer m_FixedSobelFilters[itkGetStaticConstMacro(FixedImageDimension)]
virtual void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const
itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > CastMovedImageFilterType
itk::CastImageFilter< FixedImageType, FixedGradientImageType > CastFixedImageFilterType
itk::Image< RealType, itkGetStaticConstMacro(FixedImageDimension) > FixedGradientImageType
void SetTransformParameters(const TransformParametersType &parameters) const
Superclass::TransformPointer TransformPointer
itk::Image< unsigned char, itkGetStaticConstMacro(FixedImageDimension) > MaskImageType
itk::AdvancedRayCastInterpolateImageFunction< MovingImageType, ScalarType > RayCastInterpolatorType
MovingImageType::RegionType MovingImageRegionType
SobelOperator< FixedGradientPixelType, itkGetStaticConstMacro(FixedImageDimension) > m_FixedSobelOperators[FixedImageDimension]
Superclass::InterpolatorType InterpolatorType
Projective interpolation of an image at specified positions.
Superclass::TransformJacobianType TransformJacobianType
SobelOperator< MovedGradientPixelType, itkGetStaticConstMacro(MovedImageDimension) > m_MovedSobelOperators[MovedImageDimension]
ZeroFluxNeumannBoundaryCondition< FixedGradientImageType > m_FixedBoundCond
virtual MeasureType GetValue(const TransformParametersType &parameters) const
An metric based on the itk::NormalizedGradientCorrelationImageToImageMetric.
itk::AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
NeighborhoodOperatorImageFilter< MovedGradientImageType, MovedGradientImageType > MovedSobelFilter
ZeroFluxNeumannBoundaryCondition< MovedGradientImageType > m_MovedBoundCond


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo