cgv
Loading...
Searching...
No Matches
volume_io.h
1#pragma once
2
3#include <cgv/math/fmat.h>
4#include <cgv/utils/token.h>
5#include "volume.h"
6
7#include "../lib_begin.h"
8
9namespace cgv {
10 namespace media {
11 namespace volume {
12
13 struct CGV_API volume_info
14 {
15 volume::dimension_type dimensions;
17 volume::point_type position;
19 std::string path;
20
23 size_t get_data_size() const;
25 volume_info(const volume& V, const std::string& path = "");
26 };
27
28 extern CGV_API bool read_volume(const std::string& file_name, volume& V, volume_info* info_ptr = 0);
29
30 extern CGV_API bool write_volume(const std::string& file_name, const volume& V, const std::string& options = "");
31
32 extern CGV_API bool read_vox_header(const std::string& file_name, volume_info& info, bool(*unknown_line_callback)(const std::string& line, const std::vector<cgv::utils::token>&, volume_info& info) = 0);
33
34 extern CGV_API bool read_header(const std::string& file_name, volume_info& info, bool(*unknown_line_callback)(const std::string& line, const std::vector<cgv::utils::token>&, volume_info& info) = 0);
35
36 extern CGV_API bool write_vox_header(const std::string& file_name, const volume_info& info);
37
38 extern CGV_API bool write_header(const std::string& file_name, const volume& V);
39
40 extern CGV_API bool read_volume_binary(const std::string& file_name, const volume_info& info, volume& V, size_t offset = 0);
41
42 extern CGV_API void toggle_volume_endian(volume& V);
43
44 extern CGV_API bool write_volume_binary(const std::string& file_name, const volume& V, size_t offset = 0);
45
46
47 enum FileOrganisation {
48 FO_SINGLE,
49 FO_SLICES,
50 FO_TILES,
51 FO_OCTREE
52 };
53
54 enum FileFormat {
55 FF_ASCII,
56 FF_BINARY,
57 FF_PNG,
58 FF_TIFF
59 };
60
62 {
63 std::string file_name_pattern;
64 int first_file_index, file_index_step, last_file_index;
65 int first_channel_file_index, file_channel_index_step, last_channel_file_index;
66 };
67
69 {
70 };
71
73 {
74 volume::dimension_type tile_counts;
75 volume::dimension_type tile_size;
76 };
77
79 {
80 std::string child_directory_names[8];
81 };
82
83 struct CGV_API voxel_file_info
84 {
92 bool byte_order_MSB;
96 FileOrganisation file_organisation;
98 union {
99 std::string* file_name_ptr;
100 slice_file_organisation_info* slice_file_info_ptr;
101 tile_file_organisation_info* tile_file_info_ptr;
102 octree_file_organisation_info* octree_file_info_ptr;
103 };
105 FileFormat file_format;
109 };
110
111 }
112 }
113}
114
115#include <cgv/config/lib_end.h>
the component format inherits the information of a packing_info and adds information on the component...
matrix of fixed size dimensions
Definition fmat.h:23
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
TypeId
ids for the different types and type constructs
Definition type_id.h:12
the cgv namespace
Definition print.h:11
int header_size
if header size is -1, it is computed from file size minus the size needed for all elements
Definition volume_io.h:94
cgv::data::component_format voxel_format
voxel format
Definition volume_io.h:90
volume::extent_type voxel_scaling
array with size of voxel in x-, y-, and z-direction
Definition volume_io.h:88
volume::dimension_type voxel_counts
array of voxel counts in all three dimension, i.e. 128,128,128
Definition volume_io.h:86
FileOrganisation file_organisation
file organisation
Definition volume_io.h:96