ITK  6.0.0
Insight Toolkit
itkImageToSpatialObjectMetric.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
27namespace itk
28{
59template <typename TFixedImage, typename TMovingSpatialObject>
60class ITK_TEMPLATE_EXPORT ImageToSpatialObjectMetric : public SingleValuedCostFunction
61{
62public:
63 ITK_DISALLOW_COPY_AND_MOVE(ImageToSpatialObjectMetric);
64
69
71 using FixedImageType = TFixedImage;
72
74 using MovingSpatialObjectType = TMovingSpatialObject;
75
77 using CoordinateRepresentationType = Superclass::ParametersValueType;
78
80 static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
81
83 static constexpr unsigned int ObjectDimension = MovingSpatialObjectType::ObjectDimension;
84
87
93
96
98
100 using VectorType = vnl_vector_fixed<double, Self::ObjectDimension>;
101
104
106 using DerivativeType = Superclass::DerivativeType;
107
110
113
116
119
123
125 itkOverrideGetNameOfClassMacro(ImageToSpatialObjectMetric);
126
128 itkSetConstObjectMacro(FixedImage, FixedImageType);
129 itkGetConstObjectMacro(FixedImage, FixedImageType);
133 itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
134 itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
138 itkSetObjectMacro(Interpolator, InterpolatorType);
139
141 itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
142
144 void
146 MeasureType & Value,
147 DerivativeType & Derivative) const override = 0;
148
150 unsigned int
151 GetNumberOfParameters() const override;
152
154 virtual void
156
159 itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
160
162 itkSetObjectMacro(Transform, TransformType);
163
164protected:
166 ~ImageToSpatialObjectMetric() override = default;
167
168 void
169 PrintSelf(std::ostream & os, Indent indent) const override;
170
171 MeasureType m_MatchMeasure{ 0 };
172 DerivativeType m_MatchMeasureDerivatives{};
173 mutable TransformPointer m_Transform{};
174 InterpolatorPointer m_Interpolator{};
175
176 MovingSpatialObjectConstPointer m_MovingSpatialObject{};
178 ParametersType m_LastTransformParameters{};
179};
180} // end namespace itk
181
182#ifndef ITK_MANUAL_INSTANTIATION
183# include "itkImageToSpatialObjectMetric.hxx"
184#endif
185
186#endif
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
Array class with size defined at construction time.
Definition: itkArray.h:48
Computes similarity between a moving spatial object and an Image to be registered.
unsigned int GetNumberOfParameters() const override
typename FixedImageType::Pointer FixedImagePointer
typename TransformType::InputPointType InputPointType
typename MovingSpatialObjectType::Pointer MovingSpatialObjectPointer
Superclass::ParametersValueType CoordinateRepresentationType
typename MovingSpatialObjectType::ConstPointer MovingSpatialObjectConstPointer
typename TransformType::JacobianType TransformJacobianType
typename TransformType::Pointer TransformPointer
vnl_vector_fixed< double, Self::ObjectDimension > VectorType
void PrintSelf(std::ostream &os, Indent indent) const override
typename TransformType::ParametersType TransformParametersType
typename InterpolatorType::Pointer InterpolatorPointer
~ImageToSpatialObjectMetric() override=default
typename FixedImageType::ConstPointer FixedImageConstPointer
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override=0
typename TransformType::OutputPointType OutputPointType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Linearly interpolate an image at specified positions.
Class to hold and manage different parameter types used during optimization.
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
This class is a base for the CostFunctions returning a single value.
Superclass::ParametersType ParametersType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:84
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....