ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkUnaryFunctorImageFilter.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 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_ASSIGN(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 & GetFunctor() { return m_Functor; }
85  const FunctorType & GetFunctor() const { return m_Functor; }
87 
94  void SetFunctor(const FunctorType & functor)
95  {
96  if ( m_Functor != functor )
97  {
98  m_Functor = functor;
99  this->Modified();
100  }
101  }
103 
104 protected:
106  ~UnaryFunctorImageFilter() override = default;
107 
116  void GenerateOutputInformation() override;
117 
128  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
129 
130 private:
132 };
133 } // end namespace itk
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "itkUnaryFunctorImageFilter.hxx"
137 #endif
138 
139 #endif
typename OutputImageType::Pointer OutputImagePointer
Light weight base class for most itk classes.
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
const FunctorType & GetFunctor() const
typename InputImageType::RegionType InputImageRegionType
Implements pixel-wise generic operation on one image.
Base class for filters that take an image as input and overwrite that image as the output...
void SetFunctor(const FunctorType &functor)