OTB  6.7.0
Orfeo Toolbox
otbUnaryFunctorWithIndexImageFilter.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 otbUnaryFunctorWithIndexImageFilter_h
22 #define otbUnaryFunctorWithIndexImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
26 #include "itkProcessObject.h"
27 
28 namespace otb
29 {
41 template <class TInputImage, class TOutputImage, class TFunction>
43  : public itk::ImageToImageFilter<TInputImage, TOutputImage>
44 {
45 public:
51 
53  itkNewMacro(Self);
54 
56  itkTypeMacro(UnaryFunctorWithIndexImageFilter, ImageToImageFilter);
57 
59  typedef TFunction FunctorType;
60  typedef typename Superclass::InputImageType InputImageType;
61  typedef typename InputImageType::ConstPointer InputImagePointer;
62  typedef typename InputImageType::RegionType InputImageRegionType;
63  typedef typename InputImageType::PixelType InputImagePixelType;
66  typedef typename Superclass::OutputImageType OutputImageType;
67  typedef typename OutputImageType::Pointer OutputImagePointer;
68  typedef typename OutputImageType::RegionType OutputImageRegionType;
69  typedef typename OutputImageType::PixelType OutputImagePixelType;
70 
72 
78  {
79  this->Modified();
80  return m_Functor;
81  }
83 
88  const FunctorType& GetFunctor() const
89  {
90  return m_Functor;
91  }
92 
99  void SetFunctor(const FunctorType& functor)
100  {
101  m_Functor = functor;
102  this->Modified();
103  }
105 
107 
108 protected:
113 
118 
129  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
130 
134  void GenerateInputRequestedRegion(void) override;
135 
136 private:
137  UnaryFunctorWithIndexImageFilter(const Self &) = delete;
138  void operator =(const Self&) = delete;
139 
141 };
142 
143 } // namespace otb
144 
145 #ifndef OTB_MANUAL_INSTANTIATION
147 #endif
148 
149 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Implements neighborhood-wise generic operation on image.
itk::ImageRegionConstIteratorWithIndex< TInputImage > IteratorType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
unsigned int ThreadIdType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass