OTB  7.1.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-2019 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 
99  FunctorType& GetFunctor(void)
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 
163  FunctorType m_Functor;
164 };
165 
166 } // end namespace otb
167 
168 #ifndef OTB_MANUAL_INSTANTIATION
170 #endif
171 
172 #endif
Input3ImageType::ConstPointer Input3ImagePointer
itk::InPlaceImageFilter< TInputImage1, TOutputImage > Superclass
Input2ImageType::ConstPointer Input2ImagePointer
Input4ImageType::ConstPointer Input4ImagePointer
itk::SmartPointer< const Self > ConstPointer
Implements pixel-wise generic operation of four images.
void SetFunctor(const FunctorType &functor)
Input1ImageType::ConstPointer Input1ImagePointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.