ITK  5.3.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 {
59 template <typename TFixedImage, typename TMovingSpatialObject>
60 class ITK_TEMPLATE_EXPORT ImageToSpatialObjectMetric : public SingleValuedCostFunction
61 {
62 public:
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 
109  using FixedImagePointer = typename FixedImageType::Pointer;
110 
112  using MovingSpatialObjectPointer = typename MovingSpatialObjectType::Pointer;
113 
115  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
116 
118  using MovingSpatialObjectConstPointer = typename MovingSpatialObjectType::ConstPointer;
119 
122  using ParametersType = Superclass::ParametersType;
123 
125  itkTypeMacro(ImageToSpatialObjectMetric, Object);
126 
128  itkSetConstObjectMacro(FixedImage, FixedImageType);
129  itkGetConstObjectMacro(FixedImage, FixedImageType);
131 
133  itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
134  itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
136 
138  itkSetObjectMacro(Interpolator, InterpolatorType);
139 
141  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
142 
144  void
145  GetValueAndDerivative(const ParametersType & parameters,
146  MeasureType & Value,
147  DerivativeType & Derivative) const override = 0;
148 
150  unsigned int
151  GetNumberOfParameters() const override;
152 
154  virtual void
155  Initialize();
156 
159  itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
160 
162  itkSetObjectMacro(Transform, TransformType);
163 
164 protected:
166  ~ImageToSpatialObjectMetric() override = default;
167 
168  void
169  PrintSelf(std::ostream & os, Indent indent) const override;
170 
171  MeasureType m_MatchMeasure{ 0 };
175 
179 };
180 } // end namespace itk
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 # include "itkImageToSpatialObjectMetric.hxx"
184 #endif
185 
186 #endif
itk::ImageToSpatialObjectMetric::CoordinateRepresentationType
Superclass::ParametersValueType CoordinateRepresentationType
Definition: itkImageToSpatialObjectMetric.h:77
itk::ImageToSpatialObjectMetric::MovingSpatialObjectType
TMovingSpatialObject MovingSpatialObjectType
Definition: itkImageToSpatialObjectMetric.h:74
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::OptimizerParameters
Class to hold and manage different parameter types used during optimization.
Definition: itkOptimizerParameters.h:36
itk::ImageToSpatialObjectMetric::m_FixedImage
FixedImageConstPointer m_FixedImage
Definition: itkImageToSpatialObjectMetric.h:177
itkLinearInterpolateImageFunction.h
itk::ImageToSpatialObjectMetric::m_Transform
TransformPointer m_Transform
Definition: itkImageToSpatialObjectMetric.h:173
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:174
itk::ImageToSpatialObjectMetric::VectorType
vnl_vector_fixed< double, Self::ObjectDimension > VectorType
Definition: itkImageToSpatialObjectMetric.h:100
itk::ImageToSpatialObjectMetric::FixedImageConstPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Definition: itkImageToSpatialObjectMetric.h:115
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:176
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:90
itk::ImageToSpatialObjectMetric::m_LastTransformParameters
ParametersType m_LastTransformParameters
Definition: itkImageToSpatialObjectMetric.h:178
itk::ImageToSpatialObjectMetric::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkImageToSpatialObjectMetric.h:97
itk::ImageToSpatialObjectMetric::m_MatchMeasureDerivatives
DerivativeType m_MatchMeasureDerivatives
Definition: itkImageToSpatialObjectMetric.h:172
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:109
itk::ImageToSpatialObjectMetric::MovingSpatialObjectPointer
typename MovingSpatialObjectType::Pointer MovingSpatialObjectPointer
Definition: itkImageToSpatialObjectMetric.h:112
itk::ImageToSpatialObjectMetric::TransformParametersType
typename TransformType::ParametersType TransformParametersType
Definition: itkImageToSpatialObjectMetric.h:91
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:83
itk::ImageToSpatialObjectMetric::TransformJacobianType
typename TransformType::JacobianType TransformJacobianType
Definition: itkImageToSpatialObjectMetric.h:92
itk::ImageToSpatialObjectMetric::InputPointType
typename TransformType::InputPointType InputPointType
Definition: itkImageToSpatialObjectMetric.h:89
itk::ImageToSpatialObjectMetric::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkImageToSpatialObjectMetric.h:88
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:60
itk::ImageToSpatialObjectMetric::MovingSpatialObjectConstPointer
typename MovingSpatialObjectType::ConstPointer MovingSpatialObjectConstPointer
Definition: itkImageToSpatialObjectMetric.h:118
itk::ImageToSpatialObjectMetric::FixedImageType
TFixedImage FixedImageType
Definition: itkImageToSpatialObjectMetric.h:71