Making this dataset could be done entirely with unu, but it would be ugly. There's a "test" program, teem/src/nrrd/test/quadvol which is used instead:
Then, making the volume quad.nrrd is an unglamorous task, since it is really a 2-D array of subvolume, each of which has to be created sligtly differently. The ordering below tries to reflect the scan-line ordering of the subvolumes:cd teem-1.5/src/nrrd make alias quadvol `pwd`/test/quadvol
alias PAD "unu pad -min -1 -1 0 -max M+1 M+1 M -b pad -v -3" alias QUAD "quadvol -s 20 20 20 -min -1.1 -1.1 -1.1 -max 1.1 1.1 1.1 " setenv v 0.33 setenv V 0.66 QUAD -c $V -$V -off 0.00 | PAD -o 04.nrrd QUAD -c $v -$V -off 0.22 | PAD -o 14.nrrd QUAD -c 0 -$V -off 0.45 | PAD -o 24.nrrd QUAD -c -$v -$V -off 0.67 | PAD -o 34.nrrd QUAD -c -$V -$V -off 0.90 | PAD -o 44.nrrd QUAD -c $V -$v -off -0.22 | PAD -o 03.nrrd QUAD -c $v -$v -off -0.00 | PAD -o 13.nrrd QUAD -c 0 -$v -off 0.23 | PAD -o 23.nrrd QUAD -c -$v -$v -off 0.45 | PAD -o 33.nrrd QUAD -c $V 0 -off -0.45 | PAD -o 02.nrrd QUAD -c $v 0 -off -0.23 | PAD -o 12.nrrd QUAD -c 0 0 -off 0.00 | PAD -o 22.nrrd QUAD -c $V $v -off -0.67 | PAD -o 01.nrrd QUAD -c $v $v -off -0.45 | PAD -o 11.nrrd QUAD -c $V $V -off -0.90 | PAD -o 00.nrrd unu 2op x 00.nrrd 0 | unu 2op - - 10 -o BB.nrrd unu join -i 00.nrrd 01.nrrd 02.nrrd 03.nrrd 04.nrrd -a 0 -o 4.nrrd unu join -i BB.nrrd 11.nrrd 12.nrrd 13.nrrd 14.nrrd -a 0 -o 3.nrrd unu join -i BB.nrrd BB.nrrd 22.nrrd 23.nrrd 24.nrrd -a 0 -o 2.nrrd unu join -i BB.nrrd BB.nrrd BB.nrrd 33.nrrd 34.nrrd -a 0 -o 1.nrrd unu join -i BB.nrrd BB.nrrd BB.nrrd BB.nrrd 44.nrrd -a 0 -o 0.nrrd unu join -i 4.nrrd 3.nrrd 2.nrrd 1.nrrd 0.nrrd -a 1 \ | unu axinfo -a 0 -sp 0.105263 \ | unu axinfo -a 1 -sp 0.105263 -o quad.nrrd rm -f {4,3,2,1,0}{4,3,2,1,0}.nrrd rm -f {4,3,2,1,0}.nrrd rm -f BB.nrrd
Making the color-wheel-square thing, hue.nrrd (and hue.png) is unfortunately just as much work:
echo "-1 1 -1 1" \ | unu reshape -s 2 2 \ | unu resample -s 512 512 -k tent -o x.nrrd unu swap -a 0 1 -i x.nrrd \ | unu flip -a 1 -o y.nrrd unu 2op atan2 x.nrrd y.nrrd \ | unu 3op clamp -0.7854 - 2.3562 \ | unu rmap -min -0.7854 -max 2.3562 -m cmap.txt -o hue.nrrd unu 2op + x.nrrd y.nrrd \ | unu 2op + - 0.03 | unu 2op x - 40 | unu 1op erf \ | unu 2op + 1 - | unu 2op / - 2 -o mask.nrrd unu join -i x.nrrd y.nrrd -a 0 -incr \ | unu project -a 0 -m l2 \ | unu gamma -g 0.75 \ | unu 3op clamp 0 - 1 \ | unu resample -s x1 x1 -k gauss:10,3 \ | unu 2op - - 0.02 \ | unu 2op x - 1.03 \ | unu 3op clamp 0 - 1 \ | unu 2op x - mask.nrrd -o sat.nrrd unu join -i sat.nrrd sat.nrrd sat.nrrd -a 0 -incr \ | unu 3op lerp - 0.65 hue.nrrd -o hue.nrrd unu quantize -b 8 -min 0 -max 1 -i hue.nrrd \ | unu flip -a 2 -o hue.png rm -f x.nrrd y.nrrd mask.nrrd sat.nrrd
Now we can actually make the transfer functions. Note that the domain variables for the hue table are gage(k1) and gage(k2):
echo "0 1" \ | unu reshape -s 1 2 \ | unu resample -s = 512 -k tent \ | unu save -f text -o ramp.txt echo "-1.0 0.0 -0.1 0.0 0.1 1.0 1.0 1.0" \ | unu reshape -s 2 4 \ | unu imap -i ramp.txt -r -m - \ | unu axinfo -a 0 -l "A" \ | unu axinfo -a 1 -l "gage(v)" -mm -1.0 1.0 -o val-txf.nrrd unu axinfo -i hue.nrrd -a 0 -l RGB \ | unu axinfo -a 1 -l "gage(k1)" -mm -1.6 1.6 \ | unu axinfo -a 2 -l "gage(k2)" -mm -1.6 1.6 -o hue-txf.nrrd rm -f ramp.txt
After all this, we produce a single rendering:
miter -i quad.nrrd \ -k00 cubic:1,0 -k11 cubicd:1,0 -k22 cubicdd:1,0 \ -or -rh -fr 1 -3 4.5 \ -dn -2 -di 0 -df 2 -ar \ -ur -1.3 1.3 -vr -0.6 1.15 \ -ld -1 -1 -2 -ads 0.35 0.6 0.4 -sp 70 \ -is 1024 769 -step 0.004 -nt 30 \ -txf val-txf.nrrd hue-txf.nrrd -o quad-rend.nrrd overrgb -i quad-rend.nrrd -g 1.3 -b 1 1 1 -o quad.png rm -f val-txf.nrrd
Now, the two images (hue.png, quad.png) have to be combined into a single figure quadfig.png:
unu pad -i quad.png -min 0 -560 0 -max M M M -o tmp.png unu resample -i hue.png -s = 400 400 \ | unu inset -i tmp.png -s - -min 0 40 160 -o quadfig.png unu resample -i quadfig.png -s = x0.33 x0.33 -o _quadfig.png unu resample -i quadfig.png -s = x0.14 x0.14 -o __quadfig.png