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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download)

1 : jhr 1671 /* zslice-etest.diderot
2 :     *
3 : jhr 3349 * 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-etest.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 3063 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] H = ∇⊗∇F(pos);
35 :     //val = trace(H);
36 :     vec3{3} v = evecs(H);
37 :     real{3} l = evals(H);
38 :     tensor[3,3] R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1} + l{2}*v{2}⊗v{2};
39 :     val = |H - R|;
40 :     }
41 :     stabilize;
42 :     }
43 :     }
44 :    
45 :     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