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

SCM Repository

[diderot] Annotation of /branches/vis12/test/hlic/hlic-working.diderot
ViewVC logotype

Annotation of /branches/vis12/test/hlic/hlic-working.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1927 - (view) (download)

1 : glk 1741 // hlic.diderot
2 :     //
3 :     // simple demo of "hyperlic" (LIC on eigenvectors)
4 :     // unu reshape -i mip.txt -s 300 200 | unu quantize -b 8 -o lic.png
5 :    
6 :     int imgSize = 200;
7 :     real h = 0.25; // step size of integration
8 :     int stepNum = 15; // take this many steps both upstream and downstream
9 :    
10 : jhr 1927 //field#1(2)[2] V0 = image("tor2slice-vec0.nrrd") ⊛ ctmr;
11 :     //field#1(2)[2] V1 = image("tor2slice-vec1.nrrd") ⊛ ctmr;
12 :     field#1(2)[2] V = image("tor2slice-evec.nrrd") ⊛ ctmr;
13 :     field#0(2)[] R = image("tor2slice-rand.nrrd") ⊛ tent;
14 : glk 1741
15 :     strand LIC (int xi, int yi) {
16 :     real xx = lerp(0.0, 79.0, -0.5, real(xi), real(imgSize)-0.5);
17 :     real yy = lerp(0.0, 79.0, -0.5, real(yi), real(imgSize)-0.5);
18 :     vec2 pos0 = [xx,yy];
19 :     vec2 pos = pos0;
20 :     vec2 step = [0.0,0.0];
21 :     output real out = 0.0;
22 :     real sum = 0.0;
23 :     int num = 0;
24 :     real dir = 1.0;
25 :    
26 :     update {
27 :     // vec2 vv0 = V0(pos);
28 :     // vec2 vv1 = V1(pos);
29 :     // tensor[2,2] tt = [vv0,vv1];
30 :     step = h*dir*V(pos);
31 :     if (inside(pos + step, V)) {
32 :     pos += step;
33 :     }
34 :     if (num == stepNum) {
35 :     if (dir > 0.0) {
36 :     num = 0;
37 :     pos = pos0;
38 :     dir = -1.0;
39 :     }
40 :     }
41 :     if (num == stepNum && dir < 0.0) {
42 :     stabilize;
43 :     }
44 :     sum += R(pos);
45 :     num += 1;
46 :     }
47 :    
48 :     stabilize {
49 :     out = sum;
50 :     }
51 :     }
52 :    
53 :     initially [ LIC(xi, yi) | yi in 0..(imgSize-1), xi in 0..(imgSize-1) ];

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