-
Notifications
You must be signed in to change notification settings - Fork 5
/
DRRgenerator.h
76 lines (61 loc) · 1.89 KB
/
DRRgenerator.h
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
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef DRRGENERATOR_H
#define DRRGENERATOR_H
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <ctime>
#include <opencv2/core/core.hpp>
#include <omp.h>
#include <math.h>
#include <opencv2/opencv.hpp>
#include <Eigen/Core>
#include <Eigen/Dense>
#define _USE_MATH_DEFINES
using namespace Eigen;
using namespace std;
struct CameraDataGPU
{
cv::Mat intrinsics_video;
cv::Mat extrinsics_video;
CameraDataGPU(){}
};
template <typename T>
class CTvolume {
public:
int size_x, size_y, size_z;
float voxel_size_x,voxel_size_y,voxel_size_z;
T default_value;
T* data ;
float * offset;
int typevalue;
CTvolume(){}
CTvolume(int sx, int sy, int sz, double voxel_sx,double voxel_sy,double voxel_sz, T const default_v) :
size_x(sx), size_y(sy), size_z(sz), voxel_size_x(voxel_sx), voxel_size_y(voxel_sy),voxel_size_z(voxel_sz),default_value(default_v) {
data= new T [sx * sy * sz];
std::fill_n(data, sx * sy * sz, default_v);
offset= new float [3];
std::fill_n(offset, 3, 0);
typevalue=1;
}
T& at(int x, int y, int z) {return data[x + size_x * y + size_x * size_y * z];}
T at(int x, int y, int z) const {return data[x + size_x * y + size_x * size_y * z];}
};
class DRRgenerator
{
private:
CTvolume<short> CTvol;
CameraDataGPU cam;
void split(const string &s, vector<string> &elems);
public:
DRRgenerator();
void load_CT(std::string filename_raw,std::string info);
Eigen::Isometry3f cv2eigeniso(cv::Mat transfo);
void raytracegpu( cv::Mat &color);
float trilinear_interpolation(short *a,cv::Point3f pt);
float attenuation_lookup_hu (float pix_density);
float attenuation_lookup (float pix_density);
void findentryandexitpoint(Vector3f startpoint, Vector3f ray, double &texitpoint, double &tentrypoint);
};
#endif // DRRGENERATOR_H