ITK  5.2.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  * 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 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_ASSIGN(PointSetToImageMetric);
52 
58 
60  using CoordinateRepresentationType = Superclass::ParametersValueType;
61 
64 
66  using MovingImageType = TMovingImage;
67  using MovingImagePixelType = typename TMovingImage::PixelType;
68  using MovingImageConstPointer = typename MovingImageType::ConstPointer;
69 
71  using FixedPointSetType = TFixedPointSet;
72  using FixedPointSetConstPointer = typename FixedPointSetType::ConstPointer;
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);
118 
120  itkSetConstObjectMacro(MovingImage, MovingImageType);
121  itkGetConstObjectMacro(MovingImage, MovingImageType);
123 
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);
156 
158  unsigned int
159  GetNumberOfParameters() const override
160  {
161  return m_Transform->GetNumberOfParameters();
162  }
163 
166  virtual void
167  Initialize();
168 
169 protected:
171  ~PointSetToImageMetric() override = default;
172  void
173  PrintSelf(std::ostream & os, Indent indent) const override;
174 
176 
178 
180 
182 
184 
186 
188 };
189 } // end namespace itk
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 # include "itkPointSetToImageMetric.hxx"
193 #endif
194 
195 #endif
itk::PointSetToImageMetric::CoordinateRepresentationType
Superclass::ParametersValueType CoordinateRepresentationType
Definition: itkPointSetToImageMetric.h:60
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::OptimizerParameters< TInternalComputationValueType >
itk::PointSetToImageMetric::m_ComputeGradient
bool m_ComputeGradient
Definition: itkPointSetToImageMetric.h:185
itk::PointSetToImageMetric::MovingImageConstPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Definition: itkPointSetToImageMetric.h:68
itk::PointSetToImageMetric::m_Transform
TransformPointer m_Transform
Definition: itkPointSetToImageMetric.h:181
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::m_GradientImage
GradientImagePointer m_GradientImage
Definition: itkPointSetToImageMetric.h:187
itk::PointSetToImageMetric::m_NumberOfPixelsCounted
SizeValueType m_NumberOfPixelsCounted
Definition: itkPointSetToImageMetric.h:175
itk::PointSetToImageMetric::m_FixedPointSet
FixedPointSetConstPointer m_FixedPointSet
Definition: itkPointSetToImageMetric.h:177
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:59
itk::PointSetToImageMetric::PointDataIterator
typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
Definition: itkPointSetToImageMetric.h:79
itkMacro.h
itk::PointSetToImageMetric::m_Interpolator
InterpolatorPointer m_Interpolator
Definition: itkPointSetToImageMetric.h:183
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::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::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:86
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itkTransform.h
itkInterpolateImageFunction.h
itk::Array2D
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
itkSingleValuedCostFunction.h
itk::PointSetToImageMetric::TransformParametersType
typename TransformType::ParametersType TransformParametersType
Definition: itkPointSetToImageMetric.h:88
itk::PointSetToImageMetric::m_MovingImage
MovingImageConstPointer m_MovingImage
Definition: itkPointSetToImageMetric.h:179
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