ITK  4.8.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  >
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() {
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  GPUDemonsRegistrationFilter(const Self &); //purposely not implemented
147  void operator=(const Self &); //purposely not implemented
148 
150 };
151 
158 {
159 public:
161  typedef ObjectFactoryBase GPUSuperclass;
164 
166  virtual const char* GetITKSourceVersion() const ITK_OVERRIDE
167  {
168  return ITK_SOURCE_VERSION;
169  }
170  const char* GetDescription() const ITK_OVERRIDE
171  {
172  return "A Factory for GPUDemonsRegistrationFilter";
173  }
175 
177  itkFactorylessNewMacro(Self);
178 
181 
183  static void RegisterOneFactory(void)
184  {
186 
188  }
189 
190 private:
191  GPUDemonsRegistrationFilterFactory(const Self&); //purposely not implemented
192  void operator=(const Self&); //purposely not implemented
193 
194 #define OverrideDemonsRegistrationFilterTypeMacro(ipt,opt,dm) \
195  { \
196  typedef GPUImage<ipt,dm> InputImageType; \
197  typedef GPUImage<opt,dm> OutputImageType; \
198  typedef Vector< float, dm > VectorPixelType; \
199  typedef GPUImage< VectorPixelType, dm > DisplacementFieldType; \
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<GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType> >::New() ); \
206  }
207 
209  {
210  if( IsGPUAvailable() )
211  {
212  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 1);
216  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,1);
218 
219  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 2);
223  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,2);
225 
226  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 3);
230  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,3);
232  }
233  }
234 
235 };
236 } // end namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 #include "itkGPUDemonsRegistrationFilter.hxx"
240 #endif
241 
242 #endif
virtual void SetIntensityDifferenceThreshold(double) override
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
virtual void InitializeIteration() override
GPUSuperclass::DisplacementFieldPointer DisplacementFieldPointer
Object Factory implemenatation for GPUDemonsRegistrationFilter.
GPUSuperclass::MovingImageType MovingImageType
virtual double GetIntensityDifferenceThreshold() const override
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
virtual double GetMetric() const override
GPUSuperclass::FixedImagePointer FixedImagePointer
GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
virtual void ApplyUpdate(const TimeStepType &dt) override
void PrintSelf(std::ostream &os, Indent indent) const override