|
Getting Started with IDL: Animation |
|
To create an animation that shows a series of images that represent an abnormal heartbeat, first read in the images to be displayed. The file holds 16 images of a human heart as 64 by 64 element arrays of bytes.
HEARTTEMPLATE=BINARY_TEMPLATE(FILEPATH('abnorm.dat',$
SUBDIR=['examples', 'data']))
HEART_BINARY:
HEART_BINARY=READ_BINARY(FILEPATH('abnorm.dat',SUBDIR= $
['examples', 'data']), TEMPLATE=HEARTTEMPLATE)
LOADCT, 3
TV,HEART_BINARY.H[*, *, 0]
The asterisks (*) in the first two element positions tell IDL to use all of the elements in those positions. Hence, the TV procedure displays a 64 by 64 byte image. The image is rather small.
H=REBIN(HEART_BINARY.H,320,320,16)
TV,H[*, *, 0]
Each image in H is 5 times its previous size.
Now a simple FOR statement can be used to "animate" the images. (A more robust and convenient animation routine, XINTERANIMATE, is described next.)
IDL displays the 16 images in the array H sequentially. To repeat the animation, press the "up arrow" key to recall the command and press enter.
| Note 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. |