ITK  4.13.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:
77  typedef GPUPDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField,
78  TParentImageFilter > GPUSuperclass;
79  typedef TParentImageFilter
81  typedef SmartPointer< Self >
85 
87  itkNewMacro(Self);
88 
90  itkTypeMacro(GPUDemonsRegistrationFilter,
92 
95 
99 
103 
105  typedef typename GPUSuperclass::DisplacementFieldType
109 
113 
117 
123  virtual double GetMetric() const ITK_OVERRIDE;
124 
129  virtual void SetIntensityDifferenceThreshold(double) ITK_OVERRIDE;
130 
131  virtual double GetIntensityDifferenceThreshold() const ITK_OVERRIDE;
132 
133 protected:
135  ~GPUDemonsRegistrationFilter() ITK_OVERRIDE {}
136 
137  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
138 
140  virtual void InitializeIteration() ITK_OVERRIDE;
141 
143  virtual void ApplyUpdate(const TimeStepType& dt) ITK_OVERRIDE;
144 
145 private:
146  ITK_DISALLOW_COPY_AND_ASSIGN(GPUDemonsRegistrationFilter);
147 
148  bool m_UseMovingImageGradient;
149 };
150 
157 {
158 public:
160  typedef ObjectFactoryBase GPUSuperclass;
163 
165  virtual const char* GetITKSourceVersion() const ITK_OVERRIDE
166  {
167  return ITK_SOURCE_VERSION;
168  }
169  const char* GetDescription() const ITK_OVERRIDE
170  {
171  return "A Factory for GPUDemonsRegistrationFilter";
172  }
174 
176  itkFactorylessNewMacro(Self);
177 
180 
182  static void RegisterOneFactory(void)
183  {
185 
187  }
188 
189 private:
190  ITK_DISALLOW_COPY_AND_ASSIGN(GPUDemonsRegistrationFilterFactory);
191 
192 #define OverrideDemonsRegistrationFilterTypeMacro(ipt,opt,dm) \
193  { \
194  typedef GPUImage<ipt,dm> InputImageType; \
195  typedef GPUImage<opt,dm> OutputImageType; \
196  typedef Vector< float, dm > VectorPixelType; \
197  typedef GPUImage< VectorPixelType, dm > DisplacementFieldType; \
198  this->RegisterOverride( \
199  typeid(DemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
200  typeid(GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
201  "GPU Demons Registration Filter Override", \
202  true, \
203  CreateObjectFunction<GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType> >::New() ); \
204  }
205 
207  {
208  if( IsGPUAvailable() )
209  {
210  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 1);
214  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,1);
216 
217  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 2);
221  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,2);
223 
224  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 3);
228  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,3);
230  }
231  }
232 
233 };
234 } // end namespace itk
235 
236 #ifndef ITK_MANUAL_INSTANTIATION
237 #include "itkGPUDemonsRegistrationFilter.hxx"
238 #endif
239 
240 #endif
Deformably register two images using the demons algorithm.
GPUSuperclass::FixedImageType FixedImageType
GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:40
GPUSuperclass::DisplacementFieldType DisplacementFieldType
GPUDemonsRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > GPUDemonsRegistrationFunctionType
Create instances of classes using an object factory.
virtual const char * GetITKSourceVersion() const override
GPUSuperclass::DisplacementFieldPointer DisplacementFieldPointer
Object Factory implemenatation for GPUDemonsRegistrationFilter.
GPUSuperclass::MovingImageType MovingImageType
GPUPDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField, TParentImageFilter > GPUSuperclass
Deformably register two images using a PDE algorithm.
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()
GPUSuperclass::MovingImagePointer MovingImagePointer
GPUSuperclass::FixedImagePointer FixedImagePointer
GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType