OTB  7.1.0
Orfeo Toolbox
otbUnaryFunctorVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbUnaryFunctorVectorImageFilter_h
22 #define otbUnaryFunctorVectorImageFilter_h
23 
24 #include "itkInPlaceImageFilter.h"
25 
26 namespace otb
27 {
39 template <class TInputImage, class TOutputImage, class TFunction>
40 class ITK_EXPORT UnaryFunctorVectorImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
41 {
42 public:
45  typedef itk::InPlaceImageFilter<TInputImage, TOutputImage> Superclass;
46  typedef itk::SmartPointer<Self> Pointer;
47  typedef itk::SmartPointer<const Self> ConstPointer;
48 
50  itkNewMacro(Self);
51 
53  itkTypeMacro(UnaryFunctorVectorImageFilter, InPlaceImageFilter);
54 
56  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
57  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
59 
61  typedef TFunction FunctorType;
62  typedef TInputImage InputImageType;
63  typedef typename InputImageType::ConstPointer InputImagePointer;
64  typedef typename InputImageType::RegionType InputImageRegionType;
65  typedef typename InputImageType::PixelType InputImagePixelType;
66  typedef TOutputImage OutputImageType;
67  typedef typename OutputImageType::Pointer OutputImagePointer;
68  typedef typename OutputImageType::RegionType OutputImageRegionType;
69  typedef typename OutputImageType::PixelType OutputImagePixelType;
70 
71  typedef itk::ProcessObject ProcessObjectType;
72 
77  FunctorType& GetFunctor()
78  {
79  return m_Functor;
80  }
81 
88  void SetFunctor(const FunctorType& functor)
89  {
90  m_Functor = functor;
91  this->Modified();
92  }
94 
95 protected:
98  {
99  }
100 
111  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
112 
117  void GenerateOutputInformation(void) override;
118 
119 private:
120  UnaryFunctorVectorImageFilter(const Self&) = delete;
121  void operator=(const Self&) = delete;
122 
123  FunctorType m_Functor;
124 }; // end of class
125 
126 } // namespace otb
127 
128 #ifndef OTB_MANUAL_INSTANTIATION
130 #endif
131 
132 #endif
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
Implements neighborhood-wise generic operation of one vector image.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.