PV-Wave Procedure Files

Procedure file creates a spinning head

PRO m_spin
ct=8
frames=30
int_frame=0.0
incr_frame=12.0
const=256
xwind=const
ywind=const
ximag=const
yimag=const
openr,1,'man_head.dat'
openw,2,'spin.byt'
p=assoc(2,bytarr(ximag,yimag))
ival=bytarr(115,75,105)
svol=size(ival)
dn=float(max([svol(1), svol(2), svol(3)])-1)
!x.range=[0.0, (svol(1) - 1)]
!y.range=[0.0, (svol(2) - 1)]
!z.range=[0.0, (svol(3) - 1)]
readu,1,ival
ival = Bytscl(ival)
ival = Vol_Pad(ival, 1)
ival1 = ival
Set_Shading, Light=[-1.0, 1.0, 0.2]
window, 1, xsize=400, ysize=200, xpos=500, ypos=500,colors=256
loadct,8
Window, 0, Xsize=xwind, Ysize=ywind, Xpos=150, Ypos=150
azt=int_frame
for i=0,frames do begin
Center_View, xr=[0.0, 115.0], yr=[0.0, 75.0], zr=[0.0, 105.0], $
             ax=(-60.0), az=azt, zoom=0.9, winx=xwind, winy=ywind
ival = Vol_Trans(ival1, 115, !P.T)
img3 = Vol_Rend(ival, ximag, yimag, depth_q=0.9)
Tvscl, img3
p(i)=tvrd(0,0,xwind,ywind)
wset,1
info=string(format='("Frame=",i2)',i)
xyouts,100,100,info,/device,size=1.0
wset,0
azt=azt+incr_frame
endfor
close,1
close,2
end

Procedure file for viewing a rotating head

PRO s_spin,xp,yp
frames = 30
const=256
xwin = const
ywin = const
ximg = const
yimg = const
densspin = Bytarr(ximg, yimg, frames)
Openr, 1, "spin.byt"
readu,1,densspin
Window, 3, Xsize=xwin, Ysize=ywin, Xpos=xp, Ypos=yp, $
        Title='3D Volume Rotation.', Retain=1,colors=256
Device, /Cursor_Original
Tvcrs, 1
Loadct, 8
Tv, densspin(*, *, 0)
Empty
Flush, 1
Close, 1
frame_delay = 0.0
slide_delay = 0.0
ani_cycles  = 50
xf=0
yf=0
outx=0
outy=0
FOR loop=1, ani_cycles DO BEGIN
   FOR i=0, (frames-1) DO BEGIN
      Tv, densspin(*, *, i)
      Empty
      Wait, frame_delay
cursor,xd,yd,0,/device
while(!err eq 2)do begin
la: cursor,xd,yd,0,/device
if(!err eq 4)then goto, lb
if(!err eq 1)then goto, lc
if(!err eq 0)then goto, la
endwhile
lb: !err=0
   ENDFOR
ENDFOR
Wait, slide_delay
lc: return
END