OTB  9.0.0
Orfeo Toolbox
otbMetaImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbMetaImageFunction_h
22 #define otbMetaImageFunction_h
23 
24 #include "itkFunctionBase.h"
25 #include "itkPoint.h"
26 #include "itkVariableLengthVector.h"
27 #include "OTBImageBaseExport.h"
28 
29 #include <vector>
30 
31 namespace otb
32 {
47 template <class TOutputPrecision = double, class TCoordRep = double>
48 class OTBImageBase_EXPORT_TEMPLATE MetaImageFunction : public itk::FunctionBase<itk::Point<TCoordRep, 2>, itk::VariableLengthVector<TOutputPrecision>>
49 {
50 public:
51  // Standard class typedefs
53  typedef itk::FunctionBase<itk::Point<TCoordRep, 2>, itk::VariableLengthVector<TOutputPrecision>> Superclass;
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
57  // New macro
58  itkNewMacro(Self);
59 
60  // RTTI typeinfo
61  itkTypeMacro(MetaImageFunction, itk::FunctionBase);
62 
63  // Input and output typedef
64  typedef TCoordRep CoordRepType;
65  typedef itk::Point<CoordRepType, 2> PointType;
66  typedef TOutputPrecision ValueType;
67  typedef itk::VariableLengthVector<ValueType> OutputType;
68 
69  // Compatible functions typedefs
71  typedef typename FunctionType::Pointer FunctionPointerType;
72  typedef std::vector<FunctionPointerType> FunctionContainerType;
73 
75  OutputType Evaluate(const PointType& point) const override;
76 
78  void AddFunction(FunctionType* function);
79 
81  // template <typename T1, typename T2> void AddFunction(itk::ImageFunction<T1, T2, TCoordRep> * function);
82 
84  void ClearFunctions();
85 
87  unsigned int GetNumberOfFunctions() const;
88 
90  FunctionType* GetNthFunction(unsigned int index);
91 
93  void RemoveNthFunction(unsigned int index);
94 
95 protected:
98 
100  ~MetaImageFunction() override;
101 
103  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
104 
105 private:
106  MetaImageFunction(const Self&) = delete;
107  void operator=(const Self&) = delete;
108 
110 };
111 
112 
113 } // end namespace otb
114 
115 #ifndef OTB_MANUAL_INSTANTIATION
116 #include "otbMetaImageFunction.hxx"
117 #endif
118 
119 #endif
otb::MetaImageFunction::FunctionPointerType
FunctionType::Pointer FunctionPointerType
Definition: otbMetaImageFunction.h:71
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MetaImageFunction
Concatenate results from multiple ImageFunction.
Definition: otbMetaImageFunction.h:48
otb::MetaImageFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMetaImageFunction.h:54
otb::MetaImageFunction::PointType
itk::Point< CoordRepType, 2 > PointType
Definition: otbMetaImageFunction.h:65
otb::MetaImageFunction::OutputType
itk::VariableLengthVector< ValueType > OutputType
Definition: otbMetaImageFunction.h:67
otb::MetaImageFunction::ValueType
TOutputPrecision ValueType
Definition: otbMetaImageFunction.h:66
otb::MetaImageFunction::Self
MetaImageFunction Self
Definition: otbMetaImageFunction.h:52
otb::MetaImageFunction::Superclass
itk::FunctionBase< itk::Point< TCoordRep, 2 >, itk::VariableLengthVector< TOutputPrecision > > Superclass
Definition: otbMetaImageFunction.h:53
otbMetaImageFunction.hxx
otb::MetaImageFunction::FunctionType
Superclass FunctionType
Definition: otbMetaImageFunction.h:70
otb::MetaImageFunction::FunctionContainerType
std::vector< FunctionPointerType > FunctionContainerType
Definition: otbMetaImageFunction.h:72
otb::MetaImageFunction::m_FunctionContainer
FunctionContainerType m_FunctionContainer
Definition: otbMetaImageFunction.h:109
otb::MetaImageFunction::CoordRepType
TCoordRep CoordRepType
Definition: otbMetaImageFunction.h:61
otb::MetaImageFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMetaImageFunction.h:55