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

SCM Repository

[diderot] Diff of /trunk/test/vr-lite.diderot
ViewVC logotype

Diff of /trunk/test/vr-lite.diderot

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

revision 315, Tue Aug 17 22:03:44 2010 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 12  Line 12 
12  input vec3 rVec;                // vector between pixels vertically  input vec3 rVec;                // vector between pixels vertically
13  input real valOpacMin;          // highest value with opacity 0.0  input real valOpacMin;          // highest value with opacity 0.0
14  input real valOpacMax;          // lowest value with opacity 1.0  input real valOpacMax;          // lowest value with opacity 1.0
15    // valOpacMin,Max pairs for sample datasets:
16    // txs.nrrd 0.15, 0.35
17    // vfrhand-nohip.nhdr, for skin: 200, 500
18    // vfrhand-nohip.nhdr, for bone: 1330, 1630
19    
20  image(3)[] img = load (dataFile);  image(3)[] img = load (dataFile);
21    
22  //field#1(3)[] F = convolve (bspln3, img);  //field#1(3)[] F = convolve (bspln3, img);
23  field#2(3)[] F = img ⊛ bspln3;  field#2(3)[] F = img ⊛ bspln3;
24    
25  actor RayCast (int row, int col)  strand RayCast (int row, int col)
26  {  {
27      vec3 pos = orig + real(row)*rVec + real(col)*cVec;      vec3 pos = orig + real(row)*rVec + real(col)*cVec;
28      vec3 dir = (pos - eye)/|pos - eye|;      vec3 dir = (pos - eye)/|pos - eye|;
# Line 32  Line 36 
36          pos = pos + stepSz*dir;          pos = pos + stepSz*dir;
37          if (inside (pos,F)) {          if (inside (pos,F)) {
38              real val = F@pos;              real val = F@pos;
39              vec3 grad = (∇ F)@pos;              vec3 grad = ∇F@pos;
40              vec3 norm = -grad/|grad|;              vec3 norm = -grad/|grad|;
41              if (val > valOpacMin) {  // we have some opacity              if (val > valOpacMin) {  // we have some opacity
42                  real opac = 0.0;     // dummy initialization                  real opac =
43                  if (val > valOpacMax) {                          1.0 if (val > valOpacMax)
44                     opac = 1.0;                          else (val - valOpacMin)/(valOpacMax - valOpacMin);
                 } else {  
                    opac = (val - valOpacMin)/(valOpacMax - valOpacMin);  
                 }  
45                  gray = gray + transp*opac*max(0.0, dot(-dir,norm));                  gray = gray + transp*opac*max(0.0, dot(-dir,norm));
46                  transp = transp*(1.0 - opac);                  transp = transp*(1.0 - opac);
47              }              }
# Line 57  Line 58 
58    
59       stabilize {       stabilize {
60          rgba = [gray, gray, gray, 1.0-transp];          rgba = [gray, gray, gray, 1.0-transp];
         stabilize;  
61       }       }
62    
63      /* render: output rgba */      /* render: output rgba */

Legend:
Removed from v.315  
changed lines
  Added in v.511

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