ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkGPUDemonsRegistrationFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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, typename TMovingImage, typename TDisplacementField,
69  >
70 class ITK_TEMPLATE_EXPORT GPUDemonsRegistrationFilter :
71  public GPUPDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
72  TDisplacementField, TParentImageFilter >
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_ASSIGN(GPUDemonsRegistrationFilter);
76 
79  using GPUSuperclass = GPUPDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField,
80  TParentImageFilter >;
81  using CPUSuperclass = TParentImageFilter;
84 
86  itkNewMacro(Self);
87 
89  itkTypeMacro(GPUDemonsRegistrationFilter,
91 
94 
98 
102 
106 
109 
113 
119  double GetMetric() const override;
120 
125  void SetIntensityDifferenceThreshold(double) override;
126 
127  double GetIntensityDifferenceThreshold() const override;
128 
129 protected:
132 
133  void PrintSelf(std::ostream & os, Indent indent) const override;
134 
136  void InitializeIteration() override;
137 
139  void ApplyUpdate(const TimeStepType& dt) override;
140 
141 private:
143 };
144 
151 {
152 public:
153  ITK_DISALLOW_COPY_AND_ASSIGN(GPUDemonsRegistrationFilterFactory);
154 
159 
161  const char* GetITKSourceVersion() const override
162  {
163  return ITK_SOURCE_VERSION;
164  }
165  const char* GetDescription() const override
166  {
167  return "A Factory for GPUDemonsRegistrationFilter";
168  }
170 
172  itkFactorylessNewMacro(Self);
173 
176 
178  static void RegisterOneFactory()
179  {
181 
183  }
184 
185 private:
186 #define OverrideDemonsRegistrationFilterTypeMacro(ipt,opt,dm) \
187  { \
188  using InputImageType = GPUImage<ipt,dm>; \
189  using OutputImageType = GPUImage<opt,dm>; \
190  using VectorPixelType = Vector< float, dm >; \
191  using DisplacementFieldType = GPUImage< VectorPixelType, dm >; \
192  this->RegisterOverride( \
193  typeid(DemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
194  typeid(GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
195  "GPU Demons Registration Filter Override", \
196  true, \
197  CreateObjectFunction<GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType> >::New() ); \
198  }
199 
201  {
202  if( IsGPUAvailable() )
203  {
204  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 1);
208  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,1);
210 
211  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 2);
215  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,2);
217 
218  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 3);
222  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,3);
224  }
225  }
226 
227 };
228 } // end namespace itk
229 
230 #ifndef ITK_MANUAL_INSTANTIATION
231 #include "itkGPUDemonsRegistrationFilter.hxx"
232 #endif
233 
234 #endif
Deformably register two images using the demons algorithm.
Light weight base class for most itk classes.
typename GPUSuperclass::DisplacementFieldPointer DisplacementFieldPointer
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:40
typename GPUSuperclass::DisplacementFieldType DisplacementFieldType
typename GPUSuperclass::FixedImageType FixedImageType
typename GPUSuperclass::FixedImagePointer FixedImagePointer
typename GPUSuperclass::MovingImagePointer MovingImagePointer
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Create instances of classes using an object factory.
Object Factory implemenatation for GPUDemonsRegistrationFilter.
Deformably register two images using a PDE algorithm.
typename DisplacementFieldType::Pointer DisplacementFieldPointer
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
typename GPUSuperclass::TimeStepType TimeStepType
typename GPUSuperclass::MovingImageType MovingImageType
static bool RegisterFactory(ObjectFactoryBase *, InsertionPositionType where=INSERT_AT_BACK, vcl_size_t position=0)
Deformably register two images using the demons algorithm with GPU.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define OverrideDemonsRegistrationFilterTypeMacro(ipt, opt, dm)
bool IsGPUAvailable()