SCM Repository
[diderot] Annotation of /trunk/test/vr-MIP.diderot
Annotation of /trunk/test/vr-MIP.diderot
Parent Directory
|
Revision Log
Revision 142 -
(view)
(download)
1 : |
jhr |
142 |
// vr-MIP.diderot
|
2 : |
glk |
41 |
//
|
3 : |
|
|
// maximum intensity projection in Diderot
|
4 : |
|
|
//
|
5 : |
|
|
|
6 : |
|
|
input string dataFile; // name of dataset
|
7 : |
|
|
input real stepSz; // size of steps
|
8 : |
jhr |
142 |
input vec3 eye; // location of eye point
|
9 : |
|
|
input vec3 orig; // location of pixel (0,0)
|
10 : |
|
|
input vec3 cVec; // vector between pixels horizontally
|
11 : |
|
|
input vec3 rVec; // vector between pixels vertically
|
12 : |
glk |
41 |
|
13 : |
jhr |
142 |
image(3)[] img = load (dataFile);
|
14 : |
glk |
41 |
|
15 : |
jhr |
142 |
//field#1(3)[] F = convolve (bspln3, img);
|
16 : |
|
|
field#2(3)[] F = convolve (bspln3, img);
|
17 : |
|
|
|
18 : |
glk |
41 |
actor RayCast (int row, int col)
|
19 : |
|
|
{
|
20 : |
jhr |
142 |
vec3 pos = orig + real(row)*rVec + real(col)*cVec;
|
21 : |
|
|
vec3 dir = (pos - eye)/|pos - eye|;
|
22 : |
glk |
41 |
real t = 0.0;
|
23 : |
|
|
real maxval = -inf;
|
24 : |
|
|
int num = 0;
|
25 : |
|
|
|
26 : |
|
|
update
|
27 : |
|
|
{
|
28 : |
jhr |
142 |
vec3 pt = pos + t*dir;
|
29 : |
glk |
41 |
real val = F@pt;
|
30 : |
|
|
maxval = max(val, maxval);
|
31 : |
jhr |
142 |
if (t > 1.0)
|
32 : |
glk |
41 |
stabilize;
|
33 : |
|
|
t = t + stepSz;
|
34 : |
|
|
num = num + 1;
|
35 : |
|
|
}
|
36 : |
|
|
|
37 : |
|
|
/* render: output maxval */
|
38 : |
|
|
}
|
39 : |
jhr |
142 |
|
40 : |
|
|
initially [ RayCast(r, c) | r in 0..1023, c in 0..1023 ];
|