~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Code/Algorithms/itkImageToImageMetric.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-05-31 12:07:29 UTC
  • mfrom: (3.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080531120729-7g7layn480le43ko
Tags: 3.6.0-3
* debian/patches/gccxml-workaround.patch: New.  Work around gccxml issue
  with #include_next; c.f. http://www.gccxml.org/Bug/view.php?id=7134.  
* debian/patches/gcc43.patch: include <cstring> in itkNeighbourhood.h.
  This only showed up in the tcl wrapping step.

* Above two entries fix FTBFS for GCC 4.3-based systems.
  Closes: #478500.

* debian/patches/sharedforward.patch: New.  Ensure that linux/sparc
  systems are not also configured as a SUN sparc system, which requires
  SUN header sys/isa_defs.h.  Closes: #478940, #483312.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   Insight Segmentation & Registration Toolkit
4
4
  Module:    $RCSfile: itkImageToImageMetric.h,v $
5
5
  Language:  C++
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 $
8
8
 
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
19
19
 
 
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"
 
24
 
 
25
#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
 
26
#include "itkOptImageToImageMetric.h"
 
27
#else
 
28
 
20
29
#include "itkImageBase.h"
21
30
#include "itkTransform.h"
22
31
#include "itkInterpolateImageFunction.h"
52
61
{
53
62
public:
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;
59
68
 
60
69
  /** Type used for representing point components  */
61
 
  typedef Superclass::ParametersValueType CoordinateRepresentationType;
 
70
  typedef typename Superclass::ParametersValueType CoordinateRepresentationType;
62
71
 
63
72
  /** Run-time type information (and related methods). */
64
73
  itkTypeMacro(ImageToImageMetric, SingleValuedCostFunction);
74
83
  typedef typename FixedImageType::RegionType        FixedImageRegionType;
75
84
 
76
85
  /** Constants for the image dimensions */
77
 
  itkStaticConstMacro(MovingImageDimension, unsigned int,
 
86
  itkStaticConstMacro(MovingImageDimension, 
 
87
                      unsigned int,
78
88
                      TMovingImage::ImageDimension);
79
 
  itkStaticConstMacro(FixedImageDimension, unsigned int,
 
89
  itkStaticConstMacro(FixedImageDimension, 
 
90
                      unsigned int,
80
91
                      TFixedImage::ImageDimension);
81
92
  
82
93
  /**  Type of the Transform Base class */
83
94
  typedef Transform<CoordinateRepresentationType, 
84
95
                    itkGetStaticConstMacro(MovingImageDimension),
85
 
                    itkGetStaticConstMacro(FixedImageDimension)> TransformType;
 
96
                    itkGetStaticConstMacro(FixedImageDimension)> 
 
97
                                                     TransformType;
86
98
 
87
99
  typedef typename TransformType::Pointer            TransformPointer;
88
100
  typedef typename TransformType::InputPointType     InputPointType;
97
109
 
98
110
 
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 
 
113
                                                     RealType;
101
114
  typedef CovariantVector<RealType,
102
 
                          itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType;
 
115
                          itkGetStaticConstMacro(MovingImageDimension)>
 
116
                                                     GradientPixelType;
103
117
  typedef Image<GradientPixelType,
104
 
                itkGetStaticConstMacro(MovingImageDimension)> GradientImageType;
105
 
  typedef SmartPointer<GradientImageType>     GradientImagePointer;
 
118
                itkGetStaticConstMacro(MovingImageDimension)> 
 
119
                                                     GradientImageType;
 
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;
110
125
 
111
126
 
112
127
  typedef typename InterpolatorType::Pointer         InterpolatorPointer;
113
128
 
114
129
 
115
 
 
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) >
 
133
                                                     FixedImageMaskType;
120
134
  typedef typename  FixedImageMaskType::Pointer      FixedImageMaskPointer;
121
135
 
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) >
 
139
                                                     MovingImageMaskType;
126
140
  typedef typename  MovingImageMaskType::Pointer     MovingImageMaskPointer;
127
141
 
128
142
 
129
 
 
130
143
  /**  Type of the measure. */
131
 
  typedef Superclass::MeasureType                    MeasureType;
 
144
  typedef typename Superclass::MeasureType                    MeasureType;
132
145
 
133
146
  /**  Type of the derivative. */
134
 
  typedef Superclass::DerivativeType                 DerivativeType;
 
147
  typedef typename Superclass::DerivativeType                 DerivativeType;
135
148
 
136
149
  /**  Type of the parameters. */
137
 
  typedef Superclass::ParametersType                 ParametersType;
 
150
  typedef typename Superclass::ParametersType                 ParametersType;
138
151
 
139
152
  /** Connect the Fixed Image.  */
140
153
  itkSetConstObjectMacro( FixedImage, FixedImageType );
193
206
 
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(); }
197
210
 
198
211
  /** Initialize the Metric by making sure that all the components
199
212
   *  are present and plugged together correctly     */
201
214
 
202
215
protected:
203
216
  ImageToImageMetric();
204
 
  virtual ~ImageToImageMetric() {};
 
217
  virtual ~ImageToImageMetric();
205
218
  void PrintSelf(std::ostream& os, Indent indent) const;
206
219
 
207
220
  mutable unsigned long       m_NumberOfPixelsCounted;
224
237
  
225
238
  FixedImageRegionType        m_FixedImageRegion;  
226
239
 
227
 
 
228
240
};
229
241
 
230
242
} // end namespace itk
235
247
 
236
248
#endif
237
249
 
238
 
 
239
 
 
 
250
#endif