ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkGPUImageToImageFilter.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 itkGPUImageToImageFilter_h
19 #define itkGPUImageToImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkGPUKernelManager.h"
23 
24 namespace itk
25 {
38 template< typename TInputImage, typename TOutputImage, typename TParentImageFilter =
39  ImageToImageFilter< TInputImage, TOutputImage > >
40 class ITK_TEMPLATE_EXPORT GPUImageToImageFilter : public TParentImageFilter
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_ASSIGN(GPUImageToImageFilter);
44 
47  using Superclass = TParentImageFilter;
50 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(GPUImageToImageFilter, TParentImageFilter);
55 
58  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
59  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
60 
62  using InputImageType = TInputImage;
63  using InputImagePointer = typename InputImageType::Pointer;
64  using InputImageConstPointer = typename InputImageType::ConstPointer;
66  using InputImagePixelType = typename InputImageType::PixelType;
67 
69  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
70  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
71 
72  // macro to set if GPU is used
73  itkSetMacro(GPUEnabled, bool);
74  itkGetConstMacro(GPUEnabled, bool);
75  itkBooleanMacro(GPUEnabled);
76 
77  void GenerateData() override;
78  virtual void GraftOutput(typename itk::GPUTraits< TOutputImage >::Type *output);
79  virtual void GraftOutput(const DataObjectIdentifierType & key, typename itk::GPUTraits< TOutputImage >::Type *output);
80 
81 protected:
82  void GraftOutput(DataObject *output) override;
83  void GraftOutput(const DataObjectIdentifierType & key, DataObject *output) override;
85  ~GPUImageToImageFilter() override;
86 
87  void PrintSelf(std::ostream & os, Indent indent) const override;
88 
89  virtual void GPUGenerateData() {
90  }
91 
92  // GPU kernel manager
94 
95  // GPU kernel handle - kernel should be defined in specific filter (not in the
96  // base class)
97  //int m_KernelHandle;
98 
99 private:
101 };
102 
103 } // end namespace itk
104 
105 #ifndef ITK_MANUAL_INSTANTIATION
106 #include "itkGPUImageToImageFilter.hxx"
107 #endif
108 
109 #endif
Superclass::DataObjectIdentifierType DataObjectIdentifierType
class to abstract the behaviour of the GPU filters.
DataObject::DataObjectIdentifierType DataObjectIdentifierType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename InputImageType::ConstPointer InputImageConstPointer
GPUKernelManager::Pointer m_GPUKernelManager
Base class for all data objects in ITK.