OTB  6.7.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-2019 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 
44 template<class TListSample,
45  class THistogramMeasurement,
46  class TFrequencyContainer = itk::Statistics::DenseFrequencyContainer2>
48  public itk::ProcessObject
49 {
50 public:
56 
59 
61  itkNewMacro(Self);
62 
64  typedef TListSample ListSampleType;
65 
67  typedef typename itk::NumericTraits
68  <THistogramMeasurement>::RealType HistogramMeasurementRealType;
70  TFrequencyContainer> HistogramType;
72  typedef typename TListSample::MeasurementVectorType MeasurementVectorType;
75 
76  typedef typename TListSample::ConstPointer ListSampleConstPointerType;
77 
81 
82  // Set/Get the input list sample
83  void SetListSample(const ListSampleType* inputlist);
84  const ListSampleType* GetListSample() const;
85 
86  // Get the output histogram
87  const HistogramListType* GetOutput();
88 
89 
91 // void SetListSample(const TListSample* list)
92 // {
93 // m_List = list;
94 // }
95 
99  itkSetMacro(NoDataValue, THistogramMeasurement);
100 
104  itkGetConstReferenceMacro(NoDataValue, THistogramMeasurement);
105 
109  itkSetMacro(NoDataFlag, bool);
110 
114  itkGetMacro(NoDataFlag, bool);
115 
119  itkBooleanMacro(NoDataFlag);
120 
121 
122  void SetMarginalScale(float scale)
123  { m_MarginalScale = scale; }
124 
125  void SetNumberOfBins(unsigned int size)
126  {
127  m_Size[0] = size;
128  }
129 
130 // HistogramListPointerType GetOutput() const
131 // { return m_HistogramList; }
132 
133  itkSetMacro(AutoMinMax, bool);
134  itkGetConstReferenceMacro(AutoMinMax, bool);
135 
136  void SetHistogramMin(const MeasurementVectorType& histogramMin)
137  {
138  m_HistogramMin = histogramMin;
139  m_AutoMinMax = false;
140  }
141 
142  void SetHistogramMax(const MeasurementVectorType& histogramMax)
143  {
144  m_HistogramMax = histogramMax;
145  m_AutoMinMax = false;
146  }
147 
148 protected:
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;
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
OTBOSSIMAdapters_EXPORT char const * NoDataValue
itk::Statistics::Histogram< HistogramMeasurementRealType, TFrequencyContainer > HistogramType
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >...
Definition: otbObjectList.h:40
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Monteverdi_FLOATING_TYPE RealType
Definition: mvdTypes.h:84
Generates a list of 1D Histograms from a ListSample This class is similar to ListSampleToVariableDime...
void SetHistogramMax(const MeasurementVectorType &histogramMax)
itk::NumericTraits< THistogramMeasurement >::RealType HistogramMeasurementRealType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
void SetHistogramMin(const MeasurementVectorType &histogramMin)