ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkGPUGradientAnisotropicDiffusionImageFilter.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 __itkGPUGradientAnisotropicDiffusionImageFilter_h
19 #define __itkGPUGradientAnisotropicDiffusionImageFilter_h
20 
21 #include "itkOpenCLUtil.h"
25 
26 namespace itk
27 {
46 template< class TInputImage, class TOutputImage, class TParentImageFilter =
47  GradientAnisotropicDiffusionImageFilter< TInputImage, TOutputImage > >
49  public GPUAnisotropicDiffusionImageFilter< TInputImage, TOutputImage, TParentImageFilter >
50 {
51 public:
57 
59  itkNewMacro(Self);
60 
64 
66  typedef typename GPUSuperclass::UpdateBufferType UpdateBufferType;
67 
69  itkStaticConstMacro(ImageDimension, unsigned int, GPUSuperclass::ImageDimension);
70 
71 #ifdef ITK_USE_CONCEPT_CHECKING
72 
73  itkConceptMacro( UpdateBufferHasNumericTraitsCheck,
75 
77 #endif
78 
79 protected:
81  {
82  // Set DiffusionFunction
85  this->SetDifferenceFunction(p);
86  }
87 
89  }
90 
91 private:
92  GPUGradientAnisotropicDiffusionImageFilter(const Self &); //purposely not
93  // implemented
94  void operator=(const Self &); //purposely not
95 
96  // implemented
97 };
98 
102 {
103 public:
108 
110  virtual const char* GetITKSourceVersion() const {
111  return ITK_SOURCE_VERSION;
112  }
113  const char* GetDescription() const {
114  return "A Factory for GPUGradientAnisotropicDiffusionImageFilter";
115  }
117 
119  itkFactorylessNewMacro(Self);
120 
123 
125  static void RegisterOneFactory(void)
126  {
129 
131  }
132 
133 private:
135  // not
136  // implemented
137  void operator=(const Self&); //purposely
138  // not
139  // implemented
140 
141 #define GradientAnisotropicDiffusionImageFilterTypeMacro(ipt,opt,dm) \
142  { \
143  typedef itk::Image<ipt,dm> InputImageType; \
144  typedef itk::Image<opt,dm> OutputImageType; \
145  this->RegisterOverride( \
146  typeid(itk::GradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
147  typeid(itk::GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
148  "GPU GradientAnisotropicDiffusionImageFilter Override", \
149  true, \
150  itk::CreateObjectFunction<GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType> >::New() ); \
151  }
152 
154  {
155  if( IsGPUAvailable() )
156  {
157  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 1);
161  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,1);
163 
164  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 2);
168  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,2);
170 
171  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 3);
175  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,3);
177  }
178  }
179 
180 };
181 
182 } // end namspace itk
183 
184 #endif
185