OTB  9.0.0
Orfeo Toolbox
otbListSampleToVariableDimensionHistogramGenerator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbListSampleToVariableDimensionHistogramGenerator_h
23 #define otbListSampleToVariableDimensionHistogramGenerator_h
24 
25 #include "itkProcessObject.h"
26 #include "itkHistogram.h"
27 #include "itkStatisticsAlgorithm.h"
28 
29 namespace otb
30 {
31 
49 template <class TListSample, class THistogramMeasurement, class TFrequencyContainer = itk::Statistics::DenseFrequencyContainer2>
50 class ITK_EXPORT ListSampleToVariableDimensionHistogramGenerator : public itk::ProcessObject
51 {
52 public:
55  typedef itk::ProcessObject Superclass;
56  typedef itk::SmartPointer<Self> Pointer;
57  typedef itk::SmartPointer<const Self> ConstPointer;
58 
60  itkTypeMacro(ListSampleToVariableDimensionHistogramGenerator, itk::ProcessObject);
61 
63  itkNewMacro(Self);
64 
66  typedef TListSample ListSampleType;
67 
69  typedef typename itk::NumericTraits<THistogramMeasurement>::RealType HistogramMeasurementRealType;
70 
71  typedef itk::Statistics::Histogram<HistogramMeasurementRealType, TFrequencyContainer> HistogramType;
72 
73  typedef typename HistogramType::SizeType HistogramSizeType;
74  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
75 
77  typedef typename Superclass::DataObjectPointer DataObjectPointer;
78  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
79 
80  // Set/Get the input list sample
81  void SetListSample(const ListSampleType* inputlist);
82  const ListSampleType* GetListSample() const;
83 
84  // Get the output histogram
85  const HistogramType* GetOutput();
86 
87  void SetMarginalScale(float scale)
88  {
89  m_MarginalScale = scale;
90  }
91 
93  {
94  m_Sizes = sizes;
95  }
96 
97  itkSetMacro(AutoMinMax, bool);
98  itkGetConstReferenceMacro(AutoMinMax, bool);
99 
100  void SetHistogramMin(const MeasurementVectorType& histogramMin)
101  {
102  m_HistogramMin = histogramMin;
103  m_AutoMinMax = false;
104  }
105 
106  void SetHistogramMax(const MeasurementVectorType& histogramMax)
107  {
108  m_HistogramMax = histogramMax;
109  m_AutoMinMax = false;
110  }
111 
112 protected:
115  {
116  }
117  void GenerateData() override;
118  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
119  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
120  using Superclass::MakeOutput;
121 
122 private:
123  HistogramSizeType m_Sizes{0,0};
128 
129 }; // end of class
130 
131 } // end of namespace itk
132 
133 #ifndef OTB_MANUAL_INSTANTIATION
135 #endif
136 
137 #endif
otb::ListSampleToVariableDimensionHistogramGenerator::SetMarginalScale
void SetMarginalScale(float scale)
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:87
otb::ListSampleToVariableDimensionHistogramGenerator
Generates a VariableDimensionHistogram from a ListSample.
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:50
otb::ListSampleToVariableDimensionHistogramGenerator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:56
otbListSampleToVariableDimensionHistogramGenerator.hxx
otb::ListSampleToVariableDimensionHistogramGenerator::Superclass
itk::ProcessObject Superclass
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:55
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ListSampleToVariableDimensionHistogramGenerator::SetNumberOfBins
void SetNumberOfBins(HistogramSizeType sizes)
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:92
otb::ListSampleToVariableDimensionHistogramGenerator::ListSampleType
TListSample ListSampleType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:63
otb::ListSampleToVariableDimensionHistogramGenerator::SetHistogramMin
void SetHistogramMin(const MeasurementVectorType &histogramMin)
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:100
otb::ListSampleToVariableDimensionHistogramGenerator::m_MarginalScale
float m_MarginalScale
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:124
otb::ListSampleToVariableDimensionHistogramGenerator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:57
otb::ListSampleToVariableDimensionHistogramGenerator::SetHistogramMax
void SetHistogramMax(const MeasurementVectorType &histogramMax)
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:106
otb::ListSampleToVariableDimensionHistogramGenerator::DataObjectPointer
Superclass::DataObjectPointer DataObjectPointer
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:77
otb::ListSampleToVariableDimensionHistogramGenerator::~ListSampleToVariableDimensionHistogramGenerator
~ListSampleToVariableDimensionHistogramGenerator() override
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:114
otb::ListSampleToVariableDimensionHistogramGenerator::HistogramType
itk::Statistics::Histogram< HistogramMeasurementRealType, TFrequencyContainer > HistogramType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:71
otb::ListSampleToVariableDimensionHistogramGenerator::m_HistogramMax
MeasurementVectorType m_HistogramMax
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:126
otb::ListSampleToVariableDimensionHistogramGenerator::HistogramMeasurementRealType
itk::NumericTraits< THistogramMeasurement >::RealType HistogramMeasurementRealType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:69
otb::ListSampleToVariableDimensionHistogramGenerator::HistogramSizeType
HistogramType::SizeType HistogramSizeType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:73
otb::ListSampleToVariableDimensionHistogramGenerator::Self
ListSampleToVariableDimensionHistogramGenerator Self
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:54
otb::ListSampleToVariableDimensionHistogramGenerator::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:78
otb::ListSampleToVariableDimensionHistogramGenerator::MeasurementVectorType
HistogramType::MeasurementVectorType MeasurementVectorType
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:74
otb::ListSampleToVariableDimensionHistogramGenerator::m_AutoMinMax
bool m_AutoMinMax
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:127
otb::ListSampleToVariableDimensionHistogramGenerator::m_HistogramMin
MeasurementVectorType m_HistogramMin
Definition: otbListSampleToVariableDimensionHistogramGenerator.h:125