ITK  5.3.0
Insight Toolkit
itkLevelSetMotionRegistrationFunction.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 itkLevelSetMotionRegistrationFunction_h
19 #define itkLevelSetMotionRegistrationFunction_h
20 
22 #include "itkPoint.h"
23 #include "itkCovariantVector.h"
26 #include <mutex>
27 
28 namespace itk
29 {
54 template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
55 class ITK_TEMPLATE_EXPORT LevelSetMotionRegistrationFunction
56  : public PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_MOVE(LevelSetMotionRegistrationFunction);
60 
64 
67 
69  itkNewMacro(Self);
70 
73 
75  using MovingImageType = typename Superclass::MovingImageType;
76  using MovingImagePointer = typename Superclass::MovingImagePointer;
77  using MovingSpacingType = typename MovingImageType::SpacingType;
78 
80  using FixedImageType = typename Superclass::FixedImageType;
81  using FixedImagePointer = typename Superclass::FixedImagePointer;
84  using SpacingType = typename FixedImageType::SpacingType;
85 
87  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
88  using DisplacementFieldTypePointer = typename Superclass::DisplacementFieldTypePointer;
89 
91  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
92 
94  using PixelType = typename Superclass::PixelType;
99 
101  using CoordRepType = double;
106 
110 
114 
116  void
118  {
119  m_MovingImageInterpolator = ptr;
120  }
121 
123  InterpolatorType *
125  {
126  return m_MovingImageInterpolator;
127  }
128 
131  TimeStepType
132  ComputeGlobalTimeStep(void * GlobalData) const override;
133 
136  void *
137  GetGlobalDataPointer() const override
138  {
139  auto * global = new GlobalDataStruct();
140 
141  global->m_SumOfSquaredDifference = 0.0;
142  global->m_NumberOfPixelsProcessed = 0L;
143  global->m_SumOfSquaredChange = 0;
144  global->m_MaxL1Norm = NumericTraits<double>::NonpositiveMin();
145  return global;
146  }
147 
149  void
150  ReleaseGlobalDataPointer(void * gd) const override;
151 
153  void
154  InitializeIteration() override;
155 
158  PixelType
159  ComputeUpdate(const NeighborhoodType & it, void * gd, const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
160 
164  virtual double
165  GetMetric() const
166  {
167  return m_Metric;
168  }
169 
171  virtual double
172  GetRMSChange() const
173  {
174  return m_RMSChange;
175  }
176 
183  virtual void
184  SetAlpha(double);
185 
186  virtual double
187  GetAlpha() const;
188 
193  virtual void
194  SetIntensityDifferenceThreshold(double);
195 
196  virtual double
197  GetIntensityDifferenceThreshold() const;
198 
201  virtual void
202  SetGradientMagnitudeThreshold(double);
203 
204  virtual double
205  GetGradientMagnitudeThreshold() const;
206 
209  virtual void
210  SetGradientSmoothingStandardDeviations(double);
211 
212  virtual double
213  GetGradientSmoothingStandardDeviations() const;
214 
218  void
219  SetUseImageSpacing(bool);
220 
221  bool
222  GetUseImageSpacing() const;
223 
224 protected:
226  ~LevelSetMotionRegistrationFunction() override = default;
227  void
228  PrintSelf(std::ostream & os, Indent indent) const override;
229 
232 
236  {
240  double m_MaxL1Norm;
241  };
242 
243 private:
247 
250 
254 
257  double m_Alpha;
258 
261 
264 
267 
271  mutable double m_Metric;
272  mutable double m_SumOfSquaredDifference;
274  mutable double m_RMSChange;
275  mutable double m_SumOfSquaredChange;
276 
278  mutable std::mutex m_MetricCalculationLock;
279 
281 };
282 } // end namespace itk
283 
284 #ifndef ITK_MANUAL_INSTANTIATION
285 # include "itkLevelSetMotionRegistrationFunction.hxx"
286 #endif
287 
288 #endif
itk::LevelSetMotionRegistrationFunction::FloatOffsetType
typename Superclass::FloatOffsetType FloatOffsetType
Definition: itkLevelSetMotionRegistrationFunction.h:97
itk::FiniteDifferenceFunction< TDisplacementField >::RadiusType
typename ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::LevelSetMotionRegistrationFunction::SpacingType
typename FixedImageType::SpacingType SpacingType
Definition: itkLevelSetMotionRegistrationFunction.h:84
itkCovariantVector.h
itk::PDEDeformableRegistrationFunction::MovingImageType
TMovingImage MovingImageType
Definition: itkPDEDeformableRegistrationFunction.h:56
itk::LevelSetMotionRegistrationFunction::m_NumberOfPixelsProcessed
SizeValueType m_NumberOfPixelsProcessed
Definition: itkLevelSetMotionRegistrationFunction.h:273
itk::LevelSetMotionRegistrationFunction::m_SumOfSquaredDifference
double m_SumOfSquaredDifference
Definition: itkLevelSetMotionRegistrationFunction.h:272
itk::PDEDeformableRegistrationFunction::MovingImagePointer
typename MovingImageType::ConstPointer MovingImagePointer
Definition: itkPDEDeformableRegistrationFunction.h:57
itkLinearInterpolateImageFunction.h
itk::LevelSetMotionRegistrationFunction::RadiusType
typename Superclass::RadiusType RadiusType
Definition: itkLevelSetMotionRegistrationFunction.h:95
itk::LevelSetMotionRegistrationFunction::NeighborhoodType
typename Superclass::NeighborhoodType NeighborhoodType
Definition: itkLevelSetMotionRegistrationFunction.h:96
itkSmoothingRecursiveGaussianImageFilter.h
itk::LevelSetMotionRegistrationFunction::IndexType
typename FixedImageType::IndexType IndexType
Definition: itkLevelSetMotionRegistrationFunction.h:82
itkPoint.h
itk::LevelSetMotionRegistrationFunction::SetMovingImageInterpolator
void SetMovingImageInterpolator(InterpolatorType *ptr)
Definition: itkLevelSetMotionRegistrationFunction.h:117
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:97
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::LevelSetMotionRegistrationFunction::m_Alpha
double m_Alpha
Definition: itkLevelSetMotionRegistrationFunction.h:257
itkPDEDeformableRegistrationFunction.h
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::LevelSetMotionRegistrationFunction::m_GradientSmoothingStandardDeviations
double m_GradientSmoothingStandardDeviations
Definition: itkLevelSetMotionRegistrationFunction.h:266
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct
Definition: itkLevelSetMotionRegistrationFunction.h:235
itk::LevelSetMotionRegistrationFunction::m_SmoothMovingImageInterpolator
InterpolatorPointer m_SmoothMovingImageInterpolator
Definition: itkLevelSetMotionRegistrationFunction.h:253
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_NumberOfPixelsProcessed
SizeValueType m_NumberOfPixelsProcessed
Definition: itkLevelSetMotionRegistrationFunction.h:238
itk::LevelSetMotionRegistrationFunction::CoordRepType
double CoordRepType
Definition: itkLevelSetMotionRegistrationFunction.h:101
itk::LevelSetMotionRegistrationFunction::PointType
typename InterpolatorType::PointType PointType
Definition: itkLevelSetMotionRegistrationFunction.h:104
itk::LevelSetMotionRegistrationFunction::m_FixedImageOrigin
PointType m_FixedImageOrigin
Definition: itkLevelSetMotionRegistrationFunction.h:246
itk::LevelSetMotionRegistrationFunction::m_MetricCalculationLock
std::mutex m_MetricCalculationLock
Definition: itkLevelSetMotionRegistrationFunction.h:278
itk::LevelSetMotionRegistrationFunction::TimeStepType
typename Superclass::TimeStepType TimeStepType
Definition: itkLevelSetMotionRegistrationFunction.h:98
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LinearInterpolateImageFunction
Linearly interpolate an image at specified positions.
Definition: itkLinearInterpolateImageFunction.h:50
itk::LevelSetMotionRegistrationFunction::GetMetric
virtual double GetMetric() const
Definition: itkLevelSetMotionRegistrationFunction.h:165
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LevelSetMotionRegistrationFunction::GetRMSChange
virtual double GetRMSChange() const
Definition: itkLevelSetMotionRegistrationFunction.h:172
itk::PDEDeformableRegistrationFunction::FixedImagePointer
typename FixedImageType::ConstPointer FixedImagePointer
Definition: itkPDEDeformableRegistrationFunction.h:61
itk::LevelSetMotionRegistrationFunction::GetMovingImageInterpolator
InterpolatorType * GetMovingImageInterpolator()
Definition: itkLevelSetMotionRegistrationFunction.h:124
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_SumOfSquaredChange
double m_SumOfSquaredChange
Definition: itkLevelSetMotionRegistrationFunction.h:239
itk::LevelSetMotionRegistrationFunction::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkLevelSetMotionRegistrationFunction.h:103
itk::LevelSetMotionRegistrationFunction::m_MovingImageSmoothingFilter
MovingImageSmoothingFilterPointer m_MovingImageSmoothingFilter
Definition: itkLevelSetMotionRegistrationFunction.h:249
itk::LevelSetMotionRegistrationFunction::GetGlobalDataPointer
void * GetGlobalDataPointer() const override
Definition: itkLevelSetMotionRegistrationFunction.h:137
itk::PDEDeformableRegistrationFunction
Definition: itkPDEDeformableRegistrationFunction.h:41
itk::FiniteDifferenceFunction< TDisplacementField >::PixelType
typename ImageType::PixelType PixelType
Definition: itkFiniteDifferenceFunction.h:83
itk::LevelSetMotionRegistrationFunction::m_IntensityDifferenceThreshold
double m_IntensityDifferenceThreshold
Definition: itkLevelSetMotionRegistrationFunction.h:263
itk::LevelSetMotionRegistrationFunction::m_SumOfSquaredChange
double m_SumOfSquaredChange
Definition: itkLevelSetMotionRegistrationFunction.h:275
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::LevelSetMotionRegistrationFunction::m_UseImageSpacing
bool m_UseImageSpacing
Definition: itkLevelSetMotionRegistrationFunction.h:280
itk::LevelSetMotionRegistrationFunction::MovingSpacingType
typename MovingImageType::SpacingType MovingSpacingType
Definition: itkLevelSetMotionRegistrationFunction.h:77
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: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::LevelSetMotionRegistrationFunction::m_Metric
double m_Metric
Definition: itkLevelSetMotionRegistrationFunction.h:271
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_SumOfSquaredDifference
double m_SumOfSquaredDifference
Definition: itkLevelSetMotionRegistrationFunction.h:237
itk::LevelSetMotionRegistrationFunction::PixelType
typename Superclass::PixelType PixelType
Definition: itkLevelSetMotionRegistrationFunction.h:94
itk::PDEDeformableRegistrationFunction::FixedImageType
TFixedImage FixedImageType
Definition: itkPDEDeformableRegistrationFunction.h:60
itk::LevelSetMotionRegistrationFunction::SizeType
typename FixedImageType::SizeType SizeType
Definition: itkLevelSetMotionRegistrationFunction.h:83
itk::LevelSetMotionRegistrationFunction::m_GradientMagnitudeThreshold
double m_GradientMagnitudeThreshold
Definition: itkLevelSetMotionRegistrationFunction.h:260
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_MaxL1Norm
double m_MaxL1Norm
Definition: itkLevelSetMotionRegistrationFunction.h:240
itk::LevelSetMotionRegistrationFunction
Definition: itkLevelSetMotionRegistrationFunction.h:55
itk::FiniteDifferenceFunction< TDisplacementField >
itk::PDEDeformableRegistrationFunction::DisplacementFieldType
TDisplacementField DisplacementFieldType
Definition: itkPDEDeformableRegistrationFunction.h:64
itk::LevelSetMotionRegistrationFunction::m_FixedImageSpacing
SpacingType m_FixedImageSpacing
Definition: itkLevelSetMotionRegistrationFunction.h:245
itk::LevelSetMotionRegistrationFunction::m_MovingImageInterpolator
InterpolatorPointer m_MovingImageInterpolator
Definition: itkLevelSetMotionRegistrationFunction.h:252
itk::LevelSetMotionRegistrationFunction::MovingImageSmoothingFilterPointer
typename MovingImageSmoothingFilterType::Pointer MovingImageSmoothingFilterPointer
Definition: itkLevelSetMotionRegistrationFunction.h:113
itk::InterpolateImageFunction
Base class for all image interpolators.
Definition: itkInterpolateImageFunction.h:45
itk::LevelSetMotionRegistrationFunction::m_RMSChange
double m_RMSChange
Definition: itkLevelSetMotionRegistrationFunction.h:274
itk::SmoothingRecursiveGaussianImageFilter
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
Definition: itkSmoothingRecursiveGaussianImageFilter.h:50
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::FiniteDifferenceFunction< TDisplacementField >::TimeStepType
double TimeStepType
Definition: itkFiniteDifferenceFunction.h:90