ITK  6.0.0
Insight Toolkit
itkGPUImageToImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 itkGPUImageToImageFilter_h
19 #define itkGPUImageToImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkGPUKernelManager.h"
23 
24 namespace itk
25 {
38 template <typename TInputImage,
39  typename TOutputImage,
40  typename TParentImageFilter = ImageToImageFilter<TInputImage, TOutputImage>>
41 class ITK_TEMPLATE_EXPORT GPUImageToImageFilter : public TParentImageFilter
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(GPUImageToImageFilter);
45 
48  using Superclass = TParentImageFilter;
51 
52  itkNewMacro(Self);
53 
55  itkOverrideGetNameOfClassMacro(GPUImageToImageFilter);
56 
59  using typename Superclass::OutputImageRegionType;
60  using typename Superclass::OutputImagePixelType;
61 
63  using InputImageType = TInputImage;
67  using InputImagePixelType = typename InputImageType::PixelType;
68 
70  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
71  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
72 
73  // macro to set if GPU is used
74  itkSetMacro(GPUEnabled, bool);
75  itkGetConstMacro(GPUEnabled, bool);
76  itkBooleanMacro(GPUEnabled);
77 
78  void
79  GenerateData() override;
80  virtual void
81  GraftOutput(typename itk::GPUTraits<TOutputImage>::Type * output);
82  virtual void
83  GraftOutput(const DataObjectIdentifierType & key, typename itk::GPUTraits<TOutputImage>::Type * output);
84 
85 protected:
86  void
87  GraftOutput(DataObject * output) override;
88  void
89  GraftOutput(const DataObjectIdentifierType & key, DataObject * output) override;
91  ~GPUImageToImageFilter() override;
92 
93  void
94  PrintSelf(std::ostream & os, Indent indent) const override;
95 
96  virtual void
98  {}
99 
100  // GPU kernel manager
101  typename GPUKernelManager::Pointer m_GPUKernelManager{};
102 
103  // GPU kernel handle - kernel should be defined in specific filter (not in the
104  // base class)
105  // int m_KernelHandle;
106 
107 private:
108  bool m_GPUEnabled{ true };
109 };
110 
111 } // end namespace itk
112 
113 #ifndef ITK_MANUAL_INSTANTIATION
114 # include "itkGPUImageToImageFilter.hxx"
115 #endif
116 
117 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ProcessObject::DataObjectIdentifierType
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Definition: itkProcessObject.h:162
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkGPUKernelManager.h
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageSource::DataObjectIdentifierType
Superclass::DataObjectIdentifierType DataObjectIdentifierType
Definition: itkImageSource.h:83
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::GPUImageToImageFilter
class to abstract the behaviour of the GPU filters.
Definition: itkGPUImageToImageFilter.h:41
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::GPUTraits::Type
T Type
Definition: itkGPUImage.h:301
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::GPUImageToImageFilter::GPUGenerateData
virtual void GPUGenerateData()
Definition: itkGPUImageToImageFilter.h:97
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293