ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkGradientDifferenceImageToImageMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkGradientDifferenceImageToImageMetric_h
19 #define itkGradientDifferenceImageToImageMetric_h
20 
21 #include "itkImageToImageMetric.h"
22 
23 #include "itkSobelOperator.h"
25 #include "itkPoint.h"
26 #include "itkCastImageFilter.h"
27 #include "itkResampleImageFilter.h"
28 
29 namespace itk
30 {
57 template< typename TFixedImage, typename TMovingImage >
59  public ImageToImageMetric< TFixedImage, TMovingImage >
60 {
61 public:
62 
66 
69 
71  itkNewMacro(Self);
72 
75 
77  typedef typename Superclass::RealType RealType;
82 
89 
90  typedef typename TFixedImage::PixelType FixedImagePixelType;
91  typedef typename TMovingImage::PixelType MovedImagePixelType;
92 
93  itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension);
96  itkGetStaticConstMacro(FixedImageDimension) >
98 
101 
105 
108 
110 
113  itkStaticConstMacro(MovedImageDimension, unsigned int, MovingImageType::ImageDimension);
114 
116 
119 
121 
123  void GetDerivative(const TransformParametersType & parameters,
124  DerivativeType & derivative) const ITK_OVERRIDE;
125 
127  MeasureType GetValue(const TransformParametersType & parameters) const ITK_OVERRIDE;
128 
130  void GetValueAndDerivative(const TransformParametersType & parameters,
131  MeasureType & Value, DerivativeType & derivative) const ITK_OVERRIDE;
132 
135  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
136 
138  void WriteGradientImagesToFiles() const;
139 
142  itkSetMacro(DerivativeDelta, double);
143  itkGetConstReferenceMacro(DerivativeDelta, double);
145 
146 protected:
148  virtual ~GradientDifferenceImageToImageMetric() {}
149  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
150 
152  void ComputeMovedGradientRange() const;
153 
155  void ComputeVariance() const;
156 
159  const double *subtractionFactor) const;
160 
163 
166 
167 private:
168  GradientDifferenceImageToImageMetric(const Self &); //purposely not
169  // implemented
170  void operator=(const Self &); //purposely not
171 
172  // implemented
173 
176 
180 
184 
187 
190 
192  itkGetStaticConstMacro(FixedImageDimension) >
194 
196 
199 
202 
204  itkGetStaticConstMacro(MovedImageDimension) >
206 
208 
210 };
211 } // end namespace itk
212 
213 #ifndef ITK_MANUAL_INSTANTIATION
214 #include "itkGradientDifferenceImageToImageMetric.hxx"
215 #endif
216 
217 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
MeasureType ComputeMeasure(const TransformParametersType &parameters, const double *subtractionFactor) const
A function object that determines a neighborhood of values at an image boundary according to a Neuman...
Light weight base class for most itk classes.
NeighborhoodOperatorImageFilter< FixedGradientImageType, FixedGradientImageType > FixedSobelFilter
void PrintSelf(std::ostream &os, Indent indent) const override
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Resample an image via a coordinate transform.
FixedGradientPixelType m_MinFixedGradient[FixedImageDimension]
TransformType::Pointer TransformPointer
NumericTraits< MovingImagePixelType >::RealType RealType
Superclass::DerivativeType DerivativeType
MovingImageType::ConstPointer MovingImageConstPointer
MovedGradientPixelType m_Variance[FixedImageDimension]
FixedSobelFilter::Pointer m_FixedSobelFilters[itkGetStaticConstMacro(FixedImageDimension)]
TPixel PixelType
Definition: itkImage.h:89
itk::Image< RealType, itkGetStaticConstMacro(MovedImageDimension) > MovedGradientImageType
MovedSobelFilter::Pointer m_MovedSobelFilters[itkGetStaticConstMacro(MovedImageDimension)]
A NeighborhoodOperator for performing a directional Sobel edge-detection operation at a pixel locatio...
FixedGradientPixelType m_MaxFixedGradient[FixedImageDimension]
itk::Image< RealType, itkGetStaticConstMacro(FixedImageDimension) > FixedGradientImageType
NeighborhoodOperatorImageFilter< MovedGradientImageType, MovedGradientImageType > MovedSobelFilter
SobelOperator< FixedGradientPixelType, itkGetStaticConstMacro(FixedImageDimension) > m_FixedSobelOperators[FixedImageDimension]
itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const override
Standard exception handling object.
MovedGradientPixelType m_MinMovedGradient[MovedImageDimension]
SobelOperator< MovedGradientPixelType, itkGetStaticConstMacro(MovedImageDimension) > m_MovedSobelOperators[MovedImageDimension]
ZeroFluxNeumannBoundaryCondition< FixedGradientImageType > m_FixedBoundCond
TransformMovingImageFilterType::Pointer m_TransformMovingImageFilter
MeasureType GetValue(const TransformParametersType &parameters) const override
TransformType::JacobianType TransformJacobianType
Computes similarity between two objects to be registered.
itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > CastMovedImageFilterType
itk::Image< FixedImagePixelType, itkGetStaticConstMacro(FixedImageDimension) > TransformedMovingImageType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FixedImageType::ConstPointer FixedImageConstPointer
Superclass::MeasureType MeasureType
Applies a single NeighborhoodOperator to an image region.
MovedGradientPixelType m_MaxMovedGradient[MovedImageDimension]
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
Transform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingImageDimension), itkGetStaticConstMacro(FixedImageDimension) > TransformType
Computes similarity between regions of two images.
virtual void Initialize(void) override
itk::CastImageFilter< FixedImageType, FixedGradientImageType > CastFixedImageFilterType
TransformType::ParametersType TransformParametersType
Templated n-dimensional image class.
Definition: itkImage.h:75
ZeroFluxNeumannBoundaryCondition< MovedGradientImageType > m_MovedBoundCond
Casts input pixels to output pixel type.