ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetMotionRegistrationFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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,
57  TMovingImage,
58  TDisplacementField >
59 {
60 public:
61  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetMotionRegistrationFunction);
62 
65  using Superclass = PDEDeformableRegistrationFunction< TFixedImage,
66  TMovingImage, TDisplacementField >;
67 
70 
72  itkNewMacro(Self);
73 
77 
79  using MovingImageType = typename Superclass::MovingImageType;
80  using MovingImagePointer = typename Superclass::MovingImagePointer;
81  using MovingSpacingType = typename MovingImageType::SpacingType;
82 
84  using FixedImageType = typename Superclass::FixedImageType;
85  using FixedImagePointer = typename Superclass::FixedImagePointer;
88  using SpacingType = typename FixedImageType::SpacingType;
89 
91  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
92  using DisplacementFieldTypePointer = typename Superclass::DisplacementFieldTypePointer;
93 
95  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
96 
98  using PixelType = typename Superclass::PixelType;
103 
105  using CoordRepType = double;
111 
114  using CovariantVectorType =
116 
120 
123  { m_MovingImageInterpolator = ptr; }
124 
127  { return m_MovingImageInterpolator; }
128 
131  TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override;
132 
135  void * GetGlobalDataPointer() const override
136  {
137  auto * global = new GlobalDataStruct();
138 
139  global->m_SumOfSquaredDifference = 0.0;
140  global->m_NumberOfPixelsProcessed = 0L;
141  global->m_SumOfSquaredChange = 0;
142  global->m_MaxL1Norm = NumericTraits< double >::NonpositiveMin();
143  return global;
144  }
145 
147  void ReleaseGlobalDataPointer(void *GlobalData) const override;
148 
150  void InitializeIteration() override;
151 
154  PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
155  void *globalData,
156  const FloatOffsetType & offset =
157  FloatOffsetType(0.0) ) override;
158 
162  virtual double GetMetric() const
163  { return m_Metric; }
164 
166  virtual double GetRMSChange() const
167  { return m_RMSChange; }
168 
175  virtual void SetAlpha(double);
176 
177  virtual double GetAlpha() const;
178 
183  virtual void SetIntensityDifferenceThreshold(double);
184 
185  virtual double GetIntensityDifferenceThreshold() const;
186 
189  virtual void SetGradientMagnitudeThreshold(double);
190 
191  virtual double GetGradientMagnitudeThreshold() const;
192 
195  virtual void SetGradientSmoothingStandardDeviations(double);
196 
197  virtual double GetGradientSmoothingStandardDeviations() const;
198 
202  void SetUseImageSpacing(bool);
203 
204  bool GetUseImageSpacing() const;
205 
206 protected:
208  ~LevelSetMotionRegistrationFunction() override = default;
209  void PrintSelf(std::ostream & os, Indent indent) const override;
210 
213 
220  double m_MaxL1Norm;
221  };
222 
223 private:
227 
230 
234 
237  double m_Alpha;
238 
241 
244 
247 
251  mutable double m_Metric;
252  mutable double m_SumOfSquaredDifference;
254  mutable double m_RMSChange;
255  mutable double m_SumOfSquaredChange;
256 
258  mutable std::mutex m_MetricCalculationLock;
259 
261 };
262 } // end namespace itk
263 
264 #ifndef ITK_MANUAL_INSTANTIATION
265 #include "itkLevelSetMotionRegistrationFunction.hxx"
266 #endif
267 
268 #endif
Light weight base class for most itk classes.
Define numeric traits for std::vector.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename DisplacementFieldType::Pointer DisplacementFieldTypePointer
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename MovingImageSmoothingFilterType::Pointer MovingImageSmoothingFilterPointer
typename ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
typename MovingImageType::ConstPointer MovingImagePointer
Linearly interpolate an image at specified positions.
Base class for all image interpolaters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename MovingImageType::SpacingType MovingSpacingType
typename FixedImageType::ConstPointer FixedImagePointer
A templated class holding a n-Dimensional covariant vector.