ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageToSpatialObjectMetric.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 itkImageToSpatialObjectMetric_h
19 #define itkImageToSpatialObjectMetric_h
20 
24 #include "vnl/vnl_vector_fixed.h"
25 #include "itkTransform.h"
26 
27 namespace itk
28 {
60 template< typename TFixedImage, typename TMovingSpatialObject >
61 class ITK_TEMPLATE_EXPORT ImageToSpatialObjectMetric:
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_ASSIGN(ImageToSpatialObjectMetric);
66 
71 
73  using FixedImageType = TFixedImage;
74 
76  using MovingSpatialObjectType = TMovingSpatialObject;
77 
79  using CoordinateRepresentationType = Superclass::ParametersValueType;
80 
82  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
83 
85  static constexpr unsigned int ObjectDimension = MovingSpatialObjectType::ObjectDimension;
86 
89  Self::ObjectDimension,
90  Self::ImageDimension >;
91 
97 
100  TFixedImage,
102 
104 
106  using VectorType = vnl_vector_fixed< double,
107  Self::ObjectDimension >;
108 
111 
113  using DerivativeType = Superclass::DerivativeType;
114 
116  using FixedImagePointer = typename FixedImageType::Pointer;
117 
119  using MovingSpatialObjectPointer = typename MovingSpatialObjectType::Pointer;
120 
122  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
123 
125  using MovingSpatialObjectConstPointer = typename MovingSpatialObjectType::ConstPointer;
126 
129  using ParametersType = Superclass::ParametersType;
130 
132  itkTypeMacro(ImageToSpatialObjectMetric, Object);
133 
135  itkSetConstObjectMacro(FixedImage, FixedImageType);
136  itkGetConstObjectMacro(FixedImage, FixedImageType);
138 
140  itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
141  itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
143 
145  itkSetObjectMacro(Interpolator, InterpolatorType);
146 
148  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
149 
151  void GetValueAndDerivative(const ParametersType & parameters,
152  MeasureType & Value,
153  DerivativeType & Derivative) const override = 0;
154 
156  unsigned int GetNumberOfParameters() const override;
157 
159  virtual void Initialize();
160 
163  itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
164 
166  itkSetObjectMacro(Transform, TransformType);
167 
168 protected:
169 
171  ~ImageToSpatialObjectMetric() override = default;
172 
173  void PrintSelf(std::ostream & os, Indent indent) const override;
174 
175  MeasureType m_MatchMeasure{0};
179 
183 };
184 } // end namespace itk
185 
186 #ifndef ITK_MANUAL_INSTANTIATION
187 #include "itkImageToSpatialObjectMetric.hxx"
188 #endif
189 
190 #endif
Array class with size defined at construction time.
Definition: itkArray.h:46
typename Superclass::ParametersType ParametersType
Definition: itkTransform.h:119
Computes similarity between a moving spatial obejct and an Image to be registered.
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
Superclass::ParametersValueType CoordinateRepresentationType
typename TransformType::Pointer TransformPointer
typename MovingSpatialObjectType::ConstPointer MovingSpatialObjectConstPointer
typename TransformType::ParametersType TransformParametersType
typename FixedImageType::ConstPointer FixedImageConstPointer
typename TransformType::OutputPointType OutputPointType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
typename FixedImageType::Pointer FixedImagePointer
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
typename InterpolatorType::Pointer InterpolatorPointer
Linearly interpolate an image at specified positions.
typename MovingSpatialObjectType::Pointer MovingSpatialObjectPointer
vnl_vector_fixed< double, Self::ObjectDimension > VectorType
typename TransformType::JacobianType TransformJacobianType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
MovingSpatialObjectConstPointer m_MovingSpatialObject
typename TransformType::InputPointType InputPointType