comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Animating slicer3 output?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Animating slicer3 output? [message #30627] Tue, 14 May 2002 09:32 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rick Matthews (matthews@wfu.edu) writes:

> I am rather new to IDL. I have generated 3-D isosurfaces
> using Slicer3. I would like to step through one rotation angle,
> saving each image for inclusion in a video.
>
> Is there a way to automate the rotate/save cycle in slicer3?
> If not, can someone point me in another direction to achieve the
> same result?
>
> I am trying to make a video showing a rotating isosurface.

Here is a little program that animates an isosurface in
XInterAnimate. You can create a MPEG movie by just clicking
the MPEG button on the XInterAnimate interface. Or, if you
would prefer to save the frames as a series of JPEG files,
you can set the JPEG keyword:

IDL> Rotating_Isosurface, /JPEG

You will need the TVRead program from my web page to
run the program:

http://www.dfanning.com/programs/tvread.pro

Cheers,

David

************************************************************ *
PRO Rotating_Isosurface, JPEG=jpeg

; Set the JPEG keyword to generate JPEG output.

; Load volumetric data.

head = BytArr(80, 100, 57)
filename = Filepath(Subdir=['examples', 'data'], 'head.dat')
OpenR, lun, filename, /Get_Lun
ReadU, lun, head
Free_Lun, lun

; Set up 3D coordinate space.

d = Size(head, /Dimensions)
Scale3, XRange=[0, d[0]], YRange=[0, d[1]], ZRange=[0, d[2]]

; Create vertices and polygons describing isosurface.

Shade_Volume, head, 50, vertices, polygons, /Low

; Animate it.

XInterAnimate, Set=[256, 256, 36], /Showload
FOR j=0,35 DO BEGIN
Scale3, XRange=[0, d[0]], YRange=[0, d[1]], ZRange=[0, d[2]], AZ=10*j
TV, Polyshade(vertices, polygons, /T3D, XSize=256, YSize=256)
XInterAnimate, Frame=j, Window=!D.Window

; Want to save as JPEG files?

IF Keyword_Set(jpeg) THEN BEGIN
filename = 'isosurface_' + String(j, Format='(I3.3)') + '.jpg'
ok = TVRead(/JPEG, Filename=filename, /NoDialog)
ENDIF
END
XInterAnimate, 50
END
************************************************************ *

David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Animating slicer3 output? [message #30819 is a reply to message #30627] Thu, 16 May 2002 05:48 Go to previous message
Rick Matthews is currently offline  Rick Matthews
Messages: 9
Registered: May 2002
Junior Member
Thanks to David and Paul. I will give these a try.

Rick

David Fanning wrote:
>
> Rick Matthews (matthews@wfu.edu) writes:
>
>> I am rather new to IDL. I have generated 3-D isosurfaces
>> using Slicer3. I would like to step through one rotation angle,
>> saving each image for inclusion in a video.
>>
>> Is there a way to automate the rotate/save cycle in slicer3?
>> If not, can someone point me in another direction to achieve the
>> same result?
>>
>> I am trying to make a video showing a rotating isosurface.
>
> Here is a little program that animates an isosurface in
> XInterAnimate. You can create a MPEG movie by just clicking
> the MPEG button on the XInterAnimate interface. Or, if you
> would prefer to save the frames as a series of JPEG files,
> you can set the JPEG keyword:
>
> IDL> Rotating_Isosurface, /JPEG
>
> You will need the TVRead program from my web page to
> run the program:
>
> http://www.dfanning.com/programs/tvread.pro
>
> Cheers,
>
> David
>
> ************************************************************ *
> PRO Rotating_Isosurface, JPEG=jpeg
>
> ; Set the JPEG keyword to generate JPEG output.
>
> ; Load volumetric data.
>
> head = BytArr(80, 100, 57)
> filename = Filepath(Subdir=['examples', 'data'], 'head.dat')
> OpenR, lun, filename, /Get_Lun
> ReadU, lun, head
> Free_Lun, lun
>
> ; Set up 3D coordinate space.
>
> d = Size(head, /Dimensions)
> Scale3, XRange=[0, d[0]], YRange=[0, d[1]], ZRange=[0, d[2]]
>
> ; Create vertices and polygons describing isosurface.
>
> Shade_Volume, head, 50, vertices, polygons, /Low
>
> ; Animate it.
>
> XInterAnimate, Set=[256, 256, 36], /Showload
> FOR j=0,35 DO BEGIN
> Scale3, XRange=[0, d[0]], YRange=[0, d[1]], ZRange=[0, d[2]], AZ=10*j
> TV, Polyshade(vertices, polygons, /T3D, XSize=256, YSize=256)
> XInterAnimate, Frame=j, Window=!D.Window
>
> ; Want to save as JPEG files?
>
> IF Keyword_Set(jpeg) THEN BEGIN
> filename = 'isosurface_' + String(j, Format='(I3.3)') + '.jpg'
> ok = TVRead(/JPEG, Filename=filename, /NoDialog)
> ENDIF
> END
> XInterAnimate, 50
> END
> ************************************************************ *
>
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155


--
Rick Matthews matthews@wfu.edu
Department of Physics http://www.wfu.edu/~matthews
Wake Forest University 336-758-5340 (Voice)
Winston-Salem, NC 27109-7507 336-758-6142 (FAX)
USA
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Cursor jumping annoys me
Next Topic: EPSF, embedded fonts, powerpoint

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 07:22:50 PDT 2025

Total time taken to generate the page: 0.47960 seconds