OTB  9.0.0
Orfeo Toolbox
otbListSampleToHistogramListGenerator.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 otbListSampleToHistogramListGenerator_h
23 #define otbListSampleToHistogramListGenerator_h
24 
25 #include "itkNumericTraits.h"
26 #include "itkProcessObject.h"
27 #include "itkHistogram.h"
28 #include "itkStatisticsAlgorithm.h"
29 #include "otbObjectList.h"
30 
31 namespace otb
32 {
33 
45 template <class TListSample, class THistogramMeasurement, class TFrequencyContainer = itk::Statistics::DenseFrequencyContainer2>
46 class ITK_EXPORT ListSampleToHistogramListGenerator : public itk::ProcessObject
47 {
48 public:
51  typedef itk::ProcessObject Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
56  itkTypeMacro(ListSampleToHistogramListGenerator, itk::ProcessObject);
57 
59  itkNewMacro(Self);
60 
62  typedef TListSample ListSampleType;
63 
65  typedef typename itk::NumericTraits<THistogramMeasurement>::RealType HistogramMeasurementRealType;
66  typedef itk::Statistics::Histogram<HistogramMeasurementRealType, TFrequencyContainer> HistogramType;
67  typedef typename HistogramType::SizeType HistogramSizeType;
68  typedef typename TListSample::MeasurementVectorType MeasurementVectorType;
71 
72  typedef typename TListSample::ConstPointer ListSampleConstPointerType;
73 
75  typedef typename Superclass::DataObjectPointer DataObjectPointer;
76  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
77 
78  // Set/Get the input list sample
79  void SetListSample(const ListSampleType* inputlist);
80  const ListSampleType* GetListSample() const;
81 
82  // Get the output histogram
83  const HistogramListType* GetOutput();
84 
85 
87  // void SetListSample(const TListSample* list)
88  // {
89  // m_List = list;
90  // }
91 
95  itkSetMacro(NoDataValue, THistogramMeasurement);
96 
100  itkGetConstReferenceMacro(NoDataValue, THistogramMeasurement);
101 
105  itkSetMacro(NoDataFlag, bool);
106 
110  itkGetMacro(NoDataFlag, bool);
111 
115  itkBooleanMacro(NoDataFlag);
116 
117 
118  void SetMarginalScale(float scale)
119  {
120  m_MarginalScale = scale;
121  }
122 
123  void SetNumberOfBins(unsigned int size)
124  {
125  m_Size[0] = size;
126  }
127 
128  // HistogramListPointerType GetOutput() const
129  // { return m_HistogramList; }
130 
131  itkSetMacro(AutoMinMax, bool);
132  itkGetConstReferenceMacro(AutoMinMax, bool);
133 
134  void SetHistogramMin(const MeasurementVectorType& histogramMin)
135  {
136  m_HistogramMin = histogramMin;
137  m_AutoMinMax = false;
138  }
139 
140  void SetHistogramMax(const MeasurementVectorType& histogramMax)
141  {
142  m_HistogramMax = histogramMax;
143  m_AutoMinMax = false;
144  }
145 
146 protected:
149  {
150  }
151 
152  void GenerateData() override;
153 
154  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
155  using Superclass::MakeOutput;
156 
157  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
158 
159 private:
160  // ListSampleConstPointerType m_List;
161  HistogramSizeType m_Size{0,0};
166  // HistogramListPointerType m_HistogramList;
168  THistogramMeasurement m_NoDataValue;
169 
170 }; // end of class
171 
172 } // end of namespace itk
173 
174 #ifndef OTB_MANUAL_INSTANTIATION
176 #endif
177 
178 #endif
otb::ListSampleToHistogramListGenerator::Superclass
itk::ProcessObject Superclass
Definition: otbListSampleToHistogramListGenerator.h:51
otb::ListSampleToHistogramListGenerator::m_MarginalScale
float m_MarginalScale
Definition: otbListSampleToHistogramListGenerator.h:162
otb::ListSampleToHistogramListGenerator::m_NoDataFlag
bool m_NoDataFlag
Definition: otbListSampleToHistogramListGenerator.h:167
otb::ListSampleToHistogramListGenerator::SetHistogramMin
void SetHistogramMin(const MeasurementVectorType &histogramMin)
Definition: otbListSampleToHistogramListGenerator.h:134
otb::ListSampleToHistogramListGenerator::m_NoDataValue
THistogramMeasurement m_NoDataValue
Definition: otbListSampleToHistogramListGenerator.h:168
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ListSampleToHistogramListGenerator::~ListSampleToHistogramListGenerator
~ListSampleToHistogramListGenerator() override
Definition: otbListSampleToHistogramListGenerator.h:148
otb::ListSampleToHistogramListGenerator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbListSampleToHistogramListGenerator.h:52
otb::ListSampleToHistogramListGenerator::m_HistogramMin
MeasurementVectorType m_HistogramMin
Definition: otbListSampleToHistogramListGenerator.h:163
otb::ListSampleToHistogramListGenerator::m_HistogramMax
MeasurementVectorType m_HistogramMax
Definition: otbListSampleToHistogramListGenerator.h:164
otb::ListSampleToHistogramListGenerator::m_AutoMinMax
bool m_AutoMinMax
Definition: otbListSampleToHistogramListGenerator.h:165
otb::ListSampleToHistogramListGenerator::SetNumberOfBins
void SetNumberOfBins(unsigned int size)
Definition: otbListSampleToHistogramListGenerator.h:123
otb::ObjectList::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbObjectList.h:46
otb::ListSampleToHistogramListGenerator
Generates a list of 1D Histograms from a ListSample This class is similar to ListSampleToVariableDime...
Definition: otbListSampleToHistogramListGenerator.h:46
otb::ListSampleToHistogramListGenerator::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbListSampleToHistogramListGenerator.h:76
otb::ListSampleToHistogramListGenerator::HistogramListPointerType
HistogramListType::Pointer HistogramListPointerType
Definition: otbListSampleToHistogramListGenerator.h:70
otb::ListSampleToHistogramListGenerator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbListSampleToHistogramListGenerator.h:53
otb::MetaDataKey::NoDataValue
OTBMetadata_EXPORT char const * NoDataValue
otbListSampleToHistogramListGenerator.hxx
otbObjectList.h
otb::ListSampleToHistogramListGenerator::ListSampleConstPointerType
TListSample::ConstPointer ListSampleConstPointerType
Definition: otbListSampleToHistogramListGenerator.h:72
otb::ListSampleToHistogramListGenerator::HistogramType
itk::Statistics::Histogram< HistogramMeasurementRealType, TFrequencyContainer > HistogramType
Definition: otbListSampleToHistogramListGenerator.h:66
otb::ListSampleToHistogramListGenerator::ListSampleType
TListSample ListSampleType
Definition: otbListSampleToHistogramListGenerator.h:59
otb::ListSampleToHistogramListGenerator::HistogramListType
ObjectList< HistogramType > HistogramListType
Definition: otbListSampleToHistogramListGenerator.h:69
otb::ListSampleToHistogramListGenerator::SetHistogramMax
void SetHistogramMax(const MeasurementVectorType &histogramMax)
Definition: otbListSampleToHistogramListGenerator.h:140
otb::ListSampleToHistogramListGenerator::SetMarginalScale
void SetMarginalScale(float scale)
Definition: otbListSampleToHistogramListGenerator.h:118
otb::ListSampleToHistogramListGenerator::HistogramMeasurementRealType
itk::NumericTraits< THistogramMeasurement >::RealType HistogramMeasurementRealType
Definition: otbListSampleToHistogramListGenerator.h:65
otb::ObjectList
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:40
otb::ListSampleToHistogramListGenerator::MeasurementVectorType
TListSample::MeasurementVectorType MeasurementVectorType
Definition: otbListSampleToHistogramListGenerator.h:68
otb::ListSampleToHistogramListGenerator::Self
ListSampleToHistogramListGenerator Self
Definition: otbListSampleToHistogramListGenerator.h:50
otb::ListSampleToHistogramListGenerator::HistogramSizeType
HistogramType::SizeType HistogramSizeType
Definition: otbListSampleToHistogramListGenerator.h:67
otb::ListSampleToHistogramListGenerator::DataObjectPointer
Superclass::DataObjectPointer DataObjectPointer
Definition: otbListSampleToHistogramListGenerator.h:75