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

SCM Repository

[diderot] Annotation of /branches/tash/test/zslice-etest.diderot
ViewVC logotype

Annotation of /branches/tash/test/zslice-etest.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1927 - (view) (download)
Original Path: branches/vis12/test/zslice-etest.diderot

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-etest.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 : jhr 1927 image(3)[] img = image("../data/etest.nrrd");
21 : jhr 1671 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] H = ∇⊗∇F(pos);
33 :     //val = trace(H);
34 :     vec3{3} v = evecs(H);
35 :     real{3} l = evals(H);
36 :     tensor[3,3] R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1} + l{2}*v{2}⊗v{2};
37 :     val = |H - R|;
38 :     }
39 :     stabilize;
40 :     }
41 :     }
42 :    
43 :     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