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

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/zslice2.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/zslice2.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 721, Fri Apr 1 22:37:57 2011 UTC revision 1352, Mon Jun 20 16:42:33 2011 UTC
# Line 1  Line 1 
1  // vr-MIP-test.diderot  // zslice2
 //  
 // test version of maximum intensity projection in Diderot  
2  //  //
3    // process output with:
4    // unu reshape -i zslice2.txt -s 200 200 | unu 2op exists - 0.1 | unu quantize -b 8 -o zslice2.png
5    
 string dataFile = "../data/zimg112.nrrd";  
6  int dataSize = 11;  int dataSize = 11;
7  int imgSize = 200;  int imgSize = 200;
8  vec3 orig = [0.0, 0.0, 5.0];  vec3 orig = [0.0, 0.0, 5.0];
9  vec3 cVec = [0.0, 1.0, 0.0];  vec3 cVec = [0.0, 1.0, 0.0];
10  vec3 rVec = [1.0, 0.0, 0.0];  vec3 rVec = [1.0, 0.0, 0.0];
 image(3)[] img = load (dataFile);  
 //field#2(3)[] F = img ⊛ bspln3;  
 //field#2(3)[] F = img ⊛ ctmr;  
 field#0(3)[] F = img ⊛ tent;  
11    
12  // HEY new bug; this causes:  image(3)[] img = load("../data/zimg112.nrrd");
13  // uncaught exception Fail [Fail: toDim('shp008A)]  // HEY (bug) bspln5 leads to problems:
14  //  raised at ast/meta-var.sml:110.26-110.70  //  uncaught exception Size [size]
15  real tmp = |cVec|;  //    raised at c-target/c-target.sml:47.15-47.19
16    //field#4(3)[] F = img ⊛ bspln5;
17    field#2(3)[] F = img ⊛ bspln3;
18    //field#2(3)[] F = img ⊛ ctmr;
19    //field#0(3)[] F = img ⊛ tent;
20    //field#1(3)[] F = img ⊛ c1tent;
21    
22  strand RayCast (int row, int col)  strand RayCast (int row, int col)
23  {  {
24      real rr = real(dataSize)*(real(row)+0.5)/real(imgSize) - 0.5;      real rr = lerp(-0.5, real(dataSize)-0.5, -0.5, real(row), real(imgSize)-0.5);
25      real cc = real(dataSize)*(real(col)+0.5)/real(imgSize) - 0.5;      real cc = lerp(-0.5, real(dataSize)-0.5, -0.5, real(col), real(imgSize)-0.5);
26      vec3 pos = orig + rr*rVec + cc*cVec;      vec3 pos = orig + rr*rVec + cc*cVec;
27      output real maxval = -∞;      output real val = -∞;
28    
29      update      update
30      {      {
31          if (inside (pos,F)) {          if (inside (pos,F)) {
32            maxval = F@pos;            val = F(pos);
33          }          }
34          stabilize;          stabilize;
35      }      }
   
     /* render: output maxval */  
36  }  }
37    
38  initially [ RayCast(r, c) | r in 0..(imgSize-1), c in 0..(imgSize-1) ];  initially [ RayCast(r, c) | r in 0..(imgSize-1), c in 0..(imgSize-1) ];
   
 // HEY output should be a single blob in the center of the image;  
 // an image of the bspln3 kernel  

Legend:
Removed from v.721  
changed lines
  Added in v.1352

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