f1402849
dmayerich
renewed commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#ifndef RTS_VOLUME_H
#define RTS_VOLUME_H
#include <time.h>
#include <iostream>
#include <fstream>
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
|