Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
itkMultiOutputNaryFunctorImageFilter.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef __itkMultiOutputNaryFunctorImageFilter_h
14 #define __itkMultiOutputNaryFunctorImageFilter_h
15 
16 #include "itkImageToImageFilter.h"
17 #include "itkImageIterator.h"
18 #include "itkArray.h"
19 
20 namespace itk
21 {
41 template< class TInputImage, class TOutputImage, class TFunction, class TMaskImage = ::itk::Image<unsigned char, TInputImage::ImageDimension> >
43  public ImageToImageFilter< TInputImage, TOutputImage >
44 
45 {
46 public:
49  typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
53  itkNewMacro(Self);
54 
56  itkTypeMacro(MultiOutputNaryFunctorImageFilter, ImageToImageFilter);
57 
59  typedef TFunction FunctorType;
60  typedef TInputImage InputImageType;
61  typedef typename InputImageType::Pointer InputImagePointer;
62  typedef typename InputImageType::RegionType InputImageRegionType;
63  typedef typename InputImageType::PixelType InputImagePixelType;
64  typedef TOutputImage OutputImageType;
65  typedef typename OutputImageType::Pointer OutputImagePointer;
66  typedef typename OutputImageType::RegionType OutputImageRegionType;
67  typedef typename OutputImageType::PixelType OutputImagePixelType;
68  typedef typename FunctorType::InputPixelArrayType NaryInputArrayType;
69  typedef typename FunctorType::OutputPixelArrayType NaryOutputArrayType;
70  typedef TMaskImage MaskImageType;
71  typedef typename MaskImageType::Pointer MaskImagePointer;
72  typedef typename MaskImageType::RegionType MaskImageRegionType;
73 
78  FunctorType & GetFunctor() { return m_Functor; }
79 
86  void SetFunctor(FunctorType & functor)
87  {
88  if ( m_Functor != functor )
89  {
90  m_Functor = functor;
91  this->ActualizeOutputs();
92  this->Modified();
93  }
94  }
95 
96  itkSetObjectMacro(Mask, MaskImageType);
97  itkGetConstObjectMacro(Mask, MaskImageType);
98 
100  itkStaticConstMacro(
101  InputImageDimension, unsigned int, TInputImage::ImageDimension);
102  itkStaticConstMacro(
103  OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
104 
105 #ifdef ITK_USE_CONCEPT_CHECKING
106 
107  itkConceptMacro( SameDimensionCheck,
108  ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
109  itkConceptMacro( OutputHasZeroCheck,
110  ( Concept::HasZero< OutputImagePixelType > ) );
112 #endif
113 protected:
116 
127  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
128  ThreadIdType threadId) override;
129 
131  void ActualizeOutputs();
132 
133 private:
134  MultiOutputNaryFunctorImageFilter(const Self &); //purposely not implemented
135  void operator=(const Self &); //purposely not implemented
136 
137  FunctorType m_Functor;
138  MaskImagePointer m_Mask;
139 };
140 } // end namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkMultiOutputNaryFunctorImageFilter.tpp"
144 #endif
145 
146 #endif
itk::MultiOutputNaryFunctorImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: itkMultiOutputNaryFunctorImageFilter.h:67
itk::MultiOutputNaryFunctorImageFilter::NaryInputArrayType
FunctorType::InputPixelArrayType NaryInputArrayType
Definition: itkMultiOutputNaryFunctorImageFilter.h:68
itk::MultiOutputNaryFunctorImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: itkMultiOutputNaryFunctorImageFilter.h:66
itk::MultiOutputNaryFunctorImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: itkMultiOutputNaryFunctorImageFilter.h:65
itk::MultiOutputNaryFunctorImageFilter::Pointer
SmartPointer< Self > Pointer
Definition: itkMultiOutputNaryFunctorImageFilter.h:50
itk::MultiOutputNaryFunctorImageFilter::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkMultiOutputNaryFunctorImageFilter.h:51
itk::MultiOutputNaryFunctorImageFilter::SetFunctor
void SetFunctor(FunctorType &functor)
Definition: itkMultiOutputNaryFunctorImageFilter.h:86
itk::SmartPointer< Self >
itk::MultiOutputNaryFunctorImageFilter::Self
MultiOutputNaryFunctorImageFilter Self
Definition: itkMultiOutputNaryFunctorImageFilter.h:48
itk::MultiOutputNaryFunctorImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: itkMultiOutputNaryFunctorImageFilter.h:64
itk::MultiOutputNaryFunctorImageFilter
Perform a generic pixel-wise operation on N images and produces m output images.
Definition: itkMultiOutputNaryFunctorImageFilter.h:42
itk::MultiOutputNaryFunctorImageFilter::NaryOutputArrayType
FunctorType::OutputPixelArrayType NaryOutputArrayType
Definition: itkMultiOutputNaryFunctorImageFilter.h:69
itk::MultiOutputNaryFunctorImageFilter::MaskImageType
TMaskImage MaskImageType
Definition: itkMultiOutputNaryFunctorImageFilter.h:70
itk::MultiOutputNaryFunctorImageFilter::MaskImagePointer
MaskImageType::Pointer MaskImagePointer
Definition: itkMultiOutputNaryFunctorImageFilter.h:71
itk::MultiOutputNaryFunctorImageFilter::FunctorType
TFunction FunctorType
Definition: itkMultiOutputNaryFunctorImageFilter.h:56
itk::MultiOutputNaryFunctorImageFilter::InputImagePointer
InputImageType::Pointer InputImagePointer
Definition: itkMultiOutputNaryFunctorImageFilter.h:61
itk::MultiOutputNaryFunctorImageFilter::Superclass
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkMultiOutputNaryFunctorImageFilter.h:49
itk::MultiOutputNaryFunctorImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: itkMultiOutputNaryFunctorImageFilter.h:63
itk::MultiOutputNaryFunctorImageFilter::InputImageType
TInputImage InputImageType
Definition: itkMultiOutputNaryFunctorImageFilter.h:60
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
itk::MultiOutputNaryFunctorImageFilter::~MultiOutputNaryFunctorImageFilter
~MultiOutputNaryFunctorImageFilter() override
Definition: itkMultiOutputNaryFunctorImageFilter.h:115
itk::MultiOutputNaryFunctorImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: itkMultiOutputNaryFunctorImageFilter.h:62
itk::MultiOutputNaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkMultiOutputNaryFunctorImageFilter.h:78
itk::MultiOutputNaryFunctorImageFilter::MaskImageRegionType
MaskImageType::RegionType MaskImageRegionType
Definition: itkMultiOutputNaryFunctorImageFilter.h:72