ITK  5.4.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 * 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 itkLevelSetMotionRegistrationFunction_h
19#define itkLevelSetMotionRegistrationFunction_h
20
22#include "itkPoint.h"
23#include "itkCovariantVector.h"
26#include <mutex>
27
28namespace itk
29{
54template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
55class ITK_TEMPLATE_EXPORT LevelSetMotionRegistrationFunction
56 : public PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
57{
58public:
59 ITK_DISALLOW_COPY_AND_MOVE(LevelSetMotionRegistrationFunction);
60
64
67
69 itkNewMacro(Self);
70
72 itkOverrideGetNameOfClassMacro(LevelSetMotionRegistrationFunction);
73
75 using typename Superclass::MovingImageType;
76 using typename Superclass::MovingImagePointer;
77 using MovingSpacingType = typename MovingImageType::SpacingType;
78
80 using typename Superclass::FixedImageType;
81 using typename Superclass::FixedImagePointer;
84 using SpacingType = typename FixedImageType::SpacingType;
85
87 using typename Superclass::DisplacementFieldType;
88 using typename Superclass::DisplacementFieldTypePointer;
89
91 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
92
94 using typename Superclass::PixelType;
95 using typename Superclass::RadiusType;
96 using typename Superclass::NeighborhoodType;
97 using typename Superclass::FloatOffsetType;
98 using typename Superclass::TimeStepType;
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
133 TimeStepType
134 ComputeGlobalTimeStep(void * GlobalData) const override;
135
138 void *
139 GetGlobalDataPointer() const override
140 {
141 auto * global = new GlobalDataStruct();
142
143 global->m_SumOfSquaredDifference = 0.0;
144 global->m_NumberOfPixelsProcessed = 0L;
145 global->m_SumOfSquaredChange = 0;
146 global->m_MaxL1Norm = NumericTraits<double>::NonpositiveMin();
147 return global;
148 }
149
154 void
155 ReleaseGlobalDataPointer(void * gd) const override;
156
158 void
160
166 ComputeUpdate(const NeighborhoodType & it, void * gd, const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
167
171 virtual double
172 GetMetric() const
173 {
174 return m_Metric;
175 }
176
178 virtual double
180 {
181 return m_RMSChange;
182 }
183
190 virtual void
191 SetAlpha(double);
192
193 virtual double
194 GetAlpha() const;
195
200 virtual void
202
203 virtual double
205
208 virtual void
210
211 virtual double
213
216 virtual void
218
219 virtual double
221
225 void
227
228 bool
230
231protected:
234 void
235 PrintSelf(std::ostream & os, Indent indent) const override;
236
239
243 {
248 };
249
250private:
252 SpacingType m_FixedImageSpacing{};
253 PointType m_FixedImageOrigin{};
254
256 MovingImageSmoothingFilterPointer m_MovingImageSmoothingFilter{};
257
259 InterpolatorPointer m_MovingImageInterpolator{};
260 InterpolatorPointer m_SmoothMovingImageInterpolator{};
261
264 double m_Alpha{};
265
267 double m_GradientMagnitudeThreshold{};
268
270 double m_IntensityDifferenceThreshold{};
271
273 double m_GradientSmoothingStandardDeviations{};
274
278 mutable double m_Metric{};
279 mutable double m_SumOfSquaredDifference{};
280 mutable SizeValueType m_NumberOfPixelsProcessed{};
281 mutable double m_RMSChange{};
282 mutable double m_SumOfSquaredChange{};
283
285 mutable std::mutex m_MetricCalculationMutex{};
286
287 bool m_UseImageSpacing{ true };
288};
289} // end namespace itk
290
291#ifndef ITK_MANUAL_INSTANTIATION
292# include "itkLevelSetMotionRegistrationFunction.hxx"
293#endif
294
295#endif
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
A templated class holding a n-Dimensional covariant vector.
typename ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for all image interpolators.
PixelType ComputeUpdate(const NeighborhoodType &it, void *gd, const FloatOffsetType &offset=FloatOffsetType(0.0)) override
void PrintSelf(std::ostream &os, Indent indent) const override
typename MovingImageSmoothingFilterType::Pointer MovingImageSmoothingFilterPointer
typename MovingImageType::SpacingType MovingSpacingType
void ReleaseGlobalDataPointer(void *gd) const override
virtual double GetGradientMagnitudeThreshold() const
virtual double GetGradientSmoothingStandardDeviations() const
virtual void SetIntensityDifferenceThreshold(double)
virtual void SetGradientSmoothingStandardDeviations(double)
virtual void SetGradientMagnitudeThreshold(double)
virtual double GetIntensityDifferenceThreshold() const
~LevelSetMotionRegistrationFunction() override=default
TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override
Light weight base class for most itk classes.
Linearly interpolate an image at specified positions.
static constexpr T NonpositiveMin()
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83