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

SCM Repository

[diderot] View of /trunk/test/zslice-etest.diderot
ViewVC logotype

View of /trunk/test/zslice-etest.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1671 - (download) (annotate)
Sun Dec 4 10:56:10 2011 UTC (7 years, 6 months ago) by jhr
File size: 1193 byte(s)
  Merging changes from pure-cfg branch back into trunk
/* zslice-etest.diderot
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * To check the output:
 *
 *      unu minmax zslice-etest.nrrd
 *
 * should return a min value of 0 and a max value close to 0.
 */

int dataSizeX = 71;
int dataSizeY = 45;
int imgSizeX = 10*dataSizeX;
int imgSizeY = 10*dataSizeY;
vec3 orig = [0.0, 0.0, 6.0];
vec3 xVec = [1.0, 0.0, 0.0];
vec3 yVec = [0.0, 1.0, 0.0];
image(3)[] img = load("../data/etest.nrrd");
field#2(3)[] F = img ⊛ bspln3;

strand sample (int xi, int yi) {
    real xx = lerp(-0.5, real(dataSizeX)-0.5, -0.5, real(xi), real(imgSizeX)-0.5);
    real yy = lerp(-0.5, real(dataSizeY)-0.5, -0.5, real(yi), real(imgSizeY)-0.5);
    vec3 pos = orig + xx*xVec + yy*yVec;
    output real val = 0.0; 

    update
    {
        if (inside (pos,F)) {
	    tensor[3,3] H = ∇⊗∇F(pos);
	    //val = trace(H);
	    vec3{3} v = evecs(H);
            real{3} l = evals(H);
            tensor[3,3] R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1} + l{2}*v{2}⊗v{2};
            val = |H - R|;
	}
        stabilize;
    }
}

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