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

SCM Repository

[diderot] View of /branches/pure-cfg/test/zslice-rgb.diderot
ViewVC logotype

View of /branches/pure-cfg/test/zslice-rgb.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 875 - (download) (annotate)
Tue Apr 19 23:44:01 2011 UTC (9 years, 1 month ago) by glk
File size: 1021 byte(s)
test program for probing vector images
int imgRes = 200;
int dataRes = 110;

// These 3 lines work for probing the per-component images
//image(2)[] imgR=load("../data/hue-0.nrrd"); field#2(2)[] RR=imgR ⊛ bspln3;
//image(2)[] imgG=load("../data/hue-1.nrrd"); field#2(2)[] GG=imgG ⊛ bspln3;
//image(2)[] imgB=load("../data/hue-2.nrrd"); field#2(2)[] BB=imgB ⊛ bspln3;

// This should work for probing the RGB image
image(2)[3] imgRGB=load("../data/hue.nhdr"); field#2(2)[3] RGB=imgRGB ⊛ bspln3;

strand RayCast (int ui, int vi)
{
    vec2 pos = [lerp(-1.0, 1.0, -0.5, real(ui), real(imgRes)-0.5),
                lerp(-1.0, 1.0, -0.5, real(vi), real(imgRes)-0.5)];
    output vec3 rgb = [0.0,0.0,0.0];

    update
    {

       // How to probe the per-component images
       //rgb = [RR@pos,GG@pos,BB@pos] if inside(pos,RR) else [0.0,0.0,0.0];

       // How to probe the single RGB image
       rgb = RGB@pos if inside(pos,RGB) else [0.0,0.0,0.0];

       stabilize;
    }
}

initially [ RayCast(ui, vi) | vi in 0..(imgRes-1), ui in 0..(imgRes-1) ];

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