ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTwoImageToOneImageMetric.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 itkTwoImageToOneImageMetric_h
19 #define itkTwoImageToOneImageMetric_h
20 
21 #include "itkImageBase.h"
22 #include "itkTransform.h"
25 #include "itkExceptionObject.h"
27 #include "itkSpatialObject.h"
28 
29 namespace itk
30 {
31 
52 template <typename TFixedImage, typename TMovingImage>
54 {
55 public:
61 
64 
67 
69  typedef TMovingImage MovingImageType;
70  typedef typename TMovingImage::PixelType MovingImagePixelType;
71  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
72 
74  typedef TFixedImage FixedImageType;
75  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
76  typedef typename FixedImageType::RegionType FixedImageRegionType;
77 
79  itkStaticConstMacro(MovingImageDimension, unsigned int,
80  TMovingImage::ImageDimension);
81  itkStaticConstMacro(FixedImageDimension, unsigned int,
82  TFixedImage::ImageDimension);
84 
87  itkGetStaticConstMacro(MovingImageDimension),
88  itkGetStaticConstMacro(FixedImageDimension)> TransformType;
89 
95 
100 
101 
104  typedef CovariantVector<RealType,
105  itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType;
106  typedef Image<GradientPixelType,
107  itkGetStaticConstMacro(MovingImageDimension)> GradientImageType;
115 
118  typedef SpatialObject< itkGetStaticConstMacro(FixedImageDimension)
121 
124  typedef SpatialObject< itkGetStaticConstMacro(MovingImageDimension)
127 
128 
131 
134 
137 
139  itkSetConstObjectMacro( FixedImage1, FixedImageType );
140 
142  itkSetConstObjectMacro( FixedImage2, FixedImageType );
143 
145  itkGetConstObjectMacro( FixedImage1, FixedImageType );
146 
148  itkGetConstObjectMacro( FixedImage2, FixedImageType );
149 
151  itkSetConstObjectMacro( MovingImage, MovingImageType );
152 
154  itkGetConstObjectMacro( MovingImage, MovingImageType );
155 
157  itkSetObjectMacro( Transform, TransformType );
158 
160  itkGetConstObjectMacro( Transform, TransformType );
161 
163  itkSetObjectMacro( Interpolator1, InterpolatorType );
164 
166  itkSetObjectMacro( Interpolator2, InterpolatorType );
167 
169  itkGetConstObjectMacro( Interpolator1, InterpolatorType );
170 
172  itkGetConstObjectMacro( Interpolator2, InterpolatorType );
173 
175  itkGetConstReferenceMacro( NumberOfPixelsCounted, unsigned long );
176 
178  itkSetMacro( FixedImageRegion1, FixedImageRegionType );
179 
181  itkSetMacro( FixedImageRegion2, FixedImageRegionType );
182 
184  itkGetConstReferenceMacro( FixedImageRegion1, FixedImageRegionType );
185 
187  itkGetConstReferenceMacro( FixedImageRegion2, FixedImageRegionType );
188 
190  itkSetObjectMacro( MovingImageMask, MovingImageMaskType );
191  itkGetConstObjectMacro( MovingImageMask, MovingImageMaskType );
193 
195  itkSetObjectMacro( FixedImageMask1, FixedImageMaskType );
196  itkSetObjectMacro( FixedImageMask2, FixedImageMaskType );
197  itkGetConstObjectMacro( FixedImageMask1, FixedImageMaskType );
198  itkGetConstObjectMacro( FixedImageMask2, FixedImageMaskType );
200 
202  itkSetMacro( ComputeGradient, bool);
203  itkGetConstReferenceMacro( ComputeGradient, bool);
204  itkBooleanMacro(ComputeGradient);
206 
208  itkGetConstObjectMacro( GradientImage, GradientImageType );
209 
211  void SetTransformParameters( const ParametersType & parameters ) const;
212 
214  unsigned int GetNumberOfParameters() const
215  {
216  return m_Transform->GetNumberOfParameters();
217  }
218 
221  virtual void Initialize();
222 
223 protected:
226  virtual void PrintSelf(std::ostream& os, Indent indent) const;
227 
228  mutable unsigned long m_NumberOfPixelsCounted;
229 
233 
237 
240 
244 
245 private:
246  TwoImageToOneImageMetric(const Self&); //purposely not implemented
247  void operator=(const Self&); //purposely not implemented
248 
251 };
252 
253 } // end namespace itk
254 
255 #ifndef ITK_MANUAL_INSTANTIATION
256 #include "itkTwoImageToOneImageMetric.hxx"
257 #endif
258 
259 #endif
This class is a base for the CostFunctions returning a single value.
NumericTraits< MovingImagePixelType >::RealType RealType
Light weight base class for most itk classes.
Computes similarity between two fixed images and one fixed image.
TransformType::OutputPointType OutputPointType
GradientImageFilterType::Pointer GradientImageFilterPointer
static const unsigned int MovingImageDimension
TransformType::ParametersType TransformParametersType
Superclass::ParametersType ParametersType
MovingImageMaskType::Pointer MovingImageMaskPointer
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
CovariantVector< RealType, itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType
Image< GradientPixelType, itkGetStaticConstMacro(MovingImageDimension)> GradientImageType
void operator=(const Self &)
SpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskType
InterpolateImageFunction< MovingImageType, CoordinateRepresentationType > InterpolatorType
TransformType::InputPointType InputPointType
FixedImageMaskType::Pointer FixedImageMaskPointer
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Array< ParametersValueType > DerivativeType
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
void SetTransformParameters(const ParametersType &parameters) const
MovingImageType::ConstPointer MovingImageConstPointer
Class to hold and manage different parameter types used during optimization.
FixedImageType::ConstPointer FixedImageConstPointer
Implementation of the composite pattern.
SpatialObject< itkGetStaticConstMacro(MovingImageDimension) > MovingImageMaskType
virtual void PrintSelf(std::ostream &os, Indent indent) const
InterpolatorType::Pointer InterpolatorPointer
TransformType::JacobianType TransformJacobianType
Superclass::ParametersType ParametersType
Base class for all image interpolaters.
Superclass::DerivativeType DerivativeType
Superclass::ParametersValueType ParametersValueType
Superclass::ParametersValueType CoordinateRepresentationType
SmartPointer< GradientImageType > GradientImagePointer
Transform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingImageDimension), itkGetStaticConstMacro(FixedImageDimension)> TransformType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FixedImageType::RegionType FixedImageRegionType
GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType > GradientImageFilterType
SmartPointer< const Self > ConstPointer
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
A templated class holding a n-Dimensional covariant vector.
static const unsigned int FixedImageDimension
TMovingImage::PixelType MovingImagePixelType
Templated n-dimensional image class.
Definition: itkImage.h:75