input string dataFile = "../data/txs.nrrd";
real stepSz = 0.2;
vec3 eye = [25.0, 15.0, 10.0];
vec3 orig = [8.83877,2.5911,7.65275];
vec3 cVec = [-0.0151831,0.0278357,0.0];
vec3 rVec = [0.0074887,0.00408474,-0.0305383];
image(3)[] img = load (dataFile);
field#2(3)[] F = img ⊛ bspln3;
strand RayCast (int row, int col)
{
vec3 pos = orig + real(row)*rVec + real(col)*cVec;
vec3 dir = (pos - eye)/|pos - eye|;
real t = 0.0;
real transp = 1.0;
output real gray = 0.0;
update
{
pos = pos + stepSz*dir;
if (inside (pos,F)) {
real val = F@pos;
gray = gray + val;
}
if (t > 20.0) {
stabilize;
}
// HEY: this branch should never matter, since the value of
// transp is never changed from 1.0. However, commenting
// it out will result in a different result image
if (transp < 0.01) {
transp = 0.0;
stabilize;
}
t = t + stepSz;
}
}
initially [ RayCast(r, c) | r in 0..199, c in 0..199 ];