ITK  5.2.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  * 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 : public SingleValuedCostFunction
62 {
63 public:
64  ITK_DISALLOW_COPY_AND_MOVE(ImageToSpatialObjectMetric);
65 
70 
72  using FixedImageType = TFixedImage;
73 
75  using MovingSpatialObjectType = TMovingSpatialObject;
76 
78  using CoordinateRepresentationType = Superclass::ParametersValueType;
79 
81  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
82 
84  static constexpr unsigned int ObjectDimension = MovingSpatialObjectType::ObjectDimension;
85 
88 
94 
97 
99 
101  using VectorType = vnl_vector_fixed<double, Self::ObjectDimension>;
102 
105 
107  using DerivativeType = Superclass::DerivativeType;
108 
110  using FixedImagePointer = typename FixedImageType::Pointer;
111 
113  using MovingSpatialObjectPointer = typename MovingSpatialObjectType::Pointer;
114 
116  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
117 
119  using MovingSpatialObjectConstPointer = typename MovingSpatialObjectType::ConstPointer;
120 
123  using ParametersType = Superclass::ParametersType;
124 
126  itkTypeMacro(ImageToSpatialObjectMetric, Object);
127 
129  itkSetConstObjectMacro(FixedImage, FixedImageType);
130  itkGetConstObjectMacro(FixedImage, FixedImageType);
132 
134  itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
135  itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
137 
139  itkSetObjectMacro(Interpolator, InterpolatorType);
140 
142  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
143 
145  void
146  GetValueAndDerivative(const ParametersType & parameters,
147  MeasureType & Value,
148  DerivativeType & Derivative) const override = 0;
149 
151  unsigned int
152  GetNumberOfParameters() const override;
153 
155  virtual void
156  Initialize();
157 
160  itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
161 
163  itkSetObjectMacro(Transform, TransformType);
164 
165 protected:
167  ~ImageToSpatialObjectMetric() override = default;
168 
169  void
170  PrintSelf(std::ostream & os, Indent indent) const override;
171 
172  MeasureType m_MatchMeasure{ 0 };
176 
180 };
181 } // end namespace itk
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 # include "itkImageToSpatialObjectMetric.hxx"
185 #endif
186 
187 #endif
itk::ImageToSpatialObjectMetric::CoordinateRepresentationType
Superclass::ParametersValueType CoordinateRepresentationType
Definition: itkImageToSpatialObjectMetric.h:78
itk::ImageToSpatialObjectMetric::MovingSpatialObjectType
TMovingSpatialObject MovingSpatialObjectType
Definition: itkImageToSpatialObjectMetric.h:75
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::OptimizerParameters< TInternalComputationValueType >
itk::ImageToSpatialObjectMetric::m_FixedImage
FixedImageConstPointer m_FixedImage
Definition: itkImageToSpatialObjectMetric.h:178
itkLinearInterpolateImageFunction.h
itk::ImageToSpatialObjectMetric::m_Transform
TransformPointer m_Transform
Definition: itkImageToSpatialObjectMetric.h:174
itkMinimumMaximumImageCalculator.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageToSpatialObjectMetric::m_Interpolator
InterpolatorPointer m_Interpolator
Definition: itkImageToSpatialObjectMetric.h:175
itk::ImageToSpatialObjectMetric::VectorType
vnl_vector_fixed< double, Self::ObjectDimension > VectorType
Definition: itkImageToSpatialObjectMetric.h:101
itk::ImageToSpatialObjectMetric::FixedImageConstPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Definition: itkImageToSpatialObjectMetric.h:116
itk::LinearInterpolateImageFunction
Linearly interpolate an image at specified positions.
Definition: itkLinearInterpolateImageFunction.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageToSpatialObjectMetric::m_MovingSpatialObject
MovingSpatialObjectConstPointer m_MovingSpatialObject
Definition: itkImageToSpatialObjectMetric.h:177
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itk::ImageToSpatialObjectMetric::OutputPointType
typename TransformType::OutputPointType OutputPointType
Definition: itkImageToSpatialObjectMetric.h:91
itk::ImageToSpatialObjectMetric::m_LastTransformParameters
ParametersType m_LastTransformParameters
Definition: itkImageToSpatialObjectMetric.h:179
itk::ImageToSpatialObjectMetric::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkImageToSpatialObjectMetric.h:98
itk::ImageToSpatialObjectMetric::m_MatchMeasureDerivatives
DerivativeType m_MatchMeasureDerivatives
Definition: itkImageToSpatialObjectMetric.h:173
itk::Transform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkTransform.h:121
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageToSpatialObjectMetric::FixedImagePointer
typename FixedImageType::Pointer FixedImagePointer
Definition: itkImageToSpatialObjectMetric.h:110
itk::ImageToSpatialObjectMetric::MovingSpatialObjectPointer
typename MovingSpatialObjectType::Pointer MovingSpatialObjectPointer
Definition: itkImageToSpatialObjectMetric.h:113
itk::ImageToSpatialObjectMetric::TransformParametersType
typename TransformType::ParametersType TransformParametersType
Definition: itkImageToSpatialObjectMetric.h:92
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itk::ImageToSpatialObjectMetric::TransformJacobianType
typename TransformType::JacobianType TransformJacobianType
Definition: itkImageToSpatialObjectMetric.h:93
itk::ImageToSpatialObjectMetric::InputPointType
typename TransformType::InputPointType InputPointType
Definition: itkImageToSpatialObjectMetric.h:90
itk::ImageToSpatialObjectMetric::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkImageToSpatialObjectMetric.h:89
itkTransform.h
itk::Array2D
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
itkSingleValuedCostFunction.h
itk::ImageToSpatialObjectMetric
Computes similarity between a moving spatial object and an Image to be registered.
Definition: itkImageToSpatialObjectMetric.h:61
itk::ImageToSpatialObjectMetric::MovingSpatialObjectConstPointer
typename MovingSpatialObjectType::ConstPointer MovingSpatialObjectConstPointer
Definition: itkImageToSpatialObjectMetric.h:119
itk::ImageToSpatialObjectMetric::FixedImageType
TFixedImage FixedImageType
Definition: itkImageToSpatialObjectMetric.h:72