ITK  4.8.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< typename TInputImage, typename TOutputImage, typename TParentImageFilter =
47  GradientAnisotropicDiffusionImageFilter< TInputImage, TOutputImage > >
49  public GPUAnisotropicDiffusionImageFilter< TInputImage, TOutputImage, TParentImageFilter >
50 {
51 public:
57 
59  itkNewMacro(Self);
60 
64 
67 
69  itkStaticConstMacro(ImageDimension, unsigned int, GPUSuperclass::ImageDimension);
70 
71 #ifdef ITK_USE_CONCEPT_CHECKING
72  // Begin concept checking
73  itkConceptMacro( UpdateBufferHasNumericTraitsCheck,
75  // End concept checking
76 #endif
77 
78 protected:
80  {
81  // Set DiffusionFunction
84  this->SetDifferenceFunction(p);
85  }
86 
88  }
89 
90 private:
91  GPUGradientAnisotropicDiffusionImageFilter(const Self &); //purposely not
92  // implemented
93  void operator=(const Self &); //purposely not
94 
95  // implemented
96 };
97 
105 {
106 public:
111 
113  virtual const char* GetITKSourceVersion() const ITK_OVERRIDE {
114  return ITK_SOURCE_VERSION;
115  }
116  const char* GetDescription() const ITK_OVERRIDE {
117  return "A Factory for GPUGradientAnisotropicDiffusionImageFilter";
118  }
120 
122  itkFactorylessNewMacro(Self);
123 
126 
128  static void RegisterOneFactory(void)
129  {
132 
134  }
135 
136 private:
138  // not
139  // implemented
140  void operator=(const Self&); //purposely
141  // not
142  // implemented
143 
144 #define GradientAnisotropicDiffusionImageFilterTypeMacro(ipt,opt,dm) \
145  { \
146  typedef itk::Image<ipt,dm> InputImageType; \
147  typedef itk::Image<opt,dm> OutputImageType; \
148  this->RegisterOverride( \
149  typeid(itk::GradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
150  typeid(itk::GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
151  "GPU GradientAnisotropicDiffusionImageFilter Override", \
152  true, \
153  itk::CreateObjectFunction<GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType> >::New() ); \
154  }
155 
157  {
158  if( IsGPUAvailable() )
159  {
160  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 1);
164  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,1);
166 
167  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 2);
171  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,2);
173 
174  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, unsigned char, 3);
178  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned int,unsigned int,3);
180  }
181  }
182 
183 };
184 
185 } // end namspace itk
186 
187 #endif
class to abstract the behaviour of the GPU filters.
#define GradientAnisotropicDiffusionImageFilterTypeMacro(ipt, opt, dm)
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:40
Create instances of classes using an object factory.
GPUAnisotropicDiffusionImageFilter< TInputImage, TOutputImage, TParentImageFilter > GPUSuperclass
static bool RegisterFactory(ObjectFactoryBase *, InsertionPositionType where=INSERT_AT_BACK, vcl_size_t position=0)
bool IsGPUAvailable()
virtual void SetDifferenceFunction(FiniteDifferenceFunctionType *differenceFunction) override
#define itkConceptMacro(name, concept)