|
Getting Started with IDL: Animation |
|
The same series of images can be displayed as different types of animations. For example, each frame of the animation could be displayed as a SURFACE plot.
S=REBIN(HEART_BINARY.H,32,32,16)
S now holds 32 byte by 32 byte versions of the heartbeat images. SURFACE plots are often more legible when made from a resized version of the dataset with fewer data points in it.
SURFACE,S[*,*,0]
![]() |
Now create a whole series of SURFACE plots, one for each image in the original dataset.
FRAMES=BYTARR(300,300,16)
The variable frames will hold sixteen, 300 by 300 byte images.
WINDOW,1,TITLE='IDL Animation',xsize=300,ysize=300
A blank IDL Animation screen will appear.
The next command will draw each frame of the animation. A SURFACE plot is drawn in the window and then the TVRD function is used to read the image from the plotting window into the frames array. The FOR loop is used to increment the array indices. The lines which follow are actually a single IDL command. The dollar sign ($) works as a continuation character in IDL and the ampersand (&) allows multiple commands in the same line.
FOR I=0,15 DO BEGIN SURFACE,S[*,*,i],ZRANGE=[0,250]$ & FRAMES[0,0,i]=TVRD()&END
You should see a series of SURFACE plots being drawn in the animation window, as shown in below. The ZRANGE keyword is used to keep the "height" axis the same for each plot.
| Note Once again, if the IDLDE screen covers and existing IDL window, you may want to delete the current IDL window before recalling the FOR statement in order to clearly see the animation. |
IDL Online Help (March 06, 2007)