ITK  5.4.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 
28 namespace itk
29 {
47 template <typename TFixedPointSet, typename TMovingImage>
48 class ITK_TEMPLATE_EXPORT PointSetToImageMetric : public SingleValuedCostFunction
49 {
50 public:
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 
82  using TransformType =
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
166  Initialize();
167 
168 protected:
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::PointSetToImageMetric::CoordinateRepresentationType
Superclass::ParametersValueType CoordinateRepresentationType
Definition: itkPointSetToImageMetric.h:60
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
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::PointSetToImageMetric::MovingImageConstPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Definition: itkPointSetToImageMetric.h:68
itk::PointSetToImageMetric::PointIterator
typename FixedPointSetType::PointsContainer::ConstIterator PointIterator
Definition: itkPointSetToImageMetric.h:78
itk::PointSetToImageMetric::InputPointType
typename TransformType::InputPointType InputPointType
Definition: itkPointSetToImageMetric.h:86
itk::PointSetToImageMetric::MovingImagePixelType
typename TMovingImage::PixelType MovingImagePixelType
Definition: itkPointSetToImageMetric.h:67
itk::PointSetToImageMetric::MovingImageType
TMovingImage MovingImageType
Definition: itkPointSetToImageMetric.h:66
itk::PointSetToImageMetric::RealType
typename NumericTraits< MovingImagePixelType >::RealType RealType
Definition: itkPointSetToImageMetric.h:95
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::PointSetToImageMetric::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkPointSetToImageMetric.h:103
itk::PointSetToImageMetric::TransformJacobianType
typename TransformType::JacobianType TransformJacobianType
Definition: itkPointSetToImageMetric.h:89
itkGradientRecursiveGaussianImageFilter.h
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::PointSetToImageMetric::PointDataIterator
typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
Definition: itkPointSetToImageMetric.h:79
itkMacro.h
itk::PointSetToImageMetric::GetNumberOfParameters
unsigned int GetNumberOfParameters() const override
Definition: itkPointSetToImageMetric.h:159
itk::GradientRecursiveGaussianImageFilter
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Definition: itkGradientRecursiveGaussianImageFilter.h:59
itk::PointSetToImageMetric
Computes similarity between a point set and an image.
Definition: itkPointSetToImageMetric.h:48
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itk::PointSetToImageMetric::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkPointSetToImageMetric.h:85
itk::PointSetToImageMetric::FixedPointSetType
TFixedPointSet FixedPointSetType
Definition: itkPointSetToImageMetric.h:71
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::PointSetToImageMetric::OutputPointType
typename TransformType::OutputPointType OutputPointType
Definition: itkPointSetToImageMetric.h:87
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::PointSetToImageMetric::GradientImageFilterPointer
typename GradientImageFilterType::Pointer GradientImageFilterPointer
Definition: itkPointSetToImageMetric.h:101
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:85
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
itkTransform.h
itkInterpolateImageFunction.h
itk::Array2D
Array2D class representing a 2D array.
Definition: itkArray2D.h:42
itkSingleValuedCostFunction.h
itk::PointSetToImageMetric::TransformParametersType
typename TransformType::ParametersType TransformParametersType
Definition: itkPointSetToImageMetric.h:88
itk::PointSetToImageMetric::FixedPointSetConstPointer
typename FixedPointSetType::ConstPointer FixedPointSetConstPointer
Definition: itkPointSetToImageMetric.h:72
itk::InterpolateImageFunction
Base class for all image interpolators.
Definition: itkInterpolateImageFunction.h:45
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itkImageBase.h