volmetrics

view src/volume.h @ 37:1d935677d3ab

Created new branch non-qt-version
author Eleni Maria Stea <elene.mst@gmail.com>
date Mon, 17 Apr 2017 13:26:24 +0000
parents e548d95e0667
children
line source
1 #ifndef VOLUME_H_
2 #define VOLUME_H_
4 #include <vector>
5 #include "image.h"
7 #define HIST_SIZE 256
9 class Mesh;
11 class Volume {
12 private:
13 std::vector<Image> slices;
15 int width;
16 int height;
17 float zaspect;
18 float x_rot;
20 unsigned int vol_tex;
21 mutable bool vol_tex_valid;
23 void create_vol_tex() const;
25 public:
26 int histogram[HIST_SIZE];
27 int max_histogram_value;
29 public:
30 Volume();
31 ~Volume();
33 bool load(const char *fname);
35 bool push_slice(Image &&slice);
36 const Image *get_slice(int num_slice) const;
38 // z must be in [0, 1]
39 const Image *get_slice_by_z(float z) const;
41 int get_slice_count() const;
43 // z must be in [0, 1]
44 int get_slice_idx_by_z(float z) const;
46 unsigned int get_texture() const;
48 float get_volume_rotation() const;
50 void create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres);
52 void create_histogram();
53 void draw() const;
54 };
56 float transfer_function(float x, float low_thres, float high_thres);
58 #endif // VOLUME_H_