SCM Repository
[diderot] Annotation of /trunk/test/vr-MIP.diderot
Annotation of /trunk/test/vr-MIP.diderot
Parent Directory
|
Revision Log
Revision 41 -
(view)
(download)
1 : |
glk |
41 |
// vr.diderot
|
2 : |
|
|
//
|
3 : |
|
|
// maximum intensity projection in Diderot
|
4 : |
|
|
//
|
5 : |
|
|
|
6 : |
|
|
input string dataFile; // name of dataset
|
7 : |
|
|
input real stepSz; // size of steps
|
8 : |
|
|
input vec<3> light;
|
9 : |
|
|
input int wid = 640;
|
10 : |
|
|
input int ht = 480;
|
11 : |
|
|
|
12 : |
|
|
image[3] img = load (dataFile);
|
13 : |
|
|
|
14 : |
|
|
field#1[3] F = convolve (bspln3, img);
|
15 : |
|
|
|
16 : |
|
|
actor RayCast (int row, int col)
|
17 : |
|
|
{
|
18 : |
|
|
vec<3> dir = (real(row), real(col), 0.0);
|
19 : |
|
|
vec<3> pos = (0.0, 0.0, 0.0);
|
20 : |
|
|
real t = 0.0;
|
21 : |
|
|
real maxval = -inf;
|
22 : |
|
|
int num = 0;
|
23 : |
|
|
|
24 : |
|
|
update
|
25 : |
|
|
{
|
26 : |
|
|
vec<3> pt = pos + t*dir;
|
27 : |
|
|
real val = F@pt;
|
28 : |
|
|
maxval = max(val, maxval);
|
29 : |
|
|
if (t > 1)
|
30 : |
|
|
stabilize;
|
31 : |
|
|
t = t + stepSz;
|
32 : |
|
|
num = num + 1;
|
33 : |
|
|
}
|
34 : |
|
|
|
35 : |
|
|
/* render: output maxval */
|
36 : |
|
|
}
|