ITK  6.0.0
Insight Toolkit
itkPointSetToImageMetric.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 itkPointSetToImageMetric_h
19#define itkPointSetToImageMetric_h
20
21#include "itkImageBase.h"
22#include "itkTransform.h"
25#include "itkMacro.h"
27
28namespace itk
29{
47template <typename TFixedPointSet, typename TMovingImage>
48class ITK_TEMPLATE_EXPORT PointSetToImageMetric : public SingleValuedCostFunction
49{
50public:
51 ITK_DISALLOW_COPY_AND_MOVE(PointSetToImageMetric);
52
58
60 using CoordinateRepresentationType = Superclass::ParametersValueType;
61
63 itkOverrideGetNameOfClassMacro(PointSetToImageMetric);
64
66 using MovingImageType = TMovingImage;
67 using MovingImagePixelType = typename TMovingImage::PixelType;
69
71 using FixedPointSetType = TFixedPointSet;
73
75 static constexpr unsigned int MovingImageDimension = TMovingImage::ImageDimension;
76 static constexpr unsigned int FixedPointSetDimension = TFixedPointSet::PointDimension;
77
78 using PointIterator = typename FixedPointSetType::PointsContainer::ConstIterator;
79 using PointDataIterator = typename FixedPointSetType::PointDataContainer::ConstIterator;
80
84
90
93
100
102
104
106 using MeasureType = Superclass::MeasureType;
107
109 using DerivativeType = Superclass::DerivativeType;
110
112 using ParametersType = Superclass::ParametersType;
113
115 itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
116 itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
120 itkSetConstObjectMacro(MovingImage, MovingImageType);
121 itkGetConstObjectMacro(MovingImage, MovingImageType);
125 itkSetObjectMacro(Transform, TransformType);
126
128 itkGetModifiableObjectMacro(Transform, TransformType);
129
131 itkSetObjectMacro(Interpolator, InterpolatorType);
132
134 itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
135
137 itkGetModifiableObjectMacro(GradientImage, GradientImageType);
138
140 itkGetConstReferenceMacro(NumberOfPixelsCounted, SizeValueType);
141
143 void
144 SetTransformParameters(const ParametersType & parameters) const;
145
153 itkSetMacro(ComputeGradient, bool);
154 itkGetConstReferenceMacro(ComputeGradient, bool);
158 unsigned int
159 GetNumberOfParameters() const override
160 {
161 return m_Transform->GetNumberOfParameters();
162 }
163
165 virtual void
167
168protected:
170 ~PointSetToImageMetric() override = default;
171 void
172 PrintSelf(std::ostream & os, Indent indent) const override;
173
174 mutable SizeValueType m_NumberOfPixelsCounted{};
175
176 FixedPointSetConstPointer m_FixedPointSet{};
177
178 MovingImageConstPointer m_MovingImage{};
179
180 mutable TransformPointer m_Transform{};
181
182 InterpolatorPointer m_Interpolator{};
183
184 bool m_ComputeGradient{};
185
186 GradientImagePointer m_GradientImage{};
187};
188} // end namespace itk
189
190#ifndef ITK_MANUAL_INSTANTIATION
191# include "itkPointSetToImageMetric.hxx"
192#endif
193
194#endif
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
Array class with size defined at construction time.
Definition: itkArray.h:48
A templated class holding a n-Dimensional covariant vector.
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for all image interpolators.
Light weight base class for most itk classes.
Class to hold and manage different parameter types used during optimization.
Computes similarity between a point set and an image.
typename TransformType::InputPointType InputPointType
unsigned int GetNumberOfParameters() const override
void SetTransformParameters(const ParametersType &parameters) const
typename TransformType::Pointer TransformPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Superclass::ParametersValueType CoordinateRepresentationType
typename TransformType::JacobianType TransformJacobianType
typename FixedPointSetType::ConstPointer FixedPointSetConstPointer
typename TMovingImage::PixelType MovingImagePixelType
typename GradientImageFilterType::Pointer GradientImageFilterPointer
typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
void PrintSelf(std::ostream &os, Indent indent) const override
~PointSetToImageMetric() override=default
typename NumericTraits< MovingImagePixelType >::RealType RealType
typename FixedPointSetType::PointsContainer::ConstIterator PointIterator
typename InterpolatorType::Pointer InterpolatorPointer
typename TransformType::ParametersType TransformParametersType
typename TransformType::OutputPointType OutputPointType
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....
unsigned long SizeValueType
Definition: itkIntTypes.h:86