3
3
Program: Insight Segmentation & Registration Toolkit
4
4
Module: $RCSfile: itkImageToImageMetric.h,v $
6
Date: $Date: 2006/06/29 01:25:50 $
7
Version: $Revision: 1.23 $
6
Date: $Date: 2007-11-12 20:00:37 $
7
Version: $Revision: 1.25 $
9
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
17
17
#ifndef __itkImageToImageMetric_h
18
18
#define __itkImageToImageMetric_h
20
// First make sure that the configuration is available.
21
// This line can be removed once the optimized versions
22
// gets integrated into the main directories.
23
#include "itkConfigure.h"
25
#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
26
#include "itkOptImageToImageMetric.h"
20
29
#include "itkImageBase.h"
21
30
#include "itkTransform.h"
22
31
#include "itkInterpolateImageFunction.h"
54
63
/** Standard class typedefs. */
55
typedef ImageToImageMetric Self;
56
typedef SingleValuedCostFunction Superclass;
57
typedef SmartPointer<Self> Pointer;
58
typedef SmartPointer<const Self> ConstPointer;
64
typedef ImageToImageMetric Self;
65
typedef SingleValuedCostFunction Superclass;
66
typedef SmartPointer<Self> Pointer;
67
typedef SmartPointer<const Self> ConstPointer;
60
69
/** Type used for representing point components */
61
typedef Superclass::ParametersValueType CoordinateRepresentationType;
70
typedef typename Superclass::ParametersValueType CoordinateRepresentationType;
63
72
/** Run-time type information (and related methods). */
64
73
itkTypeMacro(ImageToImageMetric, SingleValuedCostFunction);
74
83
typedef typename FixedImageType::RegionType FixedImageRegionType;
76
85
/** Constants for the image dimensions */
77
itkStaticConstMacro(MovingImageDimension, unsigned int,
86
itkStaticConstMacro(MovingImageDimension,
78
88
TMovingImage::ImageDimension);
79
itkStaticConstMacro(FixedImageDimension, unsigned int,
89
itkStaticConstMacro(FixedImageDimension,
80
91
TFixedImage::ImageDimension);
82
93
/** Type of the Transform Base class */
83
94
typedef Transform<CoordinateRepresentationType,
84
95
itkGetStaticConstMacro(MovingImageDimension),
85
itkGetStaticConstMacro(FixedImageDimension)> TransformType;
96
itkGetStaticConstMacro(FixedImageDimension)>
87
99
typedef typename TransformType::Pointer TransformPointer;
88
100
typedef typename TransformType::InputPointType InputPointType;
99
111
/** Gaussian filter to compute the gradient of the Moving Image */
100
typedef typename NumericTraits<MovingImagePixelType>::RealType RealType;
112
typedef typename NumericTraits<MovingImagePixelType>::RealType
101
114
typedef CovariantVector<RealType,
102
itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType;
115
itkGetStaticConstMacro(MovingImageDimension)>
103
117
typedef Image<GradientPixelType,
104
itkGetStaticConstMacro(MovingImageDimension)> GradientImageType;
105
typedef SmartPointer<GradientImageType> GradientImagePointer;
118
itkGetStaticConstMacro(MovingImageDimension)>
120
typedef SmartPointer<GradientImageType> GradientImagePointer;
106
121
typedef GradientRecursiveGaussianImageFilter< MovingImageType,
107
122
GradientImageType >
108
GradientImageFilterType;
109
typedef typename GradientImageFilterType::Pointer GradientImageFilterPointer;
123
GradientImageFilterType;
124
typedef typename GradientImageFilterType::Pointer GradientImageFilterPointer;
112
127
typedef typename InterpolatorType::Pointer InterpolatorPointer;
116
130
/** Type for the mask of the fixed image. Only pixels that are "inside"
117
131
this mask will be considered for the computation of the metric */
118
typedef SpatialObject< itkGetStaticConstMacro(FixedImageDimension)
119
> FixedImageMaskType;
132
typedef SpatialObject< itkGetStaticConstMacro(FixedImageDimension) >
120
134
typedef typename FixedImageMaskType::Pointer FixedImageMaskPointer;
122
136
/** Type for the mask of the moving image. Only pixels that are "inside"
123
137
this mask will be considered for the computation of the metric */
124
typedef SpatialObject< itkGetStaticConstMacro(MovingImageDimension)
125
> MovingImageMaskType;
138
typedef SpatialObject< itkGetStaticConstMacro(MovingImageDimension) >
126
140
typedef typename MovingImageMaskType::Pointer MovingImageMaskPointer;
130
143
/** Type of the measure. */
131
typedef Superclass::MeasureType MeasureType;
144
typedef typename Superclass::MeasureType MeasureType;
133
146
/** Type of the derivative. */
134
typedef Superclass::DerivativeType DerivativeType;
147
typedef typename Superclass::DerivativeType DerivativeType;
136
149
/** Type of the parameters. */
137
typedef Superclass::ParametersType ParametersType;
150
typedef typename Superclass::ParametersType ParametersType;
139
152
/** Connect the Fixed Image. */
140
153
itkSetConstObjectMacro( FixedImage, FixedImageType );
194
207
/** Return the number of parameters required by the Transform */
195
208
unsigned int GetNumberOfParameters(void) const
196
{ return m_Transform->GetNumberOfParameters(); }
209
{ return m_Transform->GetNumberOfParameters(); }
198
211
/** Initialize the Metric by making sure that all the components
199
212
* are present and plugged together correctly */