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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3291 - (view) (download)

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