OTB  9.0.0
Orfeo Toolbox
otbPathListToHistogramGenerator.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 
22 #ifndef otbPathListToHistogramGenerator_h
23 #define otbPathListToHistogramGenerator_h
24 
25 #include "itkSampleToHistogramFilter.h"
26 #include "itkHistogram.h"
27 #include "itkListSample.h"
28 #include "itkVector.h"
29 #include "otbObjectList.h"
30 
31 // TODO : write a HistogramSource when outputting Histogram
32 
33 namespace otb
34 {
35 
48 template <class TPath, class TFunction>
49 class PathListToHistogramGenerator : public itk::ProcessObject
50 {
51 public:
54  typedef itk::ProcessObject Superclass;
55  typedef itk::SmartPointer<Self> Pointer;
56  typedef itk::SmartPointer<const Self> ConstPointer;
57 
59  itkTypeMacro(PathListToHistogramGenerator, itk::ProcessObject);
60 
62  itkNewMacro(Self);
63 
64  typedef TPath PathType;
65  typedef typename PathType::Pointer PathPointer;
67 
68  typedef TFunction FunctionType;
69 
70  typedef typename TFunction::OutputType RealType;
71 
73  typedef itk::Vector<MeasurementType, 1> ListSampleVectorType;
74  typedef itk::Statistics::ListSample<ListSampleVectorType> ListSampleType;
75  typedef typename ListSampleType::Pointer ListSamplePointer;
76  typedef typename ListSampleType::ConstPointer ListSampleConstPointer;
77 
78  typedef itk::Statistics::DenseFrequencyContainer2 FrequencyContainerType;
79  typedef itk::Statistics::Histogram<MeasurementType, FrequencyContainerType> HistogramType;
80 
81  typedef itk::Statistics::SampleToHistogramFilter<ListSampleType, HistogramType> GeneratorType;
82  typedef typename GeneratorType::Pointer GeneratorPointer;
83 
84  typedef typename HistogramType::Pointer HistogramPointer;
85  typedef typename HistogramType::ConstPointer HistogramConstPointer;
86  typedef typename HistogramType::SizeType SizeType;
87  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
88 
90  typedef typename Superclass::DataObjectPointer DataObjectPointer;
91  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
92 
93  void GraftNthOutput(unsigned int idx, itk::DataObject* graft);
94  void GraftOutput(itk::DataObject* graft);
95 
96 public:
98  using Superclass::SetInput;
99  void SetInput(const PathListType* path);
100  const PathListType* GetInput() const;
102 
103  // Return the output histogram.
104  const HistogramType* GetOutput() const;
105 
107  void SetNumberOfBins(const SizeType& size);
108 
110  void SetMarginalScale(double marginalScale);
111  void SetHistogramMin(const MeasurementVectorType& histogramMin);
112  void SetHistogramMax(const MeasurementVectorType& histogramMax);
113  void SetAutoMinMax(bool autoMinMax);
115 
116 protected:
119  {
120  }
121  void GenerateData() override;
123  using Superclass::MakeOutput;
124 
125  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
126 
127 private:
129 };
130 
131 } // end of namespace OTB
132 
133 #ifndef OTB_MANUAL_INSTANTIATION
135 #endif
136 
137 #endif
otb::PathListToHistogramGenerator::MeasurementType
RealType MeasurementType
Definition: otbPathListToHistogramGenerator.h:72
otb::PathListToHistogramGenerator::GenerateData
void GenerateData() override
Definition: otbPathListToHistogramGenerator.hxx:107
otb::PathListToHistogramGenerator::FrequencyContainerType
itk::Statistics::DenseFrequencyContainer2 FrequencyContainerType
Definition: otbPathListToHistogramGenerator.h:78
otb::PathListToHistogramGenerator::~PathListToHistogramGenerator
~PathListToHistogramGenerator() override
Definition: otbPathListToHistogramGenerator.h:118
otb::PathListToHistogramGenerator::SetAutoMinMax
void SetAutoMinMax(bool autoMinMax)
Definition: otbPathListToHistogramGenerator.hxx:166
otb::PathListToHistogramGenerator::SetHistogramMin
void SetHistogramMin(const MeasurementVectorType &histogramMin)
Definition: otbPathListToHistogramGenerator.hxx:154
otb::PathListToHistogramGenerator::SetMarginalScale
void SetMarginalScale(double marginalScale)
Definition: otbPathListToHistogramGenerator.hxx:148
otb::PathListToHistogramGenerator::ListSamplePointer
ListSampleType::Pointer ListSamplePointer
Definition: otbPathListToHistogramGenerator.h:75
otb::PathListToHistogramGenerator::PathType
TPath PathType
Definition: otbPathListToHistogramGenerator.h:62
otb::PathListToHistogramGenerator::m_HistogramGenerator
GeneratorPointer m_HistogramGenerator
Definition: otbPathListToHistogramGenerator.h:128
otb::PathListToHistogramGenerator::SetInput
void SetInput(const PathListType *path)
Definition: otbPathListToHistogramGenerator.hxx:42
otb::PathListToHistogramGenerator::RealType
TFunction::OutputType RealType
Definition: otbPathListToHistogramGenerator.h:70
otb::PathListToHistogramGenerator::GetInput
const PathListType * GetInput() const
Definition: otbPathListToHistogramGenerator.hxx:49
otb::PathListToHistogramGenerator::ListSampleType
itk::Statistics::ListSample< ListSampleVectorType > ListSampleType
Definition: otbPathListToHistogramGenerator.h:74
otb::PathListToHistogramGenerator::ListSampleConstPointer
ListSampleType::ConstPointer ListSampleConstPointer
Definition: otbPathListToHistogramGenerator.h:76
otb::PathListToHistogramGenerator::GeneratorType
itk::Statistics::SampleToHistogramFilter< ListSampleType, HistogramType > GeneratorType
Definition: otbPathListToHistogramGenerator.h:81
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbPathListToHistogramGenerator.hxx
otb::PathListToHistogramGenerator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPathListToHistogramGenerator.h:55
otb::PathListToHistogramGenerator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbPathListToHistogramGenerator.h:56
otb::PathListToHistogramGenerator::HistogramConstPointer
HistogramType::ConstPointer HistogramConstPointer
Definition: otbPathListToHistogramGenerator.h:85
otb::PathListToHistogramGenerator
This class generates an histogram from a list of path.
Definition: otbPathListToHistogramGenerator.h:49
otb::PathListToHistogramGenerator::DataObjectPointer
Superclass::DataObjectPointer DataObjectPointer
Definition: otbPathListToHistogramGenerator.h:90
otb::PathListToHistogramGenerator::Self
PathListToHistogramGenerator Self
Definition: otbPathListToHistogramGenerator.h:53
otb::PathListToHistogramGenerator::SizeType
HistogramType::SizeType SizeType
Definition: otbPathListToHistogramGenerator.h:86
otb::PathListToHistogramGenerator::SetHistogramMax
void SetHistogramMax(const MeasurementVectorType &histogramMax)
Definition: otbPathListToHistogramGenerator.hxx:160
otb::PathListToHistogramGenerator::FunctionType
TFunction FunctionType
Definition: otbPathListToHistogramGenerator.h:68
otb::PathListToHistogramGenerator::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbPathListToHistogramGenerator.hxx:172
otbObjectList.h
otb::PathListToHistogramGenerator::PathListToHistogramGenerator
PathListToHistogramGenerator()
Definition: otbPathListToHistogramGenerator.hxx:31
otb::PathListToHistogramGenerator::MeasurementVectorType
HistogramType::MeasurementVectorType MeasurementVectorType
Definition: otbPathListToHistogramGenerator.h:87
otb::PathListToHistogramGenerator::Superclass
itk::ProcessObject Superclass
Definition: otbPathListToHistogramGenerator.h:54
otb::PathListToHistogramGenerator::SetNumberOfBins
void SetNumberOfBins(const SizeType &size)
Definition: otbPathListToHistogramGenerator.hxx:142
otb::PathListToHistogramGenerator::GraftNthOutput
void GraftNthOutput(unsigned int idx, itk::DataObject *graft)
Definition: otbPathListToHistogramGenerator.hxx:72
otb::PathListToHistogramGenerator::PathPointer
PathType::Pointer PathPointer
Definition: otbPathListToHistogramGenerator.h:65
otb::PathListToHistogramGenerator::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbPathListToHistogramGenerator.h:91
otb::PathListToHistogramGenerator::ListSampleVectorType
itk::Vector< MeasurementType, 1 > ListSampleVectorType
Definition: otbPathListToHistogramGenerator.h:73
otb::PathListToHistogramGenerator::HistogramType
itk::Statistics::Histogram< MeasurementType, FrequencyContainerType > HistogramType
Definition: otbPathListToHistogramGenerator.h:79
otb::PathListToHistogramGenerator::MakeOutput
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) override
Definition: otbPathListToHistogramGenerator.hxx:92
otb::PathListToHistogramGenerator::PathListType
ObjectList< PathType > PathListType
Definition: otbPathListToHistogramGenerator.h:66
otb::ObjectList
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:40
otb::PathListToHistogramGenerator::HistogramPointer
HistogramType::Pointer HistogramPointer
Definition: otbPathListToHistogramGenerator.h:84
otb::PathListToHistogramGenerator::GetOutput
const HistogramType * GetOutput() const
Definition: otbPathListToHistogramGenerator.hxx:101
otb::PathListToHistogramGenerator::GraftOutput
void GraftOutput(itk::DataObject *graft)
Definition: otbPathListToHistogramGenerator.hxx:62
otb::PathListToHistogramGenerator::GeneratorPointer
GeneratorType::Pointer GeneratorPointer
Definition: otbPathListToHistogramGenerator.h:82