go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkGradientDifferenceImageToImageMetric2.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 
20  Program: Insight Segmentation & Registration Toolkit
21  Module: $RCSfile: itkGradientDifferenceImageToImageMetric2.h,v $
22  Language: C++
23  Date: $Date: 2011-29-04 14:33 $
24  Version: $Revision: 2.0 $
25 
26  Copyright (c) Insight Software Consortium. All rights reserved.
27  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
28 
29  This software is distributed WITHOUT ANY WARRANTY; without even
30  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31  PURPOSE. See the above copyright notices for more information.
32 
33 =========================================================================*/
34 #ifndef __itkGradientDifferenceImageToImageMetric2_h
35 #define __itkGradientDifferenceImageToImageMetric2_h
36 
38 
39 #include "itkSobelOperator.h"
40 #include "itkNeighborhoodOperatorImageFilter.h"
41 #include "itkPoint.h"
42 #include "itkCastImageFilter.h"
43 #include "itkResampleImageFilter.h"
44 #include "itkOptimizer.h"
47 
48 namespace itk
49 {
74 template< class TFixedImage, class TMovingImage >
76  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
77 {
78 public:
79 
83 
85  typedef SmartPointer< const Self > ConstPointer;
86 
88  itkNewMacro( Self );
89 
91  itkTypeMacro( GradientDifferenceImageToImageMetric, ImageToImageMetric );
92 
95  #if defined( _MSC_VER ) && ( _MSC_VER == 1300 )
96  typedef double RealType;
97  #else
98  typedef typename Superclass::RealType RealType;
99  #endif
100 
102  typedef typename TransformType::ScalarType ScalarType;
107  typedef typename InterpolatorType::Pointer InterpolatorPointer;
114  typedef typename TFixedImage::PixelType FixedImagePixelType;
115  typedef typename TMovingImage::PixelType MovedImagePixelType;
116  typedef typename MovingImageType::RegionType MovingImageRegionType;
117  typedef typename itk::Optimizer OptimizerType;
118  typedef typename OptimizerType::ScalesType ScalesType;
119 
120  itkStaticConstMacro( FixedImageDimension, unsigned int,
121  FixedImageType::ImageDimension );
122  itkStaticConstMacro( MovedImageDimension, unsigned int,
123  MovingImageType::ImageDimension );
124 
128  typedef itk::Image< FixedImagePixelType, itkGetStaticConstMacro( FixedImageDimension ) >
130  typedef itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType >
135  typedef itk::Image< RealType, itkGetStaticConstMacro( FixedImageDimension ) >
137  typedef itk::CastImageFilter< FixedImageType, FixedGradientImageType >
139  typedef typename CastFixedImageFilterType::Pointer CastFixedImageFilterPointer;
140  typedef typename FixedGradientImageType::PixelType FixedGradientPixelType;
141  typedef itk::Image< RealType, itkGetStaticConstMacro( MovedImageDimension ) >
143  typedef itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType >
145  typedef typename CastMovedImageFilterType::Pointer CastMovedImageFilterPointer;
146  typedef typename MovedGradientImageType::PixelType MovedGradientPixelType;
147 
149  void GetDerivative( const TransformParametersType & parameters,
150  DerivativeType & derivative ) const;
151 
153  MeasureType GetValue( const TransformParametersType & parameters ) const;
154 
156  void GetValueAndDerivative( const TransformParametersType & parameters,
157  MeasureType & Value, DerivativeType & derivative ) const;
158 
159  virtual void Initialize( void ) throw ( ExceptionObject );
160 
162  void WriteGradientImagesToFiles( void ) const;
163 
165  itkSetMacro( Scales, ScalesType );
166  itkGetConstReferenceMacro( Scales, ScalesType );
167 
170  itkSetMacro( DerivativeDelta, double );
171  itkGetConstReferenceMacro( DerivativeDelta, double );
172 
173 protected:
174 
176  virtual ~GradientDifferenceImageToImageMetric() {}
177  void PrintSelf( std::ostream & os, Indent indent ) const;
178 
180  void ComputeMovedGradientRange( void ) const;
181 
183  void ComputeVariance( void ) const;
184 
186  MeasureType ComputeMeasure( const TransformParametersType & parameters,
187  const double * subtractionFactor ) const;
188 
189  typedef NeighborhoodOperatorImageFilter<
191 
192  typedef NeighborhoodOperatorImageFilter<
194 
195 private:
196 
197  GradientDifferenceImageToImageMetric( const Self & ); // purposely not implemented
198  void operator=( const Self & ); // purposely not implemented
199 
201  mutable MovedGradientPixelType m_Variance[ FixedImageDimension ];
202 
204  mutable MovedGradientPixelType m_MinMovedGradient[ MovedImageDimension ];
205  mutable MovedGradientPixelType m_MaxMovedGradient[ MovedImageDimension ];
206 
208  mutable FixedGradientPixelType m_MinFixedGradient[ FixedImageDimension ];
209  mutable FixedGradientPixelType m_MaxFixedGradient[ FixedImageDimension ];
210 
212  typename TransformMovingImageFilterType::Pointer m_TransformMovingImageFilter;
213 
215  CastFixedImageFilterPointer m_CastFixedImageFilter;
216 
217  SobelOperator< FixedGradientPixelType,
218  itkGetStaticConstMacro( FixedImageDimension ) >
219  m_FixedSobelOperators[ FixedImageDimension ];
220 
221  typename FixedSobelFilter::Pointer m_FixedSobelFilters[ itkGetStaticConstMacro
222  ( FixedImageDimension ) ];
223 
226 
228  CastMovedImageFilterPointer m_CastMovedImageFilter;
229 
230  SobelOperator< MovedGradientPixelType,
231  itkGetStaticConstMacro( MovedImageDimension ) >
232  m_MovedSobelOperators[ MovedImageDimension ];
233 
234  typename MovedSobelFilter::Pointer m_MovedSobelFilters[ itkGetStaticConstMacro
235  ( MovedImageDimension ) ];
236 
237  ScalesType m_Scales;
240  CombinationTransformPointer m_CombinationTransform;
241 
242 };
243 
244 } // end namespace itk
245 
246 #ifndef ITK_MANUAL_INSTANTIATION
247 #include "itkGradientDifferenceImageToImageMetric2.hxx"
248 #endif
249 
250 #endif
This class combines two transforms: an 'initial transform' with a 'current transform'.
MeasureType ComputeMeasure(const TransformParametersType &parameters, const double *subtractionFactor) const
NeighborhoodOperatorImageFilter< FixedGradientImageType, FixedGradientImageType > FixedSobelFilter
Superclass::TransformParametersType TransformParametersType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
SobelOperator< FixedGradientPixelType, itkGetStaticConstMacro(FixedImageDimension) > m_FixedSobelOperators[FixedImageDimension]
FixedGradientPixelType m_MinFixedGradient[FixedImageDimension]
MovedGradientPixelType m_Variance[FixedImageDimension]
FixedSobelFilter::Pointer m_FixedSobelFilters[itkGetStaticConstMacro(FixedImageDimension)]
void PrintSelf(std::ostream &os, Indent indent) const
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const
itk::Image< FixedImagePixelType, itkGetStaticConstMacro(FixedImageDimension) > TransformedMovingImageType
itk::AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
MovedSobelFilter::Pointer m_MovedSobelFilters[itkGetStaticConstMacro(MovedImageDimension)]
itk::Image< RealType, itkGetStaticConstMacro(FixedImageDimension) > FixedGradientImageType
FixedGradientPixelType m_MaxFixedGradient[FixedImageDimension]
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
NeighborhoodOperatorImageFilter< MovedGradientImageType, MovedGradientImageType > MovedSobelFilter
itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType
Superclass::TransformPointer TransformPointer
MovedGradientPixelType m_MinMovedGradient[MovedImageDimension]
ZeroFluxNeumannBoundaryCondition< FixedGradientImageType > m_FixedBoundCond
itk::Image< RealType, itkGetStaticConstMacro(MovedImageDimension) > MovedGradientImageType
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
TransformMovingImageFilterType::Pointer m_TransformMovingImageFilter
Superclass::InterpolatorType InterpolatorType
Projective interpolation of an image at specified positions.
Superclass::TransformJacobianType TransformJacobianType
Computes similarity between two objects to be registered.
itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > CastMovedImageFilterType
SobelOperator< MovedGradientPixelType, itkGetStaticConstMacro(MovedImageDimension) > m_MovedSobelOperators[MovedImageDimension]
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const
itk::AdvancedRayCastInterpolateImageFunction< MovingImageType, ScalarType > RayCastInterpolatorType
MovedGradientPixelType m_MaxMovedGradient[MovedImageDimension]
itk::CastImageFilter< FixedImageType, FixedGradientImageType > CastFixedImageFilterType
Superclass::FixedImageConstPointer FixedImageConstPointer
ZeroFluxNeumannBoundaryCondition< MovedGradientImageType > m_MovedBoundCond
Superclass::MovingImageConstPointer MovingImageConstPointer
MeasureType GetValue(const TransformParametersType &parameters) const


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