OTB  9.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-2022 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;
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 ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) 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
otb::FunctionToImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbFunctionToImageFilter.h:61
otb::FunctionToImageFilter::SetFunction
void SetFunction(FunctionType *PixelFunction)
Definition: otbFunctionToImageFilter.h:89
otb::FunctionToImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbFunctionToImageFilter.h:76
otb::FunctionToImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbFunctionToImageFilter.h:62
otb::FunctionToImageFilter::FunctionPositionType
FunctionType::InputType FunctionPositionType
Definition: otbFunctionToImageFilter.h:86
otb::FunctionToImageFilter::m_PixelFunction
FunctionPointer m_PixelFunction
Definition: otbFunctionToImageFilter.h:137
otb::FunctionToImageFilter::FunctionValueType
FunctionType::OutputType FunctionValueType
Definition: otbFunctionToImageFilter.h:85
otb::FunctionToImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbFunctionToImageFilter.h:78
otb::FunctionToImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbFunctionToImageFilter.h:79
otb::FunctionToImageFilter::Superclass
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbFunctionToImageFilter.h:60
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::FunctionToImageFilter::~FunctionToImageFilter
~FunctionToImageFilter() override
Definition: otbFunctionToImageFilter.h:112
otb::FunctionToImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbFunctionToImageFilter.h:75
otb::FunctionToImageFilter::GetFunction
FunctionType * GetFunction()
Definition: otbFunctionToImageFilter.h:94
otb::FunctionToImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbFunctionToImageFilter.h:80
otb::FunctionToImageFilter::InputImagePointer
InputImageType::ConstPointer InputImagePointer
Definition: otbFunctionToImageFilter.h:74
otb::FunctionToImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbFunctionToImageFilter.h:77
otb::FunctionToImageFilter::FunctionType
TFunction FunctionType
Definition: otbFunctionToImageFilter.h:83
otb::SarRadiometricCalibrationFunction::OutputType
Superclass::OutputType OutputType
Definition: otbSarRadiometricCalibrationFunction.h:69
otb::FunctionToImageFilter
Evaluates a ImageFunction onto a source image.
Definition: otbFunctionToImageFilter.h:55
otbFunctionToImageFilter.hxx
otb::SarRadiometricCalibrationFunction
Calculate the backscatter for the given pixel.
Definition: otbSarRadiometricCalibrationFunction.h:50
otb::FunctionToImageFilter::FunctionPointer
FunctionType::Pointer FunctionPointer
Definition: otbFunctionToImageFilter.h:84
otb::FunctionToImageFilter::GetFunction
FunctionType const * GetFunction() const
Definition: otbFunctionToImageFilter.h:98
otb::FunctionToImageFilter::Self
FunctionToImageFilter Self
Definition: otbFunctionToImageFilter.h:59
otb::FunctionToImageFilter::InputImageType
TInputImage InputImageType
Definition: otbFunctionToImageFilter.h:68