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

SCM Repository

[diderot] Annotation of /tests/new-tests/zslice2-clamp.diderot
ViewVC logotype

Annotation of /tests/new-tests/zslice2-clamp.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (view) (download)

1 : glk 4640 #version 2.0
2 :    
3 :     // zslice2
4 :     //
5 :     // a version of the zslice2 example with clamping the image
6 :     //
7 :     // process output with:
8 :     // unu reshape -i zslice2.txt -s 200 200 | unu 2op exists - 0.1 | unu quantize -b 8 -o zslice2.png
9 :    
10 :     int dataSize = 11;
11 :     int imgSize = 200;
12 :     vec3 orig = [0.0, 0.0, 5.0];
13 :     vec3 cVec = [0.0, 1.0, 0.0];
14 :     vec3 rVec = [1.0, 0.0, 0.0];
15 :    
16 :     image(3)[] img = clamp(load_image("data/zimg112.nrrd"));
17 :    
18 :     field#2(3)[] F = img ⊛ bspln3;
19 :    
20 :     strand RayCast (int row, int col)
21 :     {
22 :     real rr = lerp(-0.5, real(dataSize)-0.5, -0.5, real(row), real(imgSize)-0.5);
23 :     real cc = lerp(-0.5, real(dataSize)-0.5, -0.5, real(col), real(imgSize)-0.5);
24 :     vec3 pos = orig + rr*rVec + cc*cVec;
25 :     output real val = -∞;
26 :    
27 :     update {
28 :     val = F(pos);
29 :     stabilize;
30 :     }
31 :     }
32 :    
33 :     create_array { 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