ITK  4.4.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< class TFixedImage, class TMovingImage, class TDisplacementField,
69  >
70 class ITK_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;
124 
127  itkSetMacro(UseMovingImageGradient, bool);
128  itkGetConstMacro(UseMovingImageGradient, bool);
129  itkBooleanMacro(UseMovingImageGradient);
131 
136  virtual void SetIntensityDifferenceThreshold(double);
137 
138  virtual double GetIntensityDifferenceThreshold() const;
139 
140 protected:
143  }
144  void PrintSelf(std::ostream & os, Indent indent) const;
145 
147  virtual void InitializeIteration();
148 
150  virtual void ApplyUpdate(const TimeStepType& dt);
151 
152 private:
153  GPUDemonsRegistrationFilter(const Self &); //purposely not implemented
154  void operator=(const Self &); //purposely not implemented
155 
157 };
158 
165 {
166 public:
171 
173  virtual const char* GetITKSourceVersion() const {
174  return ITK_SOURCE_VERSION;
175  }
176  const char* GetDescription() const {
177  return "A Factory for GPUDemonsRegistrationFilter";
178  }
180 
182  itkFactorylessNewMacro(Self);
183 
186 
188  static void RegisterOneFactory(void)
189  {
191 
193  }
194 
195 private:
196  GPUDemonsRegistrationFilterFactory(const Self&); //purposely not implemented
197  void operator=(const Self&); //purposely not implemented
198 
199 #define OverrideDemonsRegistrationFilterTypeMacro(ipt,opt,dm) \
200  { \
201  typedef GPUImage<ipt,dm> InputImageType; \
202  typedef GPUImage<opt,dm> OutputImageType; \
203  typedef Vector< float, dm > VectorPixelType; \
204  typedef GPUImage< VectorPixelType, dm > DisplacementFieldType; \
205  this->RegisterOverride( \
206  typeid(DemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
207  typeid(GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType>).name(), \
208  "GPU Demons Registration Filter Override", \
209  true, \
210  CreateObjectFunction<GPUDemonsRegistrationFilter<InputImageType,OutputImageType,DisplacementFieldType> >::New() ); \
211  }
212 
214  {
215  if( IsGPUAvailable() )
216  {
217  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 1);
221  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,1);
223 
224  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 2);
228  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,2);
230 
231  OverrideDemonsRegistrationFilterTypeMacro(unsigned char, unsigned char, 3);
235  OverrideDemonsRegistrationFilterTypeMacro(unsigned int,unsigned int,3);
237  }
238  }
239 
240 };
241 } // end namespace itk
242 
243 #ifndef ITK_MANUAL_INSTANTIATION
244 #include "itkGPUDemonsRegistrationFilter.hxx"
245 #endif
246 
247 #endif
248