Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/vis12/test/zslice-grad.diderot
ViewVC logotype

Annotation of /branches/vis12/test/zslice-grad.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1685 - (view) (download)

1 : jhr 1115 // zslice-grad
2 :    
3 :     string dataFile = "../data/zimg11.nrrd";
4 :     int dataSize = 11;
5 :     int imgSize = 200;
6 :     vec3 orig = [0.0, 0.0, 5.0];
7 :     vec3 cVec = [0.0, 1.0, 0.0];
8 :     vec3 rVec = [1.0, 0.0, 0.0];
9 :     image(3)[] img = load (dataFile);
10 :     field#2(3)[] F = img ⊛ bspln3;
11 :    
12 :     strand RayCast (int row, int col)
13 :     {
14 :     real rr = lerp(-0.5, real(dataSize)-0.5, -0.5, real(row), real(imgSize)-0.5);
15 :     real cc = lerp(-0.5, real(dataSize)-0.5, -0.5, real(col), real(imgSize)-0.5);
16 :     vec3 pos = orig + rr*rVec + cc*cVec;
17 :     output vec3 grad = [0.0, 0.0, 0.0];
18 :    
19 :     update
20 :     {
21 :     grad = ∇F@pos if inside (pos,F) else [0.0, 0.0, 0.1];
22 :     stabilize;
23 :     }
24 :    
25 :     /* output grad */
26 :     }
27 :    
28 :     initially [ RayCast(r, c) | r in 0..(imgSize-1), c in 0..(imgSize-1) ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0