OTB  9.0.0
Orfeo Toolbox
otbStatisticsXMLFileReader.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 #ifndef otbStatisticsXMLFileReader_h
22 #define otbStatisticsXMLFileReader_h
23 
24 #include "itkProcessObject.h"
25 #include <string>
26 
27 namespace otb
28 {
29 
41 template <class TMeasurementVector>
42 class StatisticsXMLFileReader : public itk::Object
43 {
44 public:
47  typedef itk::Object Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkTypeMacro(StatisticsXMLFileReader, itk::Object);
53 
55  itkNewMacro(Self);
56 
58  typedef TMeasurementVector MeasurementVectorType;
59  typedef typename MeasurementVectorType::ValueType InputValueType;
60 
62  typedef std::pair<std::string, MeasurementVectorType> InputDataType;
63  typedef std::vector<InputDataType> MeasurementVectorContainer;
64 
65  typedef std::map<std::string, std::string> GenericMapType;
66  typedef std::map<std::string, GenericMapType> GenericMapContainer;
67 
68  void Modified() const override
69  {
70  m_IsUpdated = false;
71  }
72 
74  itkSetStringMacro(FileName);
75  itkGetStringMacro(FileName);
77 
79  unsigned int GetNumberOfOutputs();
80 
82  std::vector<std::string> GetStatisticVectorNames();
83 
85  std::vector<std::string> GetStatisticMapNames();
86 
88  MeasurementVectorType GetStatisticVectorByName(const char* statisticName);
89 
91  template <typename MapType>
92  MapType GetStatisticMapByName(const char* statisticName);
93 
94 protected:
96  virtual void Read();
97 
100  {
101  }
102  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
103 
104 private:
105  StatisticsXMLFileReader(const Self&) = delete;
106  void operator=(const Self&) = delete;
107 
108  std::string m_FileName;
110  mutable bool m_IsUpdated;
112 
113 }; // end of class StatisticsXMLFileReader
114 
115 } // end of namespace otb
116 
117 #ifndef OTB_MANUAL_INSTANTIATION
119 #endif
120 
121 #endif
otb::StatisticsXMLFileReader::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbStatisticsXMLFileReader.hxx:236
otb::StatisticsXMLFileReader::MeasurementVectorContainer
std::vector< InputDataType > MeasurementVectorContainer
Definition: otbStatisticsXMLFileReader.h:63
otb::StatisticsXMLFileReader::GenericMapContainer
std::map< std::string, GenericMapType > GenericMapContainer
Definition: otbStatisticsXMLFileReader.h:66
otb::StatisticsXMLFileReader::GetStatisticVectorByName
MeasurementVectorType GetStatisticVectorByName(const char *statisticName)
Definition: otbStatisticsXMLFileReader.hxx:81
otb::StatisticsXMLFileReader::Self
StatisticsXMLFileReader Self
Definition: otbStatisticsXMLFileReader.h:46
otb::StatisticsXMLFileReader::GetStatisticVectorNames
std::vector< std::string > GetStatisticVectorNames()
Definition: otbStatisticsXMLFileReader.hxx:46
otb::StatisticsXMLFileReader::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStatisticsXMLFileReader.h:49
otb::StatisticsXMLFileReader::operator=
void operator=(const Self &)=delete
otb::StatisticsXMLFileReader::m_GenericMapContainer
GenericMapContainer m_GenericMapContainer
Definition: otbStatisticsXMLFileReader.h:111
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StatisticsXMLFileReader::GetNumberOfOutputs
unsigned int GetNumberOfOutputs()
Definition: otbStatisticsXMLFileReader.hxx:40
otb::StatisticsXMLFileReader::Read
virtual void Read()
Definition: otbStatisticsXMLFileReader.hxx:138
otb::StatisticsXMLFileReader::InputDataType
std::pair< std::string, MeasurementVectorType > InputDataType
Definition: otbStatisticsXMLFileReader.h:62
otb::StatisticsXMLFileReader::InputValueType
MeasurementVectorType::ValueType InputValueType
Definition: otbStatisticsXMLFileReader.h:59
otb::StatisticsXMLFileReader::MeasurementVectorType
TMeasurementVector MeasurementVectorType
Definition: otbStatisticsXMLFileReader.h:55
otb::StatisticsXMLFileReader::StatisticsXMLFileReader
StatisticsXMLFileReader()
Definition: otbStatisticsXMLFileReader.hxx:35
otbStatisticsXMLFileReader.hxx
otb::StatisticsXMLFileReader::GetStatisticMapNames
std::vector< std::string > GetStatisticMapNames()
Definition: otbStatisticsXMLFileReader.hxx:63
otb::StatisticsXMLFileReader::Superclass
itk::Object Superclass
Definition: otbStatisticsXMLFileReader.h:47
otb::StatisticsXMLFileReader
Read a xml file where are stored several statistics.
Definition: otbStatisticsXMLFileReader.h:42
otb::StatisticsXMLFileReader::GenericMapType
std::map< std::string, std::string > GenericMapType
Definition: otbStatisticsXMLFileReader.h:65
otb::StatisticsXMLFileReader::Modified
void Modified() const override
Definition: otbStatisticsXMLFileReader.h:68
otb::StatisticsXMLFileReader::m_FileName
std::string m_FileName
Definition: otbStatisticsXMLFileReader.h:108
otb::StatisticsXMLFileReader::GetStatisticMapByName
MapType GetStatisticMapByName(const char *statisticName)
Definition: otbStatisticsXMLFileReader.hxx:110
otb::StatisticsXMLFileReader::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStatisticsXMLFileReader.h:48
otb::StatisticsXMLFileReader::m_IsUpdated
bool m_IsUpdated
Definition: otbStatisticsXMLFileReader.h:110
otb::StatisticsXMLFileReader::~StatisticsXMLFileReader
~StatisticsXMLFileReader() override
Definition: otbStatisticsXMLFileReader.h:99
otb::StatisticsXMLFileReader::m_MeasurementVectorContainer
MeasurementVectorContainer m_MeasurementVectorContainer
Definition: otbStatisticsXMLFileReader.h:109