ITK  5.2.0
Insight Toolkit
itkUnaryFunctorImageFilter.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  * 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 itkUnaryFunctorImageFilter_h
19 #define itkUnaryFunctorImageFilter_h
20 
21 #include "itkMath.h"
22 #include "itkInPlaceImageFilter.h"
24 
25 namespace itk
26 {
49 template <typename TInputImage, typename TOutputImage, typename TFunction>
50 class ITK_TEMPLATE_EXPORT UnaryFunctorImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(UnaryFunctorImageFilter);
54 
60 
62  itkNewMacro(Self);
63 
66 
68  using FunctorType = TFunction;
69 
70  using InputImageType = TInputImage;
71  using InputImagePointer = typename InputImageType::ConstPointer;
73  using InputImagePixelType = typename InputImageType::PixelType;
74 
75  using OutputImageType = TOutputImage;
76  using OutputImagePointer = typename OutputImageType::Pointer;
78  using OutputImagePixelType = typename OutputImageType::PixelType;
79 
84  FunctorType &
86  {
87  return m_Functor;
88  }
89  const FunctorType &
90  GetFunctor() const
91  {
92  return m_Functor;
93  }
95 
102  void
103  SetFunctor(const FunctorType & functor)
104  {
105  if (m_Functor != functor)
106  {
107  m_Functor = functor;
108  this->Modified();
109  }
110  }
112 
113 protected:
115  ~UnaryFunctorImageFilter() override = default;
116 
125  void
126  GenerateOutputInformation() override;
127 
138  void
139  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
140 
141 private:
143 };
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 # include "itkUnaryFunctorImageFilter.hxx"
148 #endif
149 
150 #endif
itk::Functor::BinaryNot< TImage::PixelType >
itk::ImageSource< TImage >::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::UnaryFunctorImageFilter
Implements pixel-wise generic operation on one image.
Definition: itkUnaryFunctorImageFilter.h:50
itk::UnaryFunctorImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: itkUnaryFunctorImageFilter.h:90
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::UnaryFunctorImageFilter::m_Functor
FunctorType m_Functor
Definition: itkUnaryFunctorImageFilter.h:142
itk::SmartPointer< Self >
itk::UnaryFunctorImageFilter::SetFunctor
void SetFunctor(const FunctorType &functor)
Definition: itkUnaryFunctorImageFilter.h:103
itkImageRegionIteratorWithIndex.h
itk::ImageToImageFilter< TImage, TImage >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageToImageFilter< TImage, TImage >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter< TImage, TImage >::InputImageType
TImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::ImageSource< TImage >::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::ImageSource< TImage >::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::UnaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkUnaryFunctorImageFilter.h:85
itk::ImageToImageFilter< TImage, TImage >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itkMath.h
itk::ImageSource< TImage >::OutputImageType
TImage OutputImageType
Definition: itkImageSource.h:90