eleni@0: #ifndef VOLUME_H_ eleni@0: #define VOLUME_H_ eleni@0: elene@3: #include elene@3: #include "image.h" elene@3: elene@34: #define HIST_SIZE 256 elene@34: elene@9: class Mesh; elene@9: eleni@1: class Volume { eleni@1: private: elene@3: std::vector slices; elene@6: elene@4: int width; elene@4: int height; elene@5: float zaspect; elene@30: float x_rot; eleni@1: elene@6: unsigned int vol_tex; elene@6: mutable bool vol_tex_valid; elene@6: elene@6: void create_vol_tex() const; elene@6: elene@3: public: elene@34: int histogram[HIST_SIZE]; elene@34: int max_histogram_value; elene@34: elene@34: public: elene@3: Volume(); elene@6: ~Volume(); elene@3: elene@6: bool load(const char *fname); elene@6: elene@4: bool push_slice(Image &&slice); elene@6: const Image *get_slice(int num_slice) const; elene@9: elene@9: // z must be in [0, 1] elene@6: const Image *get_slice_by_z(float z) const; elene@9: elene@6: int get_slice_count() const; elene@6: elene@9: // z must be in [0, 1] elene@6: int get_slice_idx_by_z(float z) const; elene@6: elene@6: unsigned int get_texture() const; elene@3: elene@30: float get_volume_rotation() const; elene@30: elene@12: void create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres); elene@9: elene@34: void create_histogram(); elene@8: void draw() const; eleni@1: }; eleni@1: elene@16: float transfer_function(float x, float low_thres, float high_thres); elene@16: eleni@0: #endif // VOLUME_H_