glviewvol

view src/volume.h @ 3:32c4a7160350

den kanei kryo stin ellada
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 28 Dec 2014 21:48:15 +0200
parents cc9e0d8590e2
children 773f89037a35
line source
1 #ifndef VOLUME_H_
2 #define VOLUME_H_
4 #include <vector>
5 #include "image.h"
7 class Volume {
8 public:
9 virtual ~Volume();
11 // returns 0 if the volume is continuously defined
12 virtual int num_samples(int dim) const;
14 // central differences offset will be delta / num_samples for discrete volumes
15 // and delta for continuous volumes
16 virtual void normalf(float *norm, float x, float y, float z, float delta = 1.0);
17 virtual void normali(float *norm, int x, int y, int z);
19 virtual float valuef(float x, float y, float z) const = 0;
20 virtual float valuei(int x, int y, int z) const = 0;
21 };
23 class VoxelVolume : public Volume {
24 protected:
25 int size[3];
26 std::vector<Image> slices;
28 public:
29 VoxelVolume();
30 ~VoxelVolume();
32 bool load(const char *fname);
34 int num_samples(int dim) const;
36 float valuef(float x, float y, float z) const;
37 float valuei(int x, int y, int z) const;
38 };
40 #endif // VOLUME_H_