ITK  5.4.0
Insight Toolkit
itkGPUDemonsRegistrationFilter.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 itkGPUDemonsRegistrationFilter_h
19#define itkGPUDemonsRegistrationFilter_h
20
21#include "itkOpenCLUtil.h"
25#include "itkVersion.h"
27
28namespace itk
29{
67template <typename TFixedImage,
68 typename TMovingImage,
69 typename TDisplacementField,
71class ITK_TEMPLATE_EXPORT GPUDemonsRegistrationFilter
72 : public GPUPDEDeformableRegistrationFilter<TFixedImage, TMovingImage, TDisplacementField, TParentImageFilter>
73{
74public:
75 ITK_DISALLOW_COPY_AND_MOVE(GPUDemonsRegistrationFilter);
76
81 using CPUSuperclass = TParentImageFilter;
84
86 itkNewMacro(Self);
87
89 itkOverrideGetNameOfClassMacro(GPUDemonsRegistrationFilter);
90
93
97
101
105
108
112
118 double
119 GetMetric() const override;
120
125 void
127
128 double
130
131protected:
133 ~GPUDemonsRegistrationFilter() override = default;
134
135 void
136 PrintSelf(std::ostream & os, Indent indent) const override;
137
139 void
141
143 void
144 ApplyUpdate(const TimeStepType & dt) override;
145
146private:
147 bool m_UseMovingImageGradient{};
148};
149
156{
157public:
158 ITK_DISALLOW_COPY_AND_MOVE(GPUDemonsRegistrationFilterFactory);
159
164
166 const char *
167 GetITKSourceVersion() const override
168 {
169 return ITK_SOURCE_VERSION;
170 }
171 const char *
172 GetDescription() const override
173 {
174 return "A Factory for GPUDemonsRegistrationFilter";
175 }
179 itkFactorylessNewMacro(Self);
180
182 itkOverrideGetNameOfClassMacro(GPUDemonsRegistrationFilterFactory);
183
185 static void
187 {
189
191 }
192
193private:
194#define OverrideDemonsRegistrationFilterTypeMacro(ipt, opt, dm) \
195 { \
196 using InputImageType = GPUImage<ipt, dm>; \
197 using OutputImageType = GPUImage<opt, dm>; \
198 using VectorPixelType = Vector<float, dm>; \
199 using DisplacementFieldType = GPUImage<VectorPixelType, dm>; \
200 this->RegisterOverride( \
201 typeid(DemonsRegistrationFilter<InputImageType, OutputImageType, DisplacementFieldType>).name(), \
202 typeid(GPUDemonsRegistrationFilter<InputImageType, OutputImageType, DisplacementFieldType>).name(), \
203 "GPU Demons Registration Filter Override", \
204 true, \
205 CreateObjectFunction< \
206 GPUDemonsRegistrationFilter<InputImageType, OutputImageType, DisplacementFieldType>>::New()); \
207 } \
208 ITK_MACROEND_NOOP_STATEMENT
209
211 {
212 if (IsGPUAvailable())
213 {
214 OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 1);
218 OverrideDemonsRegistrationFilterTypeMacro(unsigned int, unsigned int, 1);
220
221 OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 2);
225 OverrideDemonsRegistrationFilterTypeMacro(unsigned int, unsigned int, 2);
227
228 OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 3);
232 OverrideDemonsRegistrationFilterTypeMacro(unsigned int, unsigned int, 3);
234 }
235 }
236};
237} // end namespace itk
238
239#ifndef ITK_MANUAL_INSTANTIATION
240# include "itkGPUDemonsRegistrationFilter.hxx"
241#endif
242
243#endif
Deformably register two images using the demons algorithm.
Object Factory implementation for GPUDemonsRegistrationFilter.
Deformably register two images using the demons algorithm with GPU.
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
typename GPUSuperclass::TimeStepType TimeStepType
double GetIntensityDifferenceThreshold() const override
double GetMetric() const override
void ApplyUpdate(const TimeStepType &dt) override
void SetIntensityDifferenceThreshold(double) override
~GPUDemonsRegistrationFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
Deformably register two images using a PDE algorithm.
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Create instances of classes using an object factory.
static bool RegisterFactory(ObjectFactoryBase *, InsertionPositionEnum where=InsertionPositionEnum::INSERT_AT_BACK, vcl_size_t position=0)
typename DisplacementFieldType::Pointer DisplacementFieldPointer
typename MovingImageType::Pointer MovingImagePointer
#define OverrideDemonsRegistrationFilterTypeMacro(ipt, opt, dm)
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:39
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
bool IsGPUAvailable()