#ifndef RTS_VOLUME_H #define RTS_VOLUME_H #include #include #include using namespace std; class rtsVolume { private: unsigned char* m_data; //pointer to the volume data unsigned int m_size_x; //variables specifying the size of the volume unsigned int m_size_y; unsigned int m_size_z; //static function for copying 3D data from one pointer to another //this function does not test boundaries so can quite easily crash void blit3D(const unsigned char* source, unsigned int s_sx, unsigned int s_sy, unsigned int s_sz, unsigned char* dest, unsigned int d_px, unsigned int d_py, unsigned int d_pz, unsigned int d_sx, unsigned int d_sy, unsigned int d_sz); public: rtsVolume(); //construct a blank volume of a given size rtsVolume(unsigned int size_x, unsigned int size_y, unsigned int size_z); //construct a volume from specified data rtsVolume(const unsigned char* data, unsigned int size_x, unsigned int size_y, unsigned int size_z); rtsVolume(const rtsVolume &original); //copy constructor ~rtsVolume(); //overloaded operators rtsVolume& operator=(const rtsVolume& original); inline unsigned char operator()(unsigned int x, unsigned int y, unsigned int z); //load and save methods void open(const char* filename); void save(const char* filename); /*Allow resizing of the canvas. This resizes the volume without resizing the existing data within the volume*/ void resize_canvas(unsigned int size_x, unsigned int size_y, unsigned int size_z); void insert(const rtsVolume source, unsigned int pos_x, unsigned int pos_y, unsigned int pos_z); void blacken_border(); void invert(); void blacken(unsigned char threshold); void whiten(unsigned char threshold); //get functions unsigned char* get_bits(); unsigned int get_dimx() {return m_size_x;} unsigned int get_dimy() {return m_size_y;} unsigned int get_dimz() {return m_size_z;} }; #endif