Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkIndexedUnaryFunctorImageFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef itkIndexedUnaryFunctorImageFilter_h
18 #define itkIndexedUnaryFunctorImageFilter_h
19 
20 #include <itkUnaryFunctorImageFilter.h>
21 
22 namespace itk
23 {
55  template< typename TInputImage, typename TOutputImage, typename TFunction >
56  class IndexedUnaryFunctorImageFilter :public InPlaceImageFilter< TInputImage, TOutputImage >
57  {
58  public:
61  typedef InPlaceImageFilter< TInputImage, TOutputImage > Superclass;
64 
66  itkNewMacro(Self);
67 
69  itkTypeMacro(IndexedUnaryFunctorImageFilter, InPlaceImageFilter);
70 
72  typedef TFunction FunctorType;
73 
74  typedef TInputImage InputImageType;
75  typedef typename InputImageType::ConstPointer InputImagePointer;
76  typedef typename InputImageType::RegionType InputImageRegionType;
77  typedef typename InputImageType::PixelType InputImagePixelType;
78 
79  typedef TOutputImage OutputImageType;
80  typedef typename OutputImageType::Pointer OutputImagePointer;
81  typedef typename OutputImageType::RegionType OutputImageRegionType;
82  typedef typename OutputImageType::PixelType OutputImagePixelType;
83 
92  FunctorType & GetFunctor() { return m_Functor; }
93 
99  const FunctorType & GetFunctor() const { return m_Functor; }
100 
110  void SetFunctor(const FunctorType & functor)
111  {
112  if (m_Functor != functor)
113  {
114  m_Functor = functor;
115  this->Modified();
116  }
117  }
118 
119  protected:
122 
131  void GenerateOutputInformation() override;
132 
143  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
144  ThreadIdType threadId) override;
145 
146  private:
147  IndexedUnaryFunctorImageFilter(const Self &); //purposely not implemented
148  void operator=(const Self &); //purposely not implemented
149 
150  FunctorType m_Functor;
151  };
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include <itkIndexedUnaryFunctorImageFilter.tpp>
156 #endif
157 
158 #endif
Perform a generic pixel-wise, index-aware operation on an input image to produce an output image.
InputImageType::PixelType InputImagePixelType
Input pixel type.
OutputImageType::Pointer OutputImagePointer
Output image pointer type.
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
InputImageType::RegionType InputImageRegionType
Input image region type.
FunctorType & GetFunctor()
Get a mutable reference to the functor object.
void SetFunctor(const FunctorType &functor)
Set the functor object.
OutputImageType::RegionType OutputImageRegionType
Output image region type.
InputImageType::ConstPointer InputImagePointer
Input image const pointer type.
IndexedUnaryFunctorImageFilter Self
Standard class typedefs.
const FunctorType & GetFunctor() const
Get a const reference to the functor object.
TFunction FunctorType
Type of the functor used for the pixel-wise operation.
OutputImageType::PixelType OutputImagePixelType
Output pixel type.
InPlaceImageFilter< TInputImage, TOutputImage > Superclass