OTB  9.0.0
Orfeo Toolbox
otbPointSetAndValuesFunction.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 otbPointSetAndValuesFunction_h
22 #define otbPointSetAndValuesFunction_h
23 
24 #include "itkFunctionBase.h"
25 #include "itkContinuousIndex.h"
26 #include "itkVectorContainer.h"
27 #include "itkPointSet.h"
28 
29 namespace otb
30 {
36 template <class TPointSet, class TValue, class TCoordRep = double>
37 class ITK_EXPORT PointSetAndValuesFunction : public itk::FunctionBase<itk::Point<TCoordRep, TPointSet::PointDimension>, TValue>
38 {
39 public:
41  typedef PointSetAndValuesFunction Self;
42  typedef itk::FunctionBase<itk::Point<TCoordRep, TPointSet::PointDimension>, TValue> Superclass;
43  typedef itk::SmartPointer<Self> Pointer;
44  typedef itk::SmartPointer<const Self> ConstPointer;
45 
47  itkTypeMacro(PointSetAndValuesFunction, itk::FunctionBase);
48 
49  typedef TPointSet PointSetType;
50  typedef typename PointSetType::ConstPointer PointSetConstPointerType;
51  typedef TValue ValueType;
52  typedef TCoordRep CoordRepType;
53  typedef typename PointSetType::PointType PointType;
54 
55  typedef itk::Index<PointType::PointDimension> IndexType;
56  typedef itk::ContinuousIndex<CoordRepType, PointType::PointDimension> ContinuousIndexType;
57 
58  typedef itk::VectorContainer<unsigned long, ValueType> ValueVectorType;
59  typedef typename ValueVectorType::ConstPointer ValueVectorPointerType;
60 
61  itkSetObjectMacro(ValueVector, ValueVectorType);
62  itkGetObjectMacro(ValueVector, ValueVectorType);
63 
68  virtual void SetPointSet(const PointSetType* ptr);
69 
74  const PointSetType* GetPointSet() const
75  {
76  return m_PointSet.GetPointer();
77  }
78 
81  virtual TValue Evaluate(const PointType& point) const = 0;
82 
85  virtual TValue EvaluateAtIndex(const IndexType& index) const = 0;
86 
89  virtual TValue EvaluateAtContinuousIndex(const ContinuousIndexType& index) const = 0;
90 
91 protected:
93  PointSetAndValuesFunction()
94  {
95  m_PointSet = PointSetType::New();
96  m_ValueVector = ValueVectorType::New();
97  }
98 
100  virtual ~PointSetAndValuesFunction()
101  {
102  }
103 
105  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
106 
107 private:
108  PointSetAndValuesFunction(const Self&) = delete;
109  void operator=(const Self&) = delete;
110 
112  PointSetConstPointerType m_PointSet;
113 
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32