OTB  9.0.0
Orfeo Toolbox
otbISRAUnmixingImageFilter.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 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
otb::Functor::ISRAUnmixingFunctor::SVDType
vnl_svd< PrecisionType > SVDType
Definition: otbISRAUnmixingImageFilter.h:82
otbFunctorImageFilter.h
otb::Functor::ISRAUnmixingFunctor::SetEndmembersMatrix
void SetEndmembersMatrix(const MatrixType &U)
Definition: otbISRAUnmixingImageFilter.hxx:45
otb::Functor::ISRAUnmixingFunctor::m_MaxIteration
unsigned int m_MaxIteration
Definition: otbISRAUnmixingImageFilter.h:88
otb::Functor::ISRAUnmixingFunctor::~ISRAUnmixingFunctor
virtual ~ISRAUnmixingFunctor()=default
otb::Functor::ISRAUnmixingFunctor::VectorType
vnl_vector< PrecisionType > VectorType
Definition: otbISRAUnmixingImageFilter.h:53
otb::Functor::ISRAUnmixingFunctor::SetMaxIteration
void SetMaxIteration(unsigned int val)
Definition: otbISRAUnmixingImageFilter.h:64
otb::Functor::ISRAUnmixingFunctor::m_OutputSize
unsigned int m_OutputSize
Definition: otbISRAUnmixingImageFilter.h:87
otb::Functor::ISRAUnmixingFunctor::SVDPointerType
std::shared_ptr< SVDType > SVDPointerType
Definition: otbISRAUnmixingImageFilter.h:83
otb::FunctorImageFilter
A generic functor filter templated by its functor.
Definition: otbFunctorImageFilter.h:322
otb::Functor::ISRAUnmixingFunctor
Perform fully constrained least squares on a pixel.
Definition: otbISRAUnmixingImageFilter.h:44
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::ISRAUnmixingFunctor::OutputType
TOutput OutputType
Definition: otbISRAUnmixingImageFilter.h:50
otbISRAUnmixingImageFilter.hxx
otb::Functor::ISRAUnmixingFunctor::GetEndmembersMatrix
const MatrixType & GetEndmembersMatrix(void) const
Definition: otbISRAUnmixingImageFilter.hxx:54
otb::Functor::ISRAUnmixingFunctor::InputType
TInput InputType
Definition: otbISRAUnmixingImageFilter.h:49
otb::Functor::ISRAUnmixingFunctor::PrecisionType
TPrecision PrecisionType
Definition: otbISRAUnmixingImageFilter.h:51
otb::Functor::ISRAUnmixingFunctor::m_U
MatrixType m_U
Definition: otbISRAUnmixingImageFilter.h:85
otb::Functor::ISRAUnmixingFunctor::operator()
OutputType operator()(const InputType &in) const
Definition: otbISRAUnmixingImageFilter.hxx:60
otb::Functor::ISRAUnmixingFunctor::IsNonNegative
static bool IsNonNegative(PrecisionType val)
Definition: otbISRAUnmixingImageFilter.h:77
otb::Functor::ISRAUnmixingFunctor::OutputSize
vcl_size_t OutputSize(const std::array< vcl_size_t, 1 > &nbBands) const
Definition: otbISRAUnmixingImageFilter.hxx:39
otb::Functor::ISRAUnmixingFunctor::MatrixType
vnl_matrix< PrecisionType > MatrixType
Definition: otbISRAUnmixingImageFilter.h:54
otb::Functor::ISRAUnmixingFunctor::m_Svd
SVDPointerType m_Svd
Definition: otbISRAUnmixingImageFilter.h:86
otb::Functor::ISRAUnmixingFunctor::Self
ISRAUnmixingFunctor< TInput, TOutput, TPrecision > Self
Definition: otbISRAUnmixingImageFilter.h:47
otb::Functor::ISRAUnmixingFunctor::ISRAUnmixingFunctor
ISRAUnmixingFunctor()
Definition: otbISRAUnmixingImageFilter.hxx:34
otb::Functor::ISRAUnmixingFunctor::GetMaxIteration
unsigned int GetMaxIteration() const
Definition: otbISRAUnmixingImageFilter.h:69