ITK  5.1.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_ASSIGN(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 * GlobalData) const override;
151 
153  void
154  InitializeIteration() override;
155 
158  PixelType
159  ComputeUpdate(const NeighborhoodType & neighborhood,
160  void * globalData,
161  const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
162 
166  virtual double
167  GetMetric() const
168  {
169  return m_Metric;
170  }
171 
173  virtual double
174  GetRMSChange() const
175  {
176  return m_RMSChange;
177  }
178 
185  virtual void
186  SetAlpha(double);
187 
188  virtual double
189  GetAlpha() const;
190 
195  virtual void
196  SetIntensityDifferenceThreshold(double);
197 
198  virtual double
199  GetIntensityDifferenceThreshold() const;
200 
203  virtual void
204  SetGradientMagnitudeThreshold(double);
205 
206  virtual double
207  GetGradientMagnitudeThreshold() const;
208 
211  virtual void
212  SetGradientSmoothingStandardDeviations(double);
213 
214  virtual double
215  GetGradientSmoothingStandardDeviations() const;
216 
220  void
221  SetUseImageSpacing(bool);
222 
223  bool
224  GetUseImageSpacing() const;
225 
226 protected:
228  ~LevelSetMotionRegistrationFunction() override = default;
229  void
230  PrintSelf(std::ostream & os, Indent indent) const override;
231 
234 
238  {
242  double m_MaxL1Norm;
243  };
244 
245 private:
249 
252 
256 
259  double m_Alpha;
260 
263 
266 
269 
273  mutable double m_Metric;
274  mutable double m_SumOfSquaredDifference;
276  mutable double m_RMSChange;
277  mutable double m_SumOfSquaredChange;
278 
280  mutable std::mutex m_MetricCalculationLock;
281 
283 };
284 } // end namespace itk
285 
286 #ifndef ITK_MANUAL_INSTANTIATION
287 # include "itkLevelSetMotionRegistrationFunction.hxx"
288 #endif
289 
290 #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:275
itk::LevelSetMotionRegistrationFunction::m_SumOfSquaredDifference
double m_SumOfSquaredDifference
Definition: itkLevelSetMotionRegistrationFunction.h:274
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:259
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:268
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct
Definition: itkLevelSetMotionRegistrationFunction.h:237
itk::LevelSetMotionRegistrationFunction::m_SmoothMovingImageInterpolator
InterpolatorPointer m_SmoothMovingImageInterpolator
Definition: itkLevelSetMotionRegistrationFunction.h:255
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:240
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:248
itk::LevelSetMotionRegistrationFunction::m_MetricCalculationLock
std::mutex m_MetricCalculationLock
Definition: itkLevelSetMotionRegistrationFunction.h:280
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:167
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LevelSetMotionRegistrationFunction::GetRMSChange
virtual double GetRMSChange() const
Definition: itkLevelSetMotionRegistrationFunction.h:174
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:241
itk::LevelSetMotionRegistrationFunction::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkLevelSetMotionRegistrationFunction.h:103
itk::LevelSetMotionRegistrationFunction::m_MovingImageSmoothingFilter
MovingImageSmoothingFilterPointer m_MovingImageSmoothingFilter
Definition: itkLevelSetMotionRegistrationFunction.h:251
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:265
itk::LevelSetMotionRegistrationFunction::m_SumOfSquaredChange
double m_SumOfSquaredChange
Definition: itkLevelSetMotionRegistrationFunction.h:277
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:282
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: itkArray.h:26
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:50
itk::LevelSetMotionRegistrationFunction::m_Metric
double m_Metric
Definition: itkLevelSetMotionRegistrationFunction.h:273
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_SumOfSquaredDifference
double m_SumOfSquaredDifference
Definition: itkLevelSetMotionRegistrationFunction.h:239
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:262
itk::LevelSetMotionRegistrationFunction::GlobalDataStruct::m_MaxL1Norm
double m_MaxL1Norm
Definition: itkLevelSetMotionRegistrationFunction.h:242
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:247
itk::LevelSetMotionRegistrationFunction::m_MovingImageInterpolator
InterpolatorPointer m_MovingImageInterpolator
Definition: itkLevelSetMotionRegistrationFunction.h:254
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:276
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