ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkESMDemonsRegistrationFunction.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 itkESMDemonsRegistrationFunction_h
19#define itkESMDemonsRegistrationFunction_h
20
23#include "itkWarpImageFilter.h"
24#include "ITKPDEDeformableRegistrationExport.h"
25#include <mutex>
26
27namespace itk
28{
34{
35public:
40 enum class Gradient : uint8_t
41 {
43 Fixed = 1,
46 };
47};
48// Define how to print enumeration
49extern ITKPDEDeformableRegistration_EXPORT std::ostream &
50operator<<(std::ostream & out, const ESMDemonsRegistrationFunctionEnums::Gradient value);
83template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
84class ITK_TEMPLATE_EXPORT ESMDemonsRegistrationFunction
85 : public PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
86{
87public:
88 ITK_DISALLOW_COPY_AND_MOVE(ESMDemonsRegistrationFunction);
89
93
96
98 itkNewMacro(Self);
99
101 itkOverrideGetNameOfClassMacro(ESMDemonsRegistrationFunction);
102
104 using typename Superclass::MovingImageType;
105 using typename Superclass::MovingImagePointer;
106 using MovingPixelType = typename MovingImageType::PixelType;
107
109 using typename Superclass::FixedImageType;
110 using typename Superclass::FixedImagePointer;
111 using IndexType = typename FixedImageType::IndexType;
112 using SizeType = typename FixedImageType::SizeType;
113 using SpacingType = typename FixedImageType::SpacingType;
114 using DirectionType = typename FixedImageType::DirectionType;
115
119
121 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
122
124 using typename Superclass::PixelType;
125 using typename Superclass::RadiusType;
126 using typename Superclass::NeighborhoodType;
127 using typename Superclass::FloatOffsetType;
128 using typename Superclass::TimeStepType;
129
131 using CoordinateType = double;
132#ifndef ITK_FUTURE_LEGACY_REMOVE
133 using CoordRepType ITK_FUTURE_DEPRECATED(
134 "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
135#endif
140
143
145
148
152
156
158 void
160 {
162 m_MovingImageWarper->SetInterpolator(ptr);
163 }
164
165
167 InterpolatorType *
172
174 TimeStepType
175 ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
176 {
177 return m_TimeStep;
178 }
179
182 void *
183 GetGlobalDataPointer() const override
184 {
185 auto * global = new GlobalDataStruct();
186
187 global->m_SumOfSquaredDifference = 0.0;
188 global->m_NumberOfPixelsProcessed = 0L;
189 global->m_SumOfSquaredChange = 0;
190 return global;
191 }
192
194 void
195 ReleaseGlobalDataPointer(void * gd) const override;
196
198 void
200
204 ComputeUpdate(const NeighborhoodType & it, void * gd, const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
205
209 virtual double
210 GetMetric() const
211 {
212 return m_Metric;
213 }
214
216 virtual const double &
218 {
219 return m_RMSChange;
220 }
221
226 virtual void
228
229 virtual double
231
235 virtual void
237 {
238 this->m_MaximumUpdateStepLength = sm;
239 }
240
241 virtual double
243 {
244 return this->m_MaximumUpdateStepLength;
245 }
246
248#if !defined(ITK_LEGACY_REMOVE)
250 static constexpr GradientEnum Symmetric = GradientEnum::Symmetric;
251 static constexpr GradientEnum Fixed = GradientEnum::Fixed;
252 static constexpr GradientEnum WarpedMoving = GradientEnum::WarpedMoving;
253 static constexpr GradientEnum MappedMoving = GradientEnum::MappedMoving;
254#endif
255
257 virtual void
259 {
260 m_UseGradientType = gtype;
261 }
262 virtual GradientEnum
264 {
265 return m_UseGradientType;
266 }
267
268
269protected:
271 ~ESMDemonsRegistrationFunction() override = default;
272 void
273 PrintSelf(std::ostream & os, Indent indent) const override;
274
277
286
287private:
292 double m_Normalizer{};
293
296
299
301
304
307
309
312
315
318
321
325 mutable double m_Metric{};
326 mutable double m_SumOfSquaredDifference{};
328 mutable double m_RMSChange{};
329 mutable double m_SumOfSquaredChange{};
330
332 mutable std::mutex m_MetricCalculationMutex{};
333};
334} // end namespace itk
335
336#ifndef ITK_MANUAL_INSTANTIATION
337# include "itkESMDemonsRegistrationFunction.hxx"
338#endif
339
340#endif
Calculate the derivative by central differencing.
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
A templated class holding a n-Dimensional covariant vector.
Contains all enum classes used by ESMDemonsRegistrationFunction class.
WarpImageFilter< MovingImageType, MovingImageType, DisplacementFieldType > WarperType
TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override
~ESMDemonsRegistrationFunction() override=default
virtual double GetIntensityDifferenceThreshold() const
virtual void SetUseGradientType(GradientEnum gtype)
CentralDifferenceImageFunction< MovingImageType, CoordinateType > MovingImageGradientCalculatorType
PDEDeformableRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > Superclass
void ReleaseGlobalDataPointer(void *gd) const override
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetIntensityDifferenceThreshold(double)
PixelType ComputeUpdate(const NeighborhoodType &it, void *gd, const FloatOffsetType &offset=FloatOffsetType(0.0)) override
ConstNeighborhoodIterator< TImageType, DefaultBoundaryConditionType > NeighborhoodType
static constexpr unsigned int ImageDimension
Vector< float, Self::ImageDimension > FloatOffsetType
typename ImageType::PixelType PixelType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Control indentation during Print() invocation.
Definition itkIndent.h:50
Base class for all image interpolators.
Point< CoordinateType, Self::ImageDimension > PointType
Linearly interpolate an image at specified positions.
Implements transparent reference counting.
Warps an image using an input displacement field.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)