OTB  6.7.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"
27 
28 namespace otb
29 {
30 
44 template <class TInputImage1, class TInputImage2,
45  class TInputImage3, class TInputImage4,
46  class TOutputImage, class TFunction>
47 class ITK_EXPORT QuaternaryFunctorImageFilter :
48  public itk::InPlaceImageFilter<TInputImage1, TOutputImage>
49 {
50 public:
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(QuaternaryFunctorImageFilter, InPlaceImageFilter);
62 
64  typedef TFunction FunctorType;
65  typedef TInputImage1 Input1ImageType;
66  typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
67  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
68  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
69  typedef TInputImage2 Input2ImageType;
70  typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
71  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
72  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
73  typedef TInputImage3 Input3ImageType;
74  typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
75  typedef typename Input3ImageType::RegionType Input3ImageRegionType;
76  typedef typename Input3ImageType::PixelType Input3ImagePixelType;
77  typedef TInputImage4 Input4ImageType;
78  typedef typename Input4ImageType::ConstPointer Input4ImagePointer;
79  typedef typename Input4ImageType::RegionType Input4ImageRegionType;
80  typedef typename Input4ImageType::PixelType Input4ImagePixelType;
81  typedef TOutputImage OutputImageType;
82  typedef typename OutputImageType::Pointer OutputImagePointer;
83  typedef typename OutputImageType::RegionType OutputImageRegionType;
84  typedef typename OutputImageType::PixelType OutputImagePixelType;
85 
87  void SetInput1(const TInputImage1 *image1);
88 
90  void SetInput2(const TInputImage2 *image2);
91 
93  void SetInput3(const TInputImage3 *image3);
94 
96  void SetInput4(const TInputImage4 *image4);
97 
103  {
104  return m_Functor;
105  }
106 
111  const FunctorType& GetFunctor() const
112  {
113  return m_Functor;
114  }
115 
122  void SetFunctor(const FunctorType& functor)
123  {
124  if (!(functor == m_Functor))
125  {
126  m_Functor = functor;
127  this->Modified();
128  }
129  }
131 
133  itkStaticConstMacro(Input1ImageDimension, unsigned int,
134  TInputImage1::ImageDimension);
135  itkStaticConstMacro(Input2ImageDimension, unsigned int,
136  TInputImage2::ImageDimension);
137  itkStaticConstMacro(Input3ImageDimension, unsigned int,
138  TInputImage3::ImageDimension);
139  itkStaticConstMacro(Input4ImageDimension, unsigned int,
140  TInputImage4::ImageDimension);
141  itkStaticConstMacro(OutputImageDimension, unsigned int,
142  TOutputImage::ImageDimension);
144 
145 protected:
148 
151  void BeforeThreadedGenerateData() override;
152 
163  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
164  itk::ThreadIdType threadId) override;
165 
166 private:
167  QuaternaryFunctorImageFilter(const Self &) = delete;
168  void operator =(const Self&) = delete;
169 
171 };
172 
173 } // end namespace otb
174 
175 #ifndef OTB_MANUAL_INSTANTIATION
177 #endif
178 
179 #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
unsigned int ThreadIdType