This is an ear from the Visible Human male frozen CT. The (lengthy) process for creating a clean version of the head is fully documented; creating the ear.nrrd dataset is the final step. Here we modify the spacings in the dataset to change the normalization factor in the curvature calculation, so that we can reuse the hue-txf.nrrd transfer function has used on the quadratic surfaces figure.
unu resample -i ear.nrrd \ -s x1 = = -k cubic:1,1,0 \ | unu resample -s = x1 x1 -k cubic:2.0,1,0 -o ear-blur.nhdr cat ear-blur.nhdr \ | grep -v axis \ | grep -v centers \ | grep -v spacings >! tmptmp echo "spacings: 0.0586 0.0586 0.1111" >> tmptmp mv -f tmptmp ear-blur.nhdr
The steps to create the ridge and valley emphasis transfer function vc-txf.nrrd are a little convoluted:
echo "-1 1 -1 1" \ | unu reshape -s 2 2 \ | unu resample -s 256 256 -k tent -o xramp.nrrd echo "1 1 -1 -1" \ | unu reshape -s 2 2 \ | unu resample -s 256 256 -k tent -o yramp.nrrd unu join -i xramp.nrrd yramp.nrrd -a 0 -incr \ | unu project -a 0 -m l2 -o radius.nrrd unu 2op atan2 xramp.nrrd yramp.nrrd \ | unu 2op / - 0.7853975 \ | unu 2op + - 1 \ | unu 3op clamp 0 - 4 -o angle.nrrd echo "0 0 0.55 0 0.65 1 1 1" \ | unu reshape -s 2 4 \ | unu imap -i radius.nrrd -m - \ | unu resample -s 256 256 -k tent -o thresh.nrrd echo "0.0 0.0 0.4 0.0 0.6 1.0 1.4 1.0 1.6 0.0 2.00 0.0" \ | unu reshape -s 2 6 \ | unu imap -i angle.nrrd -m - \ | unu 2op x - thresh.nrrd \ | unu 2op - 1 - -o valley.nrrd echo "2.0 0.0 2.4 0.0 2.6 1.0 3.4 1.0 3.6 0.0 4.00 0.0" \ | unu reshape -s 2 6 \ | unu imap -i angle.nrrd -m - \ | unu 2op x - thresh.nrrd \ | unu 2op + 1 - -o crease.nrrd unu 2op x valley.nrrd crease.nrrd \ | unu reshape -s 1 256 256 \ | unu pad -min 0 0 0 -max 2 M M -o valcre.nrrd unu axinfo -i valcre.nrrd -a 0 -l RGB \ | unu axinfo -a 1 -l "gage(k1)" -mm -3.0 3.0 \ | unu axinfo -a 2 -l "gage(k2)" -mm -3.0 3.0 -o vc-txf.nrrd rm -f xramp.nrrd yramp.nrrd angle.nrrd radius.nrrd rm -f thresh.nrrd valley.nrrd crease.nrrd
Next we use gkms to make an opacity function. This is not a semi-automatically generated transfer function; its just a combination of 2-D opacity functions based on Levoy's method.
gkms txf -step -max 2000 900 -v 780 -top 850 900 -w 800 -o - \ | unu 2op x - 1.2 \ | unu 2op min - 1.0 -o ear-txf.nrrd
The cool-to-warm shading transfer function:
echo "0 1" \ | unu reshape -s 2 \ | unu resample -s 512 -k tent \ | unu imap -r -m gooch.txt \ | unu 2op / - 255 \ | unu 2op - 1 - \ | unu 2op x 0.75 - \ | unu 2op - 1 - \ | unu flip -a 1 \ | unu axinfo -a 0 -l RGB \ | unu axinfo -a 1 -l ndotl -mm -0.5 0.9 -o gooch-txf.nrrd
Now, three renderings (grayscale, with colored curvatures, and with ridge/valley emphasis):
setenv NT 45 setenv STEP 0.002 setenv BG "0.35 0.35 0.35" alias MITER miter -i ear-blur.nhdr \ -up 2 0 -10 -fr -11 -3 -5 -rh \ -dn -1 -di 0 -df 1 -ar \ -ur -0.56 0.52 -vr -0.765 0.765 \ -k00 cubic:1,0 -k11 cubicd:1,0 -k22 cubicdd:1,0 -rn \ -ld 2 -7 -9 -step $STEP \ -is 326 462 -nt 30 MITER -ads 0.1 0.7 0.3 -txf ear-txf.nrrd \ -o ear-rend.nrrd MITER -ads 0.4 0.7 0.2 -txf ear-txf.nrrd hue-txf.nrrd \ -o ear-hue-rend.nrrd MITER -ads 0.8 0. 0.0 -txf ear-txf.nrrd vc-txf.nrrd gooch-txf.nrrd \ -o ear-vc-rend.nrrd overrgb -i ear-rend.nrrd -g 1.3 -b $BG -o ear-rend.png overrgb -i ear-hue-rend.nrrd -g 1.3 -b $BG -o ear-hue.png overrgb -i ear-vc-rend.nrrd -g 1.3 -b $BG -o ear-vc.png
Now, the various pieces are composed into a figure:
unu pad -i ear-hue.png -min 0 -105 0 -max M M M -b pad -v 255 -o tmp.png unu resample -i ear-rend.png -s = x0.45 x0.45 \ | unu pad -min 0 -1 -1 -max M M+1 M+1 -b pad -v 255 \ | unu inset -i tmp.png -s - -min 0 0 25 -o ear1.png unu pad -i ear-vc.png -min 0 -125 0 -max M M M -b pad -v 255 -o tmp.png unu flip -i valcre.nrrd -a 2 \ | unu quantize -b 8 \ | unu resample -s = x0.7 x0.7 \ | unu pad -min 0 -1 -1 -max M M+1 M+1 -b pad -v 255 \ | unu inset -i tmp.png -s - -min 0 0 40 -o ear2.png unu pad -i ear1.png -min 0 0 0 -max M M+20 M -b pad -v 255 \ | unu join -i - ear2.png -a 1 -o ear.png rm -f tmp.png unu resample -i ear.png -s = x0.5 x0.5 -o _ear.png unu resample -i ear.png -s = x0.25 x0.25 -o __ear.png