ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkGPUDemonsRegistrationFunction.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 itkGPUDemonsRegistrationFunction_h
19#define itkGPUDemonsRegistrationFunction_h
20
22#include "itkPoint.h"
25#include "itkGPUReduction.h"
26
27namespace itk
28{
53
55itkGPUKernelClassMacro(GPUDemonsRegistrationFunctionKernel);
56
57template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
58class ITK_TEMPLATE_EXPORT GPUDemonsRegistrationFunction
59 : public GPUPDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
60{
61public:
62 ITK_DISALLOW_COPY_AND_MOVE(GPUDemonsRegistrationFunction);
63
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(GPUDemonsRegistrationFunction);
75
77 using typename Superclass::MovingImageType;
78 using typename Superclass::MovingImagePointer;
79
81 using typename Superclass::FixedImageType;
82 using typename Superclass::FixedImagePointer;
83 using IndexType = typename FixedImageType::IndexType;
84 using SizeType = typename FixedImageType::SizeType;
85 using SpacingType = typename FixedImageType::SpacingType;
86
90
92 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
93
95 using typename Superclass::PixelType;
96 using typename Superclass::RadiusType;
97 using typename Superclass::NeighborhoodType;
98 using typename Superclass::FloatOffsetType;
99 using typename Superclass::TimeStepType;
100
102 using CoordinateType = double;
103#ifndef ITK_FUTURE_LEGACY_REMOVE
104 using CoordRepType ITK_FUTURE_DEPRECATED(
105 "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
106#endif
111
114
118
122
125
127 itkGetOpenCLSourceFromKernelMacro(GPUDemonsRegistrationFunctionKernel);
128
130 void
135
137 InterpolatorType *
142
144 TimeStepType
145 ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
146 {
147 return m_TimeStep;
148 }
149
152 void *
153 GetGlobalDataPointer() const override
154 {
155 auto * global = new GlobalDataStruct();
156
157 global->m_SumOfSquaredDifference = 0.0;
158 global->m_NumberOfPixelsProcessed = 0L;
159 global->m_SumOfSquaredChange = 0;
160 return global;
161 }
162
167 void
168 ReleaseGlobalDataPointer(void * GlobalData) const override;
169
172 void
173 GPUAllocateMetricData(unsigned int numPixels) override;
174
176 void
178
180 void
182
188 ComputeUpdate(const NeighborhoodType & neighborhood,
189 void * globalData,
190 const FloatOffsetType & offset = FloatOffsetType(0.0)) override;
191
193 void
195
201 virtual double
202 GetMetric() const
203 {
204 return m_Metric;
205 }
206
208 virtual double
210 {
211 return m_RMSChange;
212 }
213
217 virtual void
219 {
221 }
222 virtual bool
227
228
233 virtual void
235
236 virtual double
238
239protected:
241 ~GPUDemonsRegistrationFunction() override = default;
242
243 void
244 PrintSelf(std::ostream & os, Indent indent) const override;
245
248
257
258 /* GPU kernel handle for GPUComputeUpdate */
260
261private:
263 // SpacingType m_FixedImageSpacing;
264 // PointType m_FixedImageOrigin;
266 double m_Normalizer{};
267
270
274
277
280
283
286
290 mutable double m_Metric{};
291 mutable double m_SumOfSquaredDifference{};
293 mutable double m_RMSChange{};
294 mutable double m_SumOfSquaredChange{};
295
299
301 mutable std::mutex m_MetricCalculationMutex{};
302};
303} // end namespace itk
304
305#ifndef ITK_MANUAL_INSTANTIATION
306# include "itkGPUDemonsRegistrationFunction.hxx"
307#endif
308
309#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.
ConstNeighborhoodIterator< TImageType, DefaultBoundaryConditionType > NeighborhoodType
static constexpr unsigned int ImageDimension
Vector< float, Self::ImageDimension > FloatOffsetType
typename ImageType::PixelType PixelType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
SmartPointer< Self > Pointer
void PrintSelf(std::ostream &os, Indent indent) const override
PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0)) override
void GPUAllocateMetricData(unsigned int numPixels) override
void ReleaseGlobalDataPointer(void *GlobalData) const override
itkGetOpenCLSourceFromKernelMacro(GPUDemonsRegistrationFunctionKernel)
void GPUComputeUpdate(const DisplacementFieldTypePointer output, DisplacementFieldTypePointer update, void *gd) override
CentralDifferenceImageFunction< MovingImageType, CoordinateType > MovingImageGradientCalculatorType
~GPUDemonsRegistrationFunction() override=default
TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override
virtual void SetIntensityDifferenceThreshold(double)
virtual double GetIntensityDifferenceThreshold() const
GPUPDEDeformableRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > Superclass
ConstNeighborhoodIterator< TImageType, DefaultBoundaryConditionType > NeighborhoodType
Vector< float, Self::ImageDimension > FloatOffsetType
typename ImageType::PixelType PixelType
SmartPointer< Self > Pointer
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.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86
itkGPUKernelClassMacro(GPUImageOpsKernel)