OTB  10.0.0
Orfeo Toolbox
otbSparseUnmixingImageFilter.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 otbSparseUnmixingImageFilter_h
22 #define otbSparseUnmixingImageFilter_h
23 
24 #include "itkListSample.h"
25 #include "itkHistogram.h"
26 
27 #include "otbMacro.h"
28 #include "otbImage.h"
29 #include "otbWaveletOperator.h"
30 #include "otbWaveletFilterBank.h"
31 #include "otbWaveletTransform.h"
34 
35 namespace otb
36 {
37 
54 template <class TInputImage, class TOutputImage, unsigned int VNbInputImage, class TPrecision = double,
55  Wavelet::Wavelet TMotherWaveletOperator = Wavelet::SYMLET8>
56 class ITK_EXPORT SparseUnmixingImageFilter : public ImageToImageListFilter<TInputImage, TOutputImage>
57 {
58 public:
62  typedef itk::SmartPointer<Self> Pointer;
63  typedef itk::SmartPointer<const Self> ConstPointer;
64 
66  itkNewMacro(Self);
67 
70 
72  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
73  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
74  itkStaticConstMacro(NumberOfInputImages, unsigned int, VNbInputImage);
76 
78  typedef TInputImage InputImageType;
79  typedef TOutputImage OutputImageType;
80  typedef TPrecision PrecisionType;
81  static const Wavelet::Wavelet MotherWaveletOperatorID = TMotherWaveletOperator;
82 
85 
90  typedef typename WvltFilterType::OutputImageListType InternalImageListType;
93 
94  // typedef itk::FixedArray< PrecisionType, NumberOfInputImages-1 > AngleType;
95  typedef itk::Array<PrecisionType> AngleType;
96  typedef itk::Statistics::ListSample<AngleType> AngleListType;
97  typedef typename AngleListType::Pointer AngleListPointerType;
101 
102  typedef typename itk::Statistics::Histogram<PrecisionType> HistogramType;
103  typedef typename HistogramType::Pointer HistogramPointerType;
104  typedef typename HistogramType::SizeType HistogramSizeType;
105  typedef typename HistogramType::IndexType HistogramIndexType;
106  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
107  typedef typename HistogramType::MeasurementType MeasurementType;
108 
114 
115  using Superclass::SetInput;
116  void SetInput(unsigned int i, const InputImageType*);
117  const InputImageType* GetInput(unsigned int i) const;
118 
119  void SetNumberOfDecomposition(unsigned int nb)
120  {
121  for (unsigned int i = 0; i < NumberOfInputImages; ++i)
122  {
123  m_WvltFilterList->GetNthElement(i)->SetNumberOfDecomposition(nb);
124  }
125  this->Modified();
126  }
127  unsigned int GetNumberOfDecomposition() const
128  {
129  return m_WvltFilterList->GetNthElement(0)->GetNumberOfDecomposition();
130  }
131 
133  {
134  m_AngleListFilter->SetThresholdValue(th);
135  this->Modified();
136  }
138  {
139  return m_AngleListFilter->GetThresholdValue();
140  }
141 
145  unsigned int GetNumberOfComponentsRequired() const
146  {
147  if (m_NumberOfComponentsRequired == 0)
148  GenerateNumberOfComponentsRequired();
149  return m_NumberOfComponentsRequired;
150  }
151  itkSetMacro(NumberOfComponentsRequired, unsigned int);
153 
154  itkSetMacro(NumberOfHistogramBins, unsigned int);
155  itkGetMacro(NumberOfHistogramBins, unsigned int);
156 
157  itkGetConstMacro(AngleList, AngleListType*);
158  itkGetConstMacro(WvltFilterList, WvltFilterListType*);
159  itkGetConstMacro(AngleListFilter, AngleListFilterType*);
160  itkGetConstMacro(Histogram, HistogramType*);
161  itkGetConstMacro(Transformer, TransformFilterType*);
162 
163 protected:
166  {
167  }
168 
169  void GenerateData() override;
170  virtual void GenerateNumberOfComponentsRequired();
171 
172 private:
173  SparseUnmixingImageFilter(const Self&) = delete;
174  void operator=(const Self&) = delete;
175 
179 
184 }; // end of class
185 
186 } // end of namespace otb
187 
188 #ifndef OTB_MANUAL_INSTANTIATION
190 #endif
191 
192 #endif
Performs spherical transformation in ND space from a set of angle values.
Base class for all the filters producing an otbImageList.
Base class for all the filters taking an image input to produce an image list.
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:92
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:41
itk::SmartPointer< Self > Pointer
Definition: otbObjectList.h:46
This class detects linear dependencies from N wavelet decompositions.
Image< PrecisionType, InputImageDimension > InternalImageType
WaveletOperator< MotherWaveletOperatorID, Wavelet::FORWARD, PrecisionType, InputImageDimension > WaveletOperatorType
ObjectList< WvltFilterType > WvltFilterListType
WvltFilterListType::Pointer WvltFilterListPointerType
HistogramType::MeasurementType MeasurementType
SparseUnmixingImageFilter(const Self &)=delete
TransformFilterType::OutputImageListType OutputImageListType
WvltFilterType::OutputImageListType InternalImageListType
SparseWvltToAngleMapperListFilter< InternalImageListType, AngleListType, NumberOfInputImages > AngleListFilterType
itk::Statistics::Histogram< PrecisionType > HistogramType
AngleListFilterType::OutputSampleListType InternalSampleListType
AngularProjectionSetImageFilter< InputImageType, OutputImageType, AngleListType, PrecisionType > TransformFilterType
TransformFilterType::OutputImageIterator OutputImageIterator
ImageToImageListFilter< TInputImage, TOutputImage > Superclass
TransformFilterType::Pointer TransformFilterPointerType
HistogramType::MeasurementVectorType MeasurementVectorType
itk::Statistics::ListSample< AngleType > AngleListType
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)=delete
AngleListFilterPointerType m_AngleListFilter
WaveletFilterBank< InternalImageType, InternalImageType, WaveletOperatorType, Wavelet::FORWARD > FilterBankType
WaveletTransform< InternalImageType, InternalImageType, FilterBankType, Wavelet::FORWARD > WvltFilterType
TransformFilterType::OutputImageListPointerType OutputImageListPointerType
AngleListFilterType::Pointer AngleListFilterPointerType
This class select N-uple join-wvlt coeff for sparse unmixing.
One level stationary wavelet transform.
A Generic NeighborhoodOperator wavelets filter set defined for templation.
Wavelet transformation framework.
itk::SmartPointer< Self > Pointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.