DataSetStats.hpp
1 #pragma once
2 
3 #include "opals/config.hpp"
4 #include "opals/Vector.hpp"
5 #include "opals/Array.hpp"
6 #include "opals/Path.hpp"
7 #include "opals/DataSetType.hpp"
8 #include "opals/AttributeBandDescription.hpp"
9 #include "opals/IndexDescription.hpp"
10 
11 namespace opals
12 {
13  /// \brief DataSetStats provides generic information about a data file (use in opalsInfo).
14  ///
15  /// Beside the name, type, storage size (in bytes) and a nodata indicator of the attribute the
16  /// class provides basic statistic information such as min, max, mean and the standard deviation.
17  /// If a specific information is really set, can be retrieved by the corresponding isSet function.
18  /// Depending on the data type a specific no data value is used to indicate unset values.
19  ///
20  /// \author JO
21  /// \date 24.05.2012
22  class OPALS_API DataSetStats
23  {
24  public:
25  static DataSetStats merge(Vector<DataSetStats> &stats, bool mergeFilenames);
26  static DataSetStats readFromOverview(const Path &overviewFilename);
27 
28  typedef Array<double,6> ArrayD6;
32  typedef Array<double,2> ArrayD2;
34 
35  DataSetStats();
36  ~DataSetStats();
37 
38  void reset();
39 
40  // isSet functions ================================================
41  bool isEmpty() const;
42  bool hasValueFrequency() const;
43 
44  //common part
45  bool isSetFilename() const;
46  bool isSetType() const;
47  bool isSetVersion() const;
48  bool isSetCreator() const;
49  bool isSetBoundingBox() const;
50  bool isSetCoordRefSys() const;
51  // odm part
52  bool isSetPointCount() const;
53  bool isSetLineCount() const;
54  bool isSetPolygonCount() const;
55  bool isSetBoundaryPolygon() const;
56  bool isSetPointDensity() const;
57  bool isSetAttributes() const;
58  bool isSetIndices() const;
59  //Raster Part
60  bool isSetPixelCount() const;
61  bool isSetRasterDimension() const;
62  bool isSetBands() const;
63  bool isSetPixelSize() const;
64  bool isSetCompression() const;
65  bool isSetInterleave() const;
66  bool isSetErrorMessage() const;
67 
68  // Get functions ================================================
69  //common part
70  Path getFilename() const;
71  DataSetType getType() const;
72  String getVersion() const;
73  String getCreator() const;
74  ArrayD6 getBoundingBox() const;
75  int getBoundingBoxDim() const;
76  String getCoordRefSys() const;
77  // odm part
78  long long getPointCount() const;
79  long long getLineCount() const;
80  long long getPolygonCount() const;
81  StringVector getBoundaryPolygon() const;
82  double getPointDensity() const;
83  AttributeVector getAttributes() const;
84  IndexVector getIndices() const; ///< get info object about the spatial indices
85  //Raster Part
86  long long getPixelCount() const;
87  AttributeVector getBands() const;
88  ArrayD2 getPixelSize() const;
89  ArrayU2 getRasterDimension() const;
90  bool getPixelAreaOrPointFlag() const;
91  String getCompression() const;
92  String getInterleave() const;
93  String getErrorMessage() const;
94 
95  // set functions ================================================
96  //common part
97  void setFilename(const Path& Filename);
98  void setType(const DataSetType &Type);
99  void setVersion(const String &Version);
100  void setCreator(const String& Creator);
101  void setBoundingBox(const ArrayD6& BoundingBox);
102  void setBoundingBoxDim(const int& BoundingBoxDim);
103  void setCoordRefSys(const String& crs);
104  // odm part
105  void setPointCount(const long long& PointCount);
106  void setLineCount(const long long& LineCount);
107  void setPolygonCount(const long long& PolygonCount);
108  void setBoundaryPolygon(const StringVector& BoundaryPolygon);
109  void setPointDensity(const double &PointDensity);
110  void setAttributes(const AttributeVector& Attributes);
111  void setIndices(const IndexVector& Indecs);
112  //Raster Part
113  void setPixelCount(const long long& PixelCount);
114  void setBands(const AttributeVector& Bands) ;
115  void setPixelSize(const ArrayD2& PixelSize);
116  void setRasterDimension(const ArrayU2& dim);
117  void setPixelAreaOrPointFlag(const bool& PixelAreaOrPointFlag);
118  void setCompression(const String& Compression);
119  void setInterleave(const String& Interleave);
120  void setErrorMessage(const String& errorMessage);
121 
122  String logDataSetStats(int precision=3) const; ///< for xml output
123  String printDataSetStats() const; ///< for log output (in more readable format)
124  String printValueFrequency() const; ///< for log output (in more readable format)
125 
126  private:
127  Path filename;
128  DataSetType type;
129  String version;
130 
131  long long pointCount;
132  long long lineCount;
133  long long polygonCount;
134 
135  ArrayD6 boundingBox;
136  int boundingBoxDim;
137 
138  StringVector boundaryPolygon;
139  double pointDensity;
140 
141  String creator;
142  String coordRefSys;
143 
144  AttributeVector attributes;
145  IndexVector indices;
146 
147  long long pixelcount;
148  AttributeVector bands;
149 
150  ArrayD2 pixelsize;
151  ArrayU2 rasterdim;
152  bool pixelareaorpointflag;
153  String compression;
154  String interleave;
155 
156  String errorMessage;
157  };
158 }
DataSetType
Possible data set types as used in DataSetStats (see opalsInfo)
Definition: DataSetType.hpp:8
A file/directory path.
Definition: Path.hpp:26
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
Mimics std::vector<T>
Definition: fwd.hpp:18
DataSetStats provides generic information about a data file (use in opalsInfo).
Definition: DataSetStats.hpp:22
A dynamic character string whose interface conforms to STL's std::string.
Definition: String.hpp:35