ITK  5.0.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:
52  ITK_DISALLOW_COPY_AND_ASSIGN(GPUGradientAnisotropicDiffusionImageFilter);
53 
59 
61  itkNewMacro(Self);
62 
66 
69 
71  static constexpr unsigned int ImageDimension = GPUSuperclass::ImageDimension;
72 
73 #ifdef ITK_USE_CONCEPT_CHECKING
74  // Begin concept checking
75  itkConceptMacro( UpdateBufferHasNumericTraitsCheck,
77  // End concept checking
78 #endif
79 
80 protected:
82  {
83  // Set DiffusionFunction
86  this->SetDifferenceFunction(p);
87  }
88 
90 };
91 
99 {
100 public:
101  ITK_DISALLOW_COPY_AND_ASSIGN(GPUGradientAnisotropicDiffusionImageFilterFactory);
102 
107 
109  const char* GetITKSourceVersion() const override {
110  return ITK_SOURCE_VERSION;
111  }
112  const char* GetDescription() const override {
113  return "A Factory for GPUGradientAnisotropicDiffusionImageFilter";
114  }
116 
118  itkFactorylessNewMacro(Self);
119 
122 
124  static void RegisterOneFactory()
125  {
128 
130  }
131 
132 private:
133 
134 #define GradientAnisotropicDiffusionImageFilterTypeMacro(ipt,opt,dm) \
135  { \
136  using InputImageType = itk::Image<ipt,dm>; \
137  using OutputImageType = itk::Image<opt,dm>; \
138  this->RegisterOverride( \
139  typeid(itk::GradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
140  typeid(itk::GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType>).name(), \
141  "GPU GradientAnisotropicDiffusionImageFilter Override", \
142  true, \
143  itk::CreateObjectFunction<GPUGradientAnisotropicDiffusionImageFilter<InputImageType,OutputImageType> >::New() ); \
144  }
145 
147  {
148  if( IsGPUAvailable() )
149  {
150  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, float, 1);
156 
157  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, float, 2);
163 
164  GradientAnisotropicDiffusionImageFilterTypeMacro(unsigned char, float, 3);
170  }
171  }
172 
173 };
174 
175 } // end namspace itk
176 
177 #endif
class to abstract the behaviour of the GPU filters.
Light weight base class for most itk classes.
#define GradientAnisotropicDiffusionImageFilterTypeMacro(ipt, opt, dm)
#define ITK_SOURCE_VERSION
Definition: itkVersion.h:40
Create instances of classes using an object factory.
static bool RegisterFactory(ObjectFactoryBase *, InsertionPositionType where=INSERT_AT_BACK, vcl_size_t position=0)
typename GPUSuperclass::UpdateBufferType UpdateBufferType
bool IsGPUAvailable()
#define itkConceptMacro(name, concept)
void SetDifferenceFunction(FiniteDifferenceFunctionType *differenceFunction) override