OTB  10.0.0
Orfeo Toolbox
otbStatisticsXMLFileWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbStatisticsXMLFileWriter_h
22 #define otbStatisticsXMLFileWriter_h
23 
24 #include "itkProcessObject.h"
25 #include <utility>
26 #include <string>
27 
28 namespace otb
29 {
30 
43 template <class TMeasurementVector>
44 class StatisticsXMLFileWriter : public itk::Object
45 {
46 public:
49  typedef itk::Object Superclass;
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52 
54  itkTypeMacro(StatisticsXMLFileWriter, itk::Object);
55 
57  itkNewMacro(Self);
58 
60  typedef TMeasurementVector MeasurementVectorType;
61  typedef typename MeasurementVectorType::ValueType InputValueType;
62 
64  typedef std::pair<std::string, MeasurementVectorType> InputDataType;
65  typedef std::vector<InputDataType> MeasurementVectorContainer;
66 
67  typedef std::map<std::string, std::string> GenericMapType;
68  typedef std::map<std::string, GenericMapType> GenericMapContainer;
69 
71  void AddInput(const char* name, const MeasurementVectorType& inputVector);
72 
74  template <typename MapType>
75  void AddInputMap(const char* name, const MapType& map);
76 
78  void CleanInputs();
79 
81  void Update()
82  {
83  this->GenerateData();
84  }
85 
87  itkSetStringMacro(FileName);
88  itkGetStringMacro(FileName);
90 
91 protected:
92  virtual void GenerateData();
93 
96  {
97  }
98  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
99 
100 private:
101  StatisticsXMLFileWriter(const Self&) = delete;
102  void operator=(const Self&) = delete;
103 
104  std::string m_FileName;
107 
108 }; // end of class StatisticsXMLFileWriter
109 
110 } // end of namespace otb
111 
112 #ifndef OTB_MANUAL_INSTANTIATION
114 #endif
115 
116 #endif
Write in a xml file the values stored in a MeasurementVector set as input.
std::map< std::string, std::string > GenericMapType
void AddInput(const char *name, const MeasurementVectorType &inputVector)
MeasurementVectorContainer m_MeasurementVectorContainer
void AddInputMap(const char *name, const MapType &map)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)=delete
std::vector< InputDataType > MeasurementVectorContainer
StatisticsXMLFileWriter(const Self &)=delete
std::map< std::string, GenericMapType > GenericMapContainer
std::pair< std::string, MeasurementVectorType > InputDataType
MeasurementVectorType::ValueType InputValueType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.