ITK  5.0.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:
56  ITK_DISALLOW_COPY_AND_ASSIGN(TwoImageToOneImageMetric);
57 
63 
66 
69 
71  using MovingImageType = TMovingImage;
72  using MovingImagePixelType = typename TMovingImage::PixelType;
73  using MovingImageConstPointer = typename MovingImageType::ConstPointer;
74 
76  using FixedImageType = TFixedImage;
77  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
79 
81  static constexpr unsigned int MovingImageDimension = TMovingImage::ImageDimension;
82  static constexpr unsigned int FixedImageDimension = TFixedImage::ImageDimension;
83 
86  itkGetStaticConstMacro(MovingImageDimension),
87  itkGetStaticConstMacro(FixedImageDimension)>;
88 
94 
99 
100 
104  itkGetStaticConstMacro(MovingImageDimension)>;
106  itkGetStaticConstMacro(MovingImageDimension)>;
113 
116  typedef SpatialObject< itkGetStaticConstMacro(FixedImageDimension)
119 
122  typedef SpatialObject< itkGetStaticConstMacro(MovingImageDimension)
125 
126 
129 
132 
135 
137  itkSetConstObjectMacro( FixedImage1, FixedImageType );
138 
140  itkSetConstObjectMacro( FixedImage2, FixedImageType );
141 
143  itkGetConstObjectMacro( FixedImage1, FixedImageType );
144 
146  itkGetConstObjectMacro( FixedImage2, FixedImageType );
147 
149  itkSetConstObjectMacro( MovingImage, MovingImageType );
150 
152  itkGetConstObjectMacro( MovingImage, MovingImageType );
153 
155  itkSetObjectMacro( Transform, TransformType );
156 
158  itkGetConstObjectMacro( Transform, TransformType );
159 
161  itkSetObjectMacro( Interpolator1, InterpolatorType );
162 
164  itkSetObjectMacro( Interpolator2, InterpolatorType );
165 
167  itkGetConstObjectMacro( Interpolator1, InterpolatorType );
168 
170  itkGetConstObjectMacro( Interpolator2, InterpolatorType );
171 
173  itkGetConstReferenceMacro( NumberOfPixelsCounted, unsigned long );
174 
176  itkSetMacro( FixedImageRegion1, FixedImageRegionType );
177 
179  itkSetMacro( FixedImageRegion2, FixedImageRegionType );
180 
182  itkGetConstReferenceMacro( FixedImageRegion1, FixedImageRegionType );
183 
185  itkGetConstReferenceMacro( FixedImageRegion2, FixedImageRegionType );
186 
188  itkSetObjectMacro( MovingImageMask, MovingImageMaskType );
189  itkGetConstObjectMacro( MovingImageMask, MovingImageMaskType );
191 
193  itkSetObjectMacro( FixedImageMask1, FixedImageMaskType );
194  itkSetObjectMacro( FixedImageMask2, FixedImageMaskType );
195  itkGetConstObjectMacro( FixedImageMask1, FixedImageMaskType );
196  itkGetConstObjectMacro( FixedImageMask2, FixedImageMaskType );
198 
200  itkSetMacro( ComputeGradient, bool);
201  itkGetConstReferenceMacro( ComputeGradient, bool);
202  itkBooleanMacro(ComputeGradient);
204 
206  itkGetConstObjectMacro( GradientImage, GradientImageType );
207 
209  void SetTransformParameters( const ParametersType & parameters ) const;
210 
212  unsigned int GetNumberOfParameters() const override
213  {
214  return m_Transform->GetNumberOfParameters();
215  }
216 
219  virtual void Initialize();
220 
221 protected:
224  void PrintSelf(std::ostream& os, Indent indent) const override;
225 
226  mutable unsigned long m_NumberOfPixelsCounted;
227 
231 
235 
238 
242 
243 private:
246 };
247 
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkTwoImageToOneImageMetric.hxx"
252 #endif
253 
254 #endif
Array class with size defined at construction time.
Definition: itkArray.h:46
typename NumericTraits< MovingImagePixelType >::RealType RealType
Array2D< ParametersValueType > JacobianType
Definition: itkTransform.h:127
Point< TParametersValueType, NOutputDimensions > OutputPointType
Definition: itkTransform.h:162
typename Superclass::ParametersType ParametersType
Definition: itkTransform.h:119
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
Computes similarity between two fixed images and one fixed image.
Define numeric traits for std::vector.
typename TransformType::JacobianType TransformJacobianType
typename TransformType::InputPointType InputPointType
void PrintSelf(std::ostream &os, Indent indent) const override
typename InterpolatorType::Pointer InterpolatorPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Superclass::ParametersValueType CoordinateRepresentationType
CovariantVector< RealType, itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType
SpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskType
typename MovingImageType::ConstPointer MovingImageConstPointer
unsigned int GetNumberOfParameters() const override
typename TMovingImage::PixelType MovingImagePixelType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
typename MovingImageMaskType::Pointer MovingImageMaskPointer
void SetTransformParameters(const ParametersType &parameters) const
Point< TParametersValueType, NInputDimensions > InputPointType
Definition: itkTransform.h:161
SmartPointer< Self > Pointer
Implementation of the composite pattern.
Array< ParametersValueType > DerivativeType
typename GradientImageFilterType::Pointer GradientImageFilterPointer
typename TransformType::Pointer TransformPointer
Superclass::ParametersType ParametersType
SpatialObject< itkGetStaticConstMacro(MovingImageDimension) > MovingImageMaskType
SmartPointer< Self > Pointer
Definition: itkTransform.h:91
typename TransformType::ParametersType TransformParametersType
Base class for all image interpolaters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::ParametersValueType ParametersValueType
typename TransformType::OutputPointType OutputPointType
typename FixedImageType::RegionType FixedImageRegionType
typename FixedImageMaskType::Pointer FixedImageMaskPointer
A templated class holding a n-Dimensional covariant vector.
static constexpr unsigned int FixedImageDimension
Templated n-dimensional image class.
Definition: itkImage.h:75
static constexpr unsigned int MovingImageDimension