ITK  6.0.0
Insight Toolkit
itkMeanSquareRegistrationFunction.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 itkMeanSquareRegistrationFunction_h
19 #define itkMeanSquareRegistrationFunction_h
20 
22 #include "itkPoint.h"
25 
26 namespace itk
27 {
52 template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
53 class ITK_TEMPLATE_EXPORT MeanSquareRegistrationFunction
54  : public PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
55 {
56 public:
57  ITK_DISALLOW_COPY_AND_MOVE(MeanSquareRegistrationFunction);
58 
64 
66  itkNewMacro(Self);
67 
69  itkOverrideGetNameOfClassMacro(MeanSquareRegistrationFunction);
70 
72  using typename Superclass::MovingImageType;
73  using typename Superclass::MovingImagePointer;
74 
76  using typename Superclass::FixedImageType;
77  using typename Superclass::FixedImagePointer;
80  using SpacingType = typename FixedImageType::SpacingType;
81 
83  using typename Superclass::DisplacementFieldType;
84  using DisplacementFieldPixelType = typename DisplacementFieldType::PixelType;
86 
88  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
89 
91  using typename Superclass::PixelType;
92  using typename Superclass::RadiusType;
93  using typename Superclass::NeighborhoodType;
94  using typename Superclass::FloatOffsetType;
95  using typename Superclass::TimeStepType;
96 
98  using CoordinateType = double;
99 #ifndef ITK_FUTURE_LEGACY_REMOVE
100  using CoordRepType ITK_FUTURE_DEPRECATED(
101  "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
102 #endif
107 
110 
114 
116  void
118  {
119  m_MovingImageInterpolator = ptr;
120  }
121 
123  InterpolatorType *
125  {
126  return m_MovingImageInterpolator;
127  }
128 
130  TimeStepType
131  ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
132  {
133  return m_TimeStep;
134  }
135 
138  void *
139  GetGlobalDataPointer() const override
140  {
141  auto * global = new GlobalDataStruct();
142 
143  return global;
144  }
145 
147  void
148  ReleaseGlobalDataPointer(void * GlobalData) const override
149  {
150  delete (GlobalDataStruct *)GlobalData;
151  }
152 
154  void
155  InitializeIteration() override;
156 
161  PixelType
162  ComputeUpdate(const NeighborhoodType & neighborhood,
163  void * globalData,
164  const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
165 
166 protected:
168  ~MeanSquareRegistrationFunction() override = default;
169  void
170  PrintSelf(std::ostream & os, Indent indent) const override;
171 
174 
178  {
180  };
181 
182 private:
184  SpacingType m_FixedImageSpacing{};
185 
187  GradientCalculatorPointer m_FixedImageGradientCalculator{};
188 
190  InterpolatorPointer m_MovingImageInterpolator{};
191 
193  TimeStepType m_TimeStep{};
194 
196  double m_DenominatorThreshold{};
197 
199  double m_IntensityDifferenceThreshold{};
200 };
201 } // end namespace itk
202 
203 #ifndef ITK_MANUAL_INSTANTIATION
204 # include "itkMeanSquareRegistrationFunction.hxx"
205 #endif
206 
207 #endif
itk::MeanSquareRegistrationFunction::SizeType
typename FixedImageType::SizeType SizeType
Definition: itkMeanSquareRegistrationFunction.h:79
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::MeanSquareRegistrationFunction::DisplacementFieldPixelType
typename DisplacementFieldType::PixelType DisplacementFieldPixelType
Definition: itkMeanSquareRegistrationFunction.h:84
itk::FiniteDifferenceFunction< TDisplacementField >::RadiusType
typename ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::MeanSquareRegistrationFunction::ReleaseGlobalDataPointer
void ReleaseGlobalDataPointer(void *GlobalData) const override
Definition: itkMeanSquareRegistrationFunction.h:148
itk::MeanSquareRegistrationFunction::SpacingType
typename FixedImageType::SpacingType SpacingType
Definition: itkMeanSquareRegistrationFunction.h:80
itk::PDEDeformableRegistrationFunction::MovingImageType
TMovingImage MovingImageType
Definition: itkPDEDeformableRegistrationFunction.h:56
itk::MeanSquareRegistrationFunction::GlobalDataStruct
Definition: itkMeanSquareRegistrationFunction.h:177
itk::PDEDeformableRegistrationFunction::MovingImagePointer
typename MovingImageType::ConstPointer MovingImagePointer
Definition: itkPDEDeformableRegistrationFunction.h:57
itkLinearInterpolateImageFunction.h
itkPoint.h
itk::MeanSquareRegistrationFunction
Definition: itkMeanSquareRegistrationFunction.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkPDEDeformableRegistrationFunction.h
itk::CentralDifferenceImageFunction
Calculate the derivative by central differencing.
Definition: itkCentralDifferenceImageFunction.h:76
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::MeanSquareRegistrationFunction::PointType
typename InterpolatorType::PointType PointType
Definition: itkMeanSquareRegistrationFunction.h:105
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MeanSquareRegistrationFunction::SetMovingImageInterpolator
void SetMovingImageInterpolator(InterpolatorType *ptr)
Definition: itkMeanSquareRegistrationFunction.h:117
itk::MeanSquareRegistrationFunction::GlobalDataStruct::m_FixedImageIterator
FixedImageNeighborhoodIteratorType m_FixedImageIterator
Definition: itkMeanSquareRegistrationFunction.h:179
itk::MeanSquareRegistrationFunction::GradientCalculatorPointer
typename GradientCalculatorType::Pointer GradientCalculatorPointer
Definition: itkMeanSquareRegistrationFunction.h:113
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LinearInterpolateImageFunction
Linearly interpolate an image at specified positions.
Definition: itkLinearInterpolateImageFunction.h:51
itk::MeanSquareRegistrationFunction::IndexType
typename FixedImageType::IndexType IndexType
Definition: itkMeanSquareRegistrationFunction.h:78
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkCentralDifferenceImageFunction.h
itk::PDEDeformableRegistrationFunction::FixedImagePointer
typename FixedImageType::ConstPointer FixedImagePointer
Definition: itkPDEDeformableRegistrationFunction.h:61
itk::PDEDeformableRegistrationFunction
Definition: itkPDEDeformableRegistrationFunction.h:41
itk::FiniteDifferenceFunction< TDisplacementField >::PixelType
typename ImageType::PixelType PixelType
Definition: itkFiniteDifferenceFunction.h:83
itk::MeanSquareRegistrationFunction::GetMovingImageInterpolator
InterpolatorType * GetMovingImageInterpolator()
Definition: itkMeanSquareRegistrationFunction.h:124
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::PDEDeformableRegistrationFunction::DisplacementFieldTypePointer
typename DisplacementFieldType::Pointer DisplacementFieldTypePointer
Definition: itkPDEDeformableRegistrationFunction.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::PDEDeformableRegistrationFunction::FixedImageType
TFixedImage FixedImageType
Definition: itkPDEDeformableRegistrationFunction.h:60
itk::MeanSquareRegistrationFunction::ComputeGlobalTimeStep
TimeStepType ComputeGlobalTimeStep(void *) const override
Definition: itkMeanSquareRegistrationFunction.h:131
itk::MeanSquareRegistrationFunction::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkMeanSquareRegistrationFunction.h:104
itk::PDEDeformableRegistrationFunction::DisplacementFieldType
TDisplacementField DisplacementFieldType
Definition: itkPDEDeformableRegistrationFunction.h:64
itk::MeanSquareRegistrationFunction::GetGlobalDataPointer
void * GetGlobalDataPointer() const override
Definition: itkMeanSquareRegistrationFunction.h:139
itk::MeanSquareRegistrationFunction::CoordinateType
double CoordinateType
Definition: itkMeanSquareRegistrationFunction.h:98
itk::InterpolateImageFunction
Base class for all image interpolators.
Definition: itkInterpolateImageFunction.h:45
itk::FiniteDifferenceFunction< TDisplacementField >::TimeStepType
double TimeStepType
Definition: itkFiniteDifferenceFunction.h:90