ITK  6.0.0
Insight Toolkit
itkGPUUnaryFunctorImageFilter.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 itkGPUUnaryFunctorImageFilter_h
19 #define itkGPUUnaryFunctorImageFilter_h
20 
21 #include "itkGPUFunctorBase.h"
24 
25 namespace itk
26 {
35 template <typename TInputImage,
36  typename TOutputImage,
37  typename TFunction,
38  typename TParentImageFilter = InPlaceImageFilter<TInputImage, TOutputImage>>
39 class ITK_TEMPLATE_EXPORT GPUUnaryFunctorImageFilter
40  : public GPUInPlaceImageFilter<TInputImage, TOutputImage, TParentImageFilter>
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(GPUUnaryFunctorImageFilter);
44 
47  using CPUSuperclass = TParentImageFilter;
51 
53  itkNewMacro(Self);
54 
56  itkOverrideGetNameOfClassMacro(GPUUnaryFunctorImageFilter);
57 
59  using FunctorType = TFunction;
60 
61  using InputImageType = TInputImage;
64  using InputImagePixelType = typename InputImageType::PixelType;
65 
66  using OutputImageType = TOutputImage;
69  using OutputImagePixelType = typename OutputImageType::PixelType;
70 
71 #if !defined(ITK_WRAPPING_PARSER)
72  FunctorType &
74  {
75  return m_Functor;
76  }
77 
78  const FunctorType &
79  GetFunctor() const
80  {
81  return m_Functor;
82  }
83 
85  void
86  SetFunctor(const FunctorType & functor)
87  {
88  if (m_Functor != functor)
89  {
90  m_Functor = functor;
91  this->Modified();
92  }
93  }
94 #endif // !defined( ITK_WRAPPING_PARSER )
95 
97 protected:
98  GPUUnaryFunctorImageFilter() = default;
99  ~GPUUnaryFunctorImageFilter() override = default;
100 
101  void
102  GenerateOutputInformation() override;
103 
104  void
105  GPUGenerateData() override;
106 
109  int m_UnaryFunctorImageFilterGPUKernelHandle{};
110 
111 private:
112  FunctorType m_Functor{};
113 };
114 
115 } // end of namespace itk
116 
117 #ifndef ITK_MANUAL_INSTANTIATION
118 # include "itkGPUUnaryFunctorImageFilter.hxx"
119 #endif
120 
121 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itkUnaryFunctorImageFilter.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::GPUUnaryFunctorImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: itkGPUUnaryFunctorImageFilter.h:79
itk::GPUInPlaceImageFilter
Base class for GPU filters that take an image as input and overwrite that image as the output.
Definition: itkGPUInPlaceImageFilter.h:39
itk::BinaryThresholdImageFilter
Binarize an input image by thresholding.
Definition: itkBinaryThresholdImageFilter.h:132
itk::SmartPointer< Self >
itk::GPUUnaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkGPUUnaryFunctorImageFilter.h:73
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::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::GPUUnaryFunctorImageFilter
Implements pixel-wise generic operation on one image using the GPU.
Definition: itkGPUUnaryFunctorImageFilter.h:39
itk::GPUImageToImageFilter< TInputImage, TOutputImage, BinaryThresholdImageFilter< TInputImage, TOutputImage > >
FunctorType
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAddImageFilter.h:97
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkGPUFunctorBase.h
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::GPUUnaryFunctorImageFilter::SetFunctor
void SetFunctor(const FunctorType &functor)
Definition: itkGPUUnaryFunctorImageFilter.h:86
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itkGPUInPlaceImageFilter.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::Functor::BinaryThreshold< TInputImage::PixelType, TOutputImage::PixelType >