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

SCM Repository

[diderot] Annotation of /trunk/test/zslice-etest2.diderot
ViewVC logotype

Annotation of /trunk/test/zslice-etest2.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1671 - (view) (download)

1 : jhr 1671 /* zslice-etest.diderot
2 :     *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * To check the output:
7 :     *
8 :     * unu minmax zslice-etest2.nrrd
9 :     *
10 :     * should return a min value of 0 and a max value close to 0.
11 :     */
12 :    
13 :     int dataSizeX = 71;
14 :     int dataSizeY = 45;
15 :     int imgSizeX = 10*dataSizeX;
16 :     int imgSizeY = 10*dataSizeY;
17 :     vec3 orig = [0.0, 0.0, 6.0];
18 :     vec3 xVec = [1.0, 0.0, 0.0];
19 :     vec3 yVec = [0.0, 1.0, 0.0];
20 :     image(3)[] img = load("../data/etest.nrrd");
21 :     field#2(3)[] F = img ⊛ bspln3;
22 :    
23 :     strand sample (int xi, int yi) {
24 :     real xx = lerp(-0.5, real(dataSizeX)-0.5, -0.5, real(xi), real(imgSizeX)-0.5);
25 :     real yy = lerp(-0.5, real(dataSizeY)-0.5, -0.5, real(yi), real(imgSizeY)-0.5);
26 :     vec3 pos = orig + xx*xVec + yy*yVec;
27 :     output real val = 0.0;
28 :    
29 :     update
30 :     {
31 :     if (inside (pos,F)) {
32 :     tensor[3,3] J = ∇⊗∇F(pos);
33 :     tensor[2,2] H01 = [[J[0,0], J[0,1]], [J[1,0], J[1,1]]];
34 :     tensor[2,2] H02 = [[J[0,0], J[0,2]], [J[2,0], J[2,2]]];
35 :     tensor[2,2] H12 = [[J[1,1], J[1,2]], [J[1,2], J[2,2]]];
36 :     vec2{2} v = evecs(H01);
37 :     real{2} l = evals(H01);
38 :     tensor[2,2] R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1};
39 :     val += |H01 - R|;
40 :     v = evecs(H02);
41 :     l = evals(H02);
42 :     R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1};
43 :     val += |H02 - R|;
44 :     v = evecs(H12);
45 :     l = evals(H12);
46 :     R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1};
47 :     val += |H12 - R|;
48 :     }
49 :     stabilize;
50 :     }
51 :     }
52 :    
53 :     initially [ sample(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];

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