OTB  10.0.0
Orfeo Toolbox
otbISRAUnmixingImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbISRAUnmixingImageFilter_h
22 #define otbISRAUnmixingImageFilter_h
23 
24 #include "itkNumericTraits.h"
25 #include "otbFunctorImageFilter.h"
26 #include "vnl/algo/vnl_svd.h"
27 #include <memory>
28 
29 namespace otb
30 {
31 
32 namespace Functor
33 {
34 
43 template <class TInput, class TOutput, class TPrecision>
45 {
46 public:
48 
49  typedef TInput InputType;
50  typedef TOutput OutputType;
51  typedef TPrecision PrecisionType;
52 
53  typedef vnl_vector<PrecisionType> VectorType;
54  typedef vnl_matrix<PrecisionType> MatrixType;
55 
57  virtual ~ISRAUnmixingFunctor() = default;
58 
59  size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
60 
61  void SetEndmembersMatrix(const MatrixType& U);
62  const MatrixType& GetEndmembersMatrix(void) const;
63 
64  void SetMaxIteration(unsigned int val)
65  {
66  m_MaxIteration = val;
67  }
68 
69  unsigned int GetMaxIteration() const
70  {
71  return m_MaxIteration;
72  }
73 
74  OutputType operator()(const InputType& in) const;
75 
76 private:
77  static bool IsNonNegative(PrecisionType val)
78  {
79  return val >= 0;
80  }
81 
82  typedef vnl_svd<PrecisionType> SVDType;
83  typedef std::shared_ptr<SVDType> SVDPointerType;
84 
86  SVDPointerType m_Svd; // SVD of U
87  unsigned int m_OutputSize;
88  unsigned int m_MaxIteration;
89 };
90 }
91 
118 template <typename TInputImage, typename TOutputImage, typename TPrecision>
120 
121 } // end namespace otb
122 
123 #ifndef OTB_MANUAL_INSTANTIATION
125 #endif
126 
127 #endif
A generic functor filter templated by its functor.
Perform fully constrained least squares on a pixel.
vcl_size_t OutputSize(const std::array< vcl_size_t, 1 > &nbBands) const
const MatrixType & GetEndmembersMatrix(void) const
static bool IsNonNegative(PrecisionType val)
OutputType operator()(const InputType &in) const
ISRAUnmixingFunctor< TInput, TOutput, TPrecision > Self
virtual ~ISRAUnmixingFunctor()=default
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.