VoxelBlur
Depth-of-field volume rendering
 All Classes Files Functions Variables Enumerations Enumerator
volumeloader.h
Go to the documentation of this file.
1 #ifndef VOLUMELOADER_H
2 #define VOLUMELOADER_H
3 
4 #include <QObject>
5 
15 {
19  QString name;
20 
25  enum class VolumeDataType
26  {
30  uchar=8,
34  ushort=16
35  } type;
36 
37  //the actual amount of data used for each voxel, if different from the data type
38  //if zero, means that the full value range is used
39  uchar actualBits;
40 
41  //maps to x, y, z coordinates
42  uint width;
43  uint height;
44  uint depth;
45 
46  //aspect ratios, currently not used
47  float aspectX;
48  float aspectY;
49  float aspectZ;
50 
51  //how many bytes to skip in the datafile (removing custom headers)
52  uint skipBytes;
53  QString dataFile;
54 
55  //identification of volume source
56  QString source;
57 
58  inline static QString enumToString(const VolumeDataType type)
59  {
60  switch (type)
61  {
63  return "uchar";
65  return "ushort";
66  default:
67  return "unknown";
68  }
69  }
70 
71  inline static VolumeDataType stringToEnum(const QString& str)
72  {
73  if(str.compare("ushort",Qt::CaseInsensitive)==0)
75  else
76  return VolumeDataType::uchar;
77  }
78 };
79 
86 class VolumeLoader : public QObject
87 {
88  Q_OBJECT
89 public:
90  explicit VolumeLoader(QObject *parent = nullptr);
91  ~VolumeLoader();
92 
99  bool getMetadata(const QFile& metadataFile,VolumeMetaData& metadata) const;
100 
106  QByteArray readVolume(const VolumeMetaData& d) const;
107 private:
108  bool readGZippedVolume(QFile& src,QByteArray& dest) const;
109 };
110 
111 QDebug operator<<(QDebug dbg, const VolumeMetaData& c);
112 
113 #endif // VOLUMELOADER_H
QString name
Derived from the metadata file name.
Definition: volumeloader.h:19
Class for loading volume meta data (VolumeMetaData) as well as the raw volume data itself...
Definition: volumeloader.h:86
bool getMetadata(const QFile &metadataFile, VolumeMetaData &metadata) const
Reads the metadata of a file.
Definition: volumeloader.cpp:27
VolumeDataType
Defines the supported data types.
Definition: volumeloader.h:25
QByteArray readVolume(const VolumeMetaData &d) const
Reads the volume represented by this metadata.
Definition: volumeloader.cpp:63
This class contains metadata for volumes, like dimensions and the file where the data can be found...
Definition: volumeloader.h:14