OTB  9.0.0
Orfeo Toolbox
otbQuaternaryFunctorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbQuaternaryFunctorImageFilter_h
23 #define otbQuaternaryFunctorImageFilter_h
24 
25 #include "itkInPlaceImageFilter.h"
26 #include "itkImageRegionIteratorWithIndex.h"
27 
28 namespace otb
29 {
30 
44 template <class TInputImage1, class TInputImage2, class TInputImage3, class TInputImage4, class TOutputImage, class TFunction>
45 class ITK_EXPORT QuaternaryFunctorImageFilter : public itk::InPlaceImageFilter<TInputImage1, TOutputImage>
46 {
47 public:
50  typedef itk::InPlaceImageFilter<TInputImage1, TOutputImage> Superclass;
51  typedef itk::SmartPointer<Self> Pointer;
52  typedef itk::SmartPointer<const Self> ConstPointer;
53 
55  itkNewMacro(Self);
56 
58  itkTypeMacro(QuaternaryFunctorImageFilter, InPlaceImageFilter);
59 
61  typedef TFunction FunctorType;
62  typedef TInputImage1 Input1ImageType;
63  typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
64  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
65  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
66  typedef TInputImage2 Input2ImageType;
67  typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
68  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
69  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
70  typedef TInputImage3 Input3ImageType;
71  typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
72  typedef typename Input3ImageType::RegionType Input3ImageRegionType;
73  typedef typename Input3ImageType::PixelType Input3ImagePixelType;
74  typedef TInputImage4 Input4ImageType;
75  typedef typename Input4ImageType::ConstPointer Input4ImagePointer;
76  typedef typename Input4ImageType::RegionType Input4ImageRegionType;
77  typedef typename Input4ImageType::PixelType Input4ImagePixelType;
78  typedef TOutputImage OutputImageType;
79  typedef typename OutputImageType::Pointer OutputImagePointer;
80  typedef typename OutputImageType::RegionType OutputImageRegionType;
81  typedef typename OutputImageType::PixelType OutputImagePixelType;
82 
84  void SetInput1(const TInputImage1* image1);
85 
87  void SetInput2(const TInputImage2* image2);
88 
90  void SetInput3(const TInputImage3* image3);
91 
93  void SetInput4(const TInputImage4* image4);
94 
100  {
101  return m_Functor;
102  }
103 
108  const FunctorType& GetFunctor() const
109  {
110  return m_Functor;
111  }
112 
119  void SetFunctor(const FunctorType& functor)
120  {
121  if (!(functor == m_Functor))
122  {
123  m_Functor = functor;
124  this->Modified();
125  }
126  }
128 
130  itkStaticConstMacro(Input1ImageDimension, unsigned int, TInputImage1::ImageDimension);
131  itkStaticConstMacro(Input2ImageDimension, unsigned int, TInputImage2::ImageDimension);
132  itkStaticConstMacro(Input3ImageDimension, unsigned int, TInputImage3::ImageDimension);
133  itkStaticConstMacro(Input4ImageDimension, unsigned int, TInputImage4::ImageDimension);
134  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
136 
137 protected:
140  {
141  }
142 
145  void BeforeThreadedGenerateData() override;
146 
157  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
158 
159 private:
160  QuaternaryFunctorImageFilter(const Self&) = delete;
161  void operator=(const Self&) = delete;
162 
164 };
165 
166 } // end namespace otb
167 
168 #ifndef OTB_MANUAL_INSTANTIATION
170 #endif
171 
172 #endif
otb::QuaternaryFunctorImageFilter::Input1ImagePixelType
Input1ImageType::PixelType Input1ImagePixelType
Definition: otbQuaternaryFunctorImageFilter.h:65
otb::QuaternaryFunctorImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbQuaternaryFunctorImageFilter.h:79
otb::QuaternaryFunctorImageFilter::Input1ImagePointer
Input1ImageType::ConstPointer Input1ImagePointer
Definition: otbQuaternaryFunctorImageFilter.h:63
otb::QuaternaryFunctorImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbQuaternaryFunctorImageFilter.h:81
otb::QuaternaryFunctorImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbQuaternaryFunctorImageFilter.h:78
otb::QuaternaryFunctorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbQuaternaryFunctorImageFilter.h:51
otb::QuaternaryFunctorImageFilter::m_Functor
FunctorType m_Functor
Definition: otbQuaternaryFunctorImageFilter.h:163
otb::QuaternaryFunctorImageFilter::Input4ImageType
TInputImage4 Input4ImageType
Definition: otbQuaternaryFunctorImageFilter.h:74
otb::QuaternaryFunctorImageFilter::Superclass
itk::InPlaceImageFilter< TInputImage1, TOutputImage > Superclass
Definition: otbQuaternaryFunctorImageFilter.h:50
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::QuaternaryFunctorImageFilter::Input4ImagePixelType
Input4ImageType::PixelType Input4ImagePixelType
Definition: otbQuaternaryFunctorImageFilter.h:77
otb::QuaternaryFunctorImageFilter::Input4ImageRegionType
Input4ImageType::RegionType Input4ImageRegionType
Definition: otbQuaternaryFunctorImageFilter.h:76
otb::QuaternaryFunctorImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: otbQuaternaryFunctorImageFilter.h:108
otb::QuaternaryFunctorImageFilter::Input2ImageType
TInputImage2 Input2ImageType
Definition: otbQuaternaryFunctorImageFilter.h:66
otb::QuaternaryFunctorImageFilter::Input4ImagePointer
Input4ImageType::ConstPointer Input4ImagePointer
Definition: otbQuaternaryFunctorImageFilter.h:75
otb::QuaternaryFunctorImageFilter::SetFunctor
void SetFunctor(const FunctorType &functor)
Definition: otbQuaternaryFunctorImageFilter.h:119
otb::QuaternaryFunctorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbQuaternaryFunctorImageFilter.h:52
otb::QuaternaryFunctorImageFilter
Implements pixel-wise generic operation of four images.
Definition: otbQuaternaryFunctorImageFilter.h:45
otb::QuaternaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor(void)
Definition: otbQuaternaryFunctorImageFilter.h:99
otb::QuaternaryFunctorImageFilter::Input2ImagePixelType
Input2ImageType::PixelType Input2ImagePixelType
Definition: otbQuaternaryFunctorImageFilter.h:69
otb::QuaternaryFunctorImageFilter::Input1ImageRegionType
Input1ImageType::RegionType Input1ImageRegionType
Definition: otbQuaternaryFunctorImageFilter.h:64
otb::QuaternaryFunctorImageFilter::Self
QuaternaryFunctorImageFilter Self
Definition: otbQuaternaryFunctorImageFilter.h:49
otb::QuaternaryFunctorImageFilter::Input2ImageRegionType
Input2ImageType::RegionType Input2ImageRegionType
Definition: otbQuaternaryFunctorImageFilter.h:68
otb::QuaternaryFunctorImageFilter::~QuaternaryFunctorImageFilter
~QuaternaryFunctorImageFilter() override
Definition: otbQuaternaryFunctorImageFilter.h:139
otb::QuaternaryFunctorImageFilter::FunctorType
TFunction FunctorType
Definition: otbQuaternaryFunctorImageFilter.h:58
otb::QuaternaryFunctorImageFilter::Input1ImageType
TInputImage1 Input1ImageType
Definition: otbQuaternaryFunctorImageFilter.h:62
otb::QuaternaryFunctorImageFilter::Input3ImagePointer
Input3ImageType::ConstPointer Input3ImagePointer
Definition: otbQuaternaryFunctorImageFilter.h:71
otb::QuaternaryFunctorImageFilter::Input3ImageRegionType
Input3ImageType::RegionType Input3ImageRegionType
Definition: otbQuaternaryFunctorImageFilter.h:72
otb::QuaternaryFunctorImageFilter::Input3ImagePixelType
Input3ImageType::PixelType Input3ImagePixelType
Definition: otbQuaternaryFunctorImageFilter.h:73
otb::QuaternaryFunctorImageFilter::Input3ImageType
TInputImage3 Input3ImageType
Definition: otbQuaternaryFunctorImageFilter.h:70
otb::QuaternaryFunctorImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbQuaternaryFunctorImageFilter.h:80
otbQuaternaryFunctorImageFilter.hxx
otb::QuaternaryFunctorImageFilter::Input2ImagePointer
Input2ImageType::ConstPointer Input2ImagePointer
Definition: otbQuaternaryFunctorImageFilter.h:67