OTB  10.0.0
Orfeo Toolbox
otbFunctionToImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 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 otbFunctionToImageFilter_h
23 #define otbFunctionToImageFilter_h
24 
25 #include "itkInPlaceImageFilter.h"
26 #include "itkImageFunction.h"
27 #include "itkImageRegionIterator.h"
28 #include "itkSize.h"
29 #include "itkSpatialFunction.h"
30 
31 namespace otb
32 {
33 
54 template <class TInputImage, class TOutputImage, class TFunction>
55 class ITK_EXPORT FunctionToImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
56 {
57 public:
60  typedef itk::InPlaceImageFilter<TInputImage, TOutputImage> Superclass;
61  typedef itk::SmartPointer<Self> Pointer;
62  typedef itk::SmartPointer<const Self> ConstPointer;
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(FunctionToImageFilter, InPlaceImageFilter);
69 
73  typedef TInputImage InputImageType;
74  typedef typename InputImageType::ConstPointer InputImagePointer;
75  typedef typename InputImageType::RegionType InputImageRegionType;
76  typedef typename InputImageType::PixelType InputImagePixelType;
77  typedef TOutputImage OutputImageType;
78  typedef typename OutputImageType::Pointer OutputImagePointer;
79  typedef typename OutputImageType::RegionType OutputImageRegionType;
80  typedef typename OutputImageType::PixelType OutputImagePixelType;
81 
83  typedef TFunction FunctionType;
84  typedef typename FunctionType::Pointer FunctionPointer;
85  typedef typename FunctionType::OutputType FunctionValueType;
86  typedef typename FunctionType::InputType FunctionPositionType;
87 
89  void SetFunction(FunctionType* PixelFunction)
90  {
91  m_PixelFunction = PixelFunction;
92  this->Modified();
93  }
95  {
96  return m_PixelFunction;
97  }
98  FunctionType const* GetFunction() const
99  {
100  return m_PixelFunction;
101  }
103 
104 
106  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
107  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
109 
110 protected:
113  {
114  }
115 
118  void BeforeThreadedGenerateData() override;
119 
130  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
131 
132 private:
133  FunctionToImageFilter(const Self&) = delete;
134  void operator=(const Self&) = delete;
135 
138 };
139 
140 } // end namespace otb
141 
142 #ifndef OTB_MANUAL_INSTANTIATION
144 #endif
145 
146 #endif
Evaluates a ImageFunction onto a source image.
OutputImageType::RegionType OutputImageRegionType
FunctionType::Pointer FunctionPointer
itk::SmartPointer< Self > Pointer
void SetFunction(FunctionType *PixelFunction)
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
InputImageType::RegionType InputImageRegionType
FunctionType::InputType FunctionPositionType
void operator=(const Self &)=delete
InputImageType::PixelType InputImagePixelType
FunctionToImageFilter(const Self &)=delete
FunctionType const * GetFunction() const
InputImageType::ConstPointer InputImagePointer
OutputImageType::PixelType OutputImagePixelType
itk::SmartPointer< const Self > ConstPointer
FunctionType::OutputType FunctionValueType
OutputImageType::Pointer OutputImagePointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.