ITK  5.2.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  * 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 itkGPUDemonsRegistrationFilter_h
19 #define itkGPUDemonsRegistrationFilter_h
20 
21 #include "itkOpenCLUtil.h"
25 #include "itkVersion.h"
26 #include "itkObjectFactoryBase.h"
27 
28 namespace itk
29 {
67 template <typename TFixedImage,
68  typename TMovingImage,
69  typename TDisplacementField,
71 class ITK_TEMPLATE_EXPORT GPUDemonsRegistrationFilter
72  : public GPUPDEDeformableRegistrationFilter<TFixedImage, TMovingImage, TDisplacementField, TParentImageFilter>
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_MOVE(GPUDemonsRegistrationFilter);
76 
79  using GPUSuperclass =
81  using CPUSuperclass = TParentImageFilter;
84 
86  itkNewMacro(Self);
87 
90 
93 
97 
101 
105 
108 
112 
118  double
119  GetMetric() const override;
120 
125  void
126  SetIntensityDifferenceThreshold(double) override;
127 
128  double
129  GetIntensityDifferenceThreshold() const override;
130 
131 protected:
133  ~GPUDemonsRegistrationFilter() override = default;
134 
135  void
136  PrintSelf(std::ostream & os, Indent indent) const override;
137 
139  void
140  InitializeIteration() override;
141 
143  void
144  ApplyUpdate(const TimeStepType & dt) override;
145 
146 private:
148 };
149 
156 {
157 public:
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  }
177 
179  itkFactorylessNewMacro(Self);
180 
183 
185  static void
187  {
189 
191  }
192 
193 private:
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
itk::GPUPDEDeformableRegistrationFilter::DisplacementFieldType
TDisplacementField DisplacementFieldType
Definition: itkGPUPDEDeformableRegistrationFilter.h:112
itk::GPUDemonsRegistrationFilter::DisplacementFieldPointer
typename GPUSuperclass::DisplacementFieldPointer DisplacementFieldPointer
Definition: itkGPUDemonsRegistrationFilter.h:104
itk::GPUDemonsRegistrationFilterFactory::GetDescription
const char * GetDescription() const override
Definition: itkGPUDemonsRegistrationFilter.h:172
itk::GPUDemonsRegistrationFilter::MovingImagePointer
typename GPUSuperclass::MovingImagePointer MovingImagePointer
Definition: itkGPUDemonsRegistrationFilter.h:100
itk::ObjectFactoryBase
Create instances of classes using an object factory.
Definition: itkObjectFactoryBase.h:62
itkGPUDemonsRegistrationFunction.h
itk::GPUDemonsRegistrationFilter::FixedImagePointer
typename GPUSuperclass::FixedImagePointer FixedImagePointer
Definition: itkGPUDemonsRegistrationFilter.h:96
itk::GPUDemonsRegistrationFilterFactory::GetITKSourceVersion
const char * GetITKSourceVersion() const override
Definition: itkGPUDemonsRegistrationFilter.h:167
itk::GPUDemonsRegistrationFilter::CPUSuperclass
TParentImageFilter CPUSuperclass
Definition: itkGPUDemonsRegistrationFilter.h:81
itk::GPUPDEDeformableRegistrationFilter::FixedImagePointer
typename FixedImageType::Pointer FixedImagePointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:103
itk::GPUPDEDeformableRegistrationFilter
Deformably register two images using a PDE algorithm.
Definition: itkGPUPDEDeformableRegistrationFilter.h:82
itk::GPUDemonsRegistrationFilter::m_UseMovingImageGradient
bool m_UseMovingImageGradient
Definition: itkGPUDemonsRegistrationFilter.h:147
itk::GPUDemonsRegistrationFilter
Deformably register two images using the demons algorithm with GPU.
Definition: itkGPUDemonsRegistrationFilter.h:71
itk::GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter >::TimeStepType
typename GPUSuperclass::TimeStepType TimeStepType
Definition: itkGPUDenseFiniteDifferenceImageFilter.h:85
itkDemonsRegistrationFilter.h
itk::SmartPointer< Self >
itk::GPUDemonsRegistrationFilter::FixedImageType
typename GPUSuperclass::FixedImageType FixedImageType
Definition: itkGPUDemonsRegistrationFilter.h:95
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GPUDemonsRegistrationFilter::FiniteDifferenceFunctionType
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Definition: itkGPUDemonsRegistrationFilter.h:107
itk::GPUPDEDeformableRegistrationFilter::MovingImagePointer
typename MovingImageType::Pointer MovingImagePointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:108
itk::GPUPDEDeformableRegistrationFilter::FixedImageType
TFixedImage FixedImageType
Definition: itkGPUPDEDeformableRegistrationFilter.h:102
itkOpenCLUtil.h
itkGPUPDEDeformableRegistrationFilter.h
ITK_SOURCE_VERSION
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:39
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkObjectFactoryBase.h
OverrideDemonsRegistrationFilterTypeMacro
#define OverrideDemonsRegistrationFilterTypeMacro(ipt, opt, dm)
Definition: itkGPUDemonsRegistrationFilter.h:194
itk::GPUPDEDeformableRegistrationFilter::DisplacementFieldPointer
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:113
itk::ObjectFactoryBase::ObjectFactoryBase
ObjectFactoryBase()
itk::GPUDemonsRegistrationFilter::TimeStepType
typename GPUSuperclass::TimeStepType TimeStepType
Definition: itkGPUDemonsRegistrationFilter.h:92
itk::GPUDemonsRegistrationFilterFactory::Self
GPUDemonsRegistrationFilterFactory Self
Definition: itkGPUDemonsRegistrationFilter.h:160
itk::GPUPDEDeformableRegistrationFilter::FiniteDifferenceFunctionType
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Definition: itkGPUPDEDeformableRegistrationFilter.h:121
itk::GPUDemonsRegistrationFilterFactory::GPUDemonsRegistrationFilterFactory
GPUDemonsRegistrationFilterFactory()
Definition: itkGPUDemonsRegistrationFilter.h:210
itkVersion.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DemonsRegistrationFilter
Deformably register two images using the demons algorithm.
Definition: itkDemonsRegistrationFilter.h:63
itk::GPUDemonsRegistrationFilter::MovingImageType
typename GPUSuperclass::MovingImageType MovingImageType
Definition: itkGPUDemonsRegistrationFilter.h:99
itk::GPUDemonsRegistrationFilter::DisplacementFieldType
typename GPUSuperclass::DisplacementFieldType DisplacementFieldType
Definition: itkGPUDemonsRegistrationFilter.h:103
itk::GPUDemonsRegistrationFilterFactory::New
static Pointer New()
itk::ObjectFactoryBase::RegisterFactory
static bool RegisterFactory(ObjectFactoryBase *, InsertionPositionEnum where=InsertionPositionEnum::INSERT_AT_BACK, vcl_size_t position=0)
itk::GPUPDEDeformableRegistrationFilter::MovingImageType
TMovingImage MovingImageType
Definition: itkGPUPDEDeformableRegistrationFilter.h:107
itk::GPUDemonsRegistrationFunction
Definition: itkGPUDemonsRegistrationFunction.h:58
itk::GPUDemonsRegistrationFilterFactory
Object Factory implementation for GPUDemonsRegistrationFilter.
Definition: itkGPUDemonsRegistrationFilter.h:155
itk::IsGPUAvailable
bool IsGPUAvailable()
itk::GPUDemonsRegistrationFilterFactory::RegisterOneFactory
static void RegisterOneFactory()
Definition: itkGPUDemonsRegistrationFilter.h:186