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 770, Thu Apr 7 20:42:13 2011 UTC
# Line 1  Line 1 
1  // vr-MIP-test.diderot  // zslice2
 //  
 // test version of maximum intensity projection in Diderot  
 //  
2    
 string dataFile = "../data/zimg112.nrrd";  
3  int dataSize = 11;  int dataSize = 11;
4  int imgSize = 200;  int imgSize = 200;
5  vec3 orig = [0.0, 0.0, 5.0];  vec3 orig = [0.0, 0.0, 5.0];
6  vec3 cVec = [0.0, 1.0, 0.0];  vec3 cVec = [0.0, 1.0, 0.0];
7  vec3 rVec = [1.0, 0.0, 0.0];  vec3 rVec = [1.0, 0.0, 0.0];
8  image(3)[] img = load (dataFile);  // HEY (bug), next line causes:
9    //  uncaught exception Fail [Fail: Error in compiling zslice2.diderot]
10    //  raised at driver/main.sml:31.39-31.76
11    // but is this not valid syntax for creating field in one shot?
12    //field#2(3)[] F = (load("../data/zimg112.nrrd")) ⊛ bspln3;
13    // It is valid syntax, but there is a bug in the conversion from HighIL to MidIL
14    
15    image(3)[] img = load("../data/zimg112.nrrd");
16  //field#2(3)[] F = img ⊛ bspln3;  //field#2(3)[] F = img ⊛ bspln3;
17  //field#2(3)[] F = img ⊛ ctmr;  //field#2(3)[] F = img ⊛ ctmr;
18  field#0(3)[] F = img ⊛ tent;  //field#0(3)[] F = img ⊛ tent;
19    field#1(3)[] F = img ⊛ c1tent;
 // HEY new bug; this causes:  
 // uncaught exception Fail [Fail: toDim('shp008A)]  
 //  raised at ast/meta-var.sml:110.26-110.70  
 real tmp = |cVec|;  
20    
21  strand RayCast (int row, int col)  strand RayCast (int row, int col)
22  {  {
23      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);
24      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);
25      vec3 pos = orig + rr*rVec + cc*cVec;      vec3 pos = orig + rr*rVec + cc*cVec;
26      output real maxval = -∞;      output real val = -∞;
27    
28      update      update
29      {      {
30          if (inside (pos,F)) {          if (inside (pos,F)) {
31            maxval = F@pos;            val = F@pos;
32          }          }
33          stabilize;          stabilize;
34      }      }
   
     /* render: output maxval */  
35  }  }
36    
37  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.770

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