ESM4714
Scientific Visual Data Analysis and Multimedia
Exercise #16: Creating Quicktime movies from PV-Wave image sequence.


NOTE: Highlighted italic text denotes user response.
Objective:
Introduce the user to PV-Wave procedure files that can be used to create a sequence of image files and Spyglasses software that can transform this image sequence into a QuickTime movie.

Background:
This exercise was part of a MSE2904 Diffusion Class Project. In this project animations were created that demonstrate diffusion of carbon in iron.


Procedure:

  1. Logon onto mercury -> pluto.smvc.vt.edu at the VT-CAVE classroom (SMVC).

  2. Mount your optical disk (see procedure for mounting scsi devices) or go to your home directory
  3. Go to the ESM4714/examples directory.


  1. MAKE COLOR MAPS: Go to the ../ESM4714/examples/color/sine

    1.0 Make a color map with only 255 colors.
    wave> m_color,255
    **** Enter filename for altered color map ****
    : sun_5_255.ascii
    **** Use existing color / Choose new color (0/1) ****
    : 1
    **** Choose initial color map number (1-13) ****
    :5

    At this point a color palette appears and exercise#11 tells you how you can alter the palette if you want special colors. Press the right mouse button and the palette is saved in the filename sun_5_255.ascii.

    1.1. Make a color bar that will be included in the final image.
    where 255 -- the number of colors (avoid 256)
    254 -- the background color (white)
    0 -- the line&symbol color (black)

    wave> m_bar,255,254,0
    **** Enter filename for color map to be loaded ****
    : sun_5_255.ascii

    A small image of a color bar is shown and stored as "bar.byt".

    1.2. Adjust the PV-Wave color table (map) to be used on the Mac by Format 1.01.
    where 255 -- the number of colors is adjusted from 255 to 256 for Format 1.01.

    wave> adj_ct_suntomac,255
    **** Read-In ASCII Sun color-map filename ****
    : sun_5_255.ascii
    **** Write-out ASCII Mac color-map filename ****
    : mac_5.ascii

    1.3. Convert the ascii file to a binary file.

    % cc atoi.c -o atoi.x

    % cat mac_5.ascii | atoi.x > mac_5.bin
    OR
    % atoi.x < mac_5.ascii > mac_5.bin

    If you look at the file size in bytes you will see that the mac_5.bin file is exactly 768 bytes: 256-red, 256-green, 256-blue.

    1.4. Transfer files from the Unix workstation (Sun) to a Windows or Mac that has
    Spyglass Format 1.01. Perform this transfer from the Mac or PC.

    sftp> get, mac_5.bin
    sftp> get, bar.byt


  2. CREATE SEQUENCE OF IMAGES FROM COMPUTER SIMULATION:

    2.0 This section outlines how to create an image sequence. In this project an
    image sequence was created that showed Carbon diffusing into Iron using
    PV-Wave software. To create this sequence:

    1. the fortran program, diff.f, generates and stores diffusion data in "concen.ascii"
    2. the fortran program, .extract.f, extracts data from concen.ascii and stores results in "concen.dat"
    3. the PV-Wave procedure, m_mov.pro, reads in diffusion data from concen.dat and creates the sequence of binary files (*.byt) where the animation sequence numbers are embedded in the file names. Embedded sequence numbers in filenames is necessary for Spyglass Format 1.01 to create a "pics" animation file.

    2.1. PV-Wave legacy procedures can be modified (see below) to create a sequence of files.
            NOTE: m_mov.pro already has these modifications.

    ; Begin time loop
    for itime=1, final_time do begin
    ;
    ;....read in data to create images.......
    ;
    ; This set of commands create the filename
    ; with an embedded sequence number
    openw,4,'temp.dat'
    if (itime lt 10) then printf,4,format='(i1)',itime
    if (itime ge 10) then printf,4,format='(i2)',itime
    close,4
    openr,4,'temp.dat'
    nn=string(")
    readf,4,nn
    if (itime lt 10) then pp="image0"+nn+".byt"
    if (itime ge 10) then pp="image"+nn+".byt"
    close,4
    openw,3,pp
    img=assoc(3,bytarr(640,450))
    ;
    ;....create image in window with dimensions of (640,450) and avoid the
    ;....256th color......
    window,1,xsize=650,ysize=450,colors=255
    ;
    ; Save image after inverting for applications on Mac
    tmp=tvrd(0,0,640,450)
    img(0)=rotate(tmp,7)
    ;
    ; End of time loop
    endfor

    2.2. You may want to check the first and last image to confirm the sequence.


  3. MOVE FILES ONTO MAC AND CREATE QUICKTIME & MPEG ANIMATIONS:

    3.0. Transfer these image*.byt files to a folder on the Mac.

    3.1. Quit all other applications on the Mac and start up Format 1.01.

    3.2. Select "New" under "File".

    3.3. Adjust canvas size under "Special" (use previously recorded xsize, ysize
    dimensions, preferably 640 x 450 pixels).

    3.4. Select "Place Sequence" under "File" and find the folder where the image_*.byt
    files are located and open the first image. The pixels for the byt images must be given again and an image will appear with the default (wrong) color. Shift the image to the upper left by using the mouse.

    3.5. Under "Color" choose "Load color table" and select the mac_5.bin binary file
    that you created on the Unix workstation. An image will appear that should look familiar except white--0 is assigned by the Format 1.01 for the background instead of black and the lines and symbols that were assigned a color of 254(white) are now effectively hidden by the white default background.

    3.6. Select "Canvas color" under "Color" and slide down the vertical color bar until
    255--black is observed. When the mouse button is released at 255--black the canvas background changes to black but cannot be seen until the transparent feature is selected.

    3.7. To generate the transparent feature you must first click on the object in the
    window with your mouse to select it. This is VERY IMPORTANT!!!

    3.8. Now select "Edit Object" under "Edit" and select transparent by clicking on
    the transparent box. Suddenly the background becomes black and the white lines and symbols can be seen.

    3.9. If this is the first image (image_01.byt) select "Process animation" under
    "File", a window will appear requesting a filename for the animation file. Choose "pics" as the file type. Save this file in a directory different from where the *.byt files are located.

    3.10. With QuickTime ConvertToMovie create a QuickTime movie (using the
    default settings).

    3.11. With Sparkle create an MPEG movie. At first a prompt appears which can
    be passed by clicking OK. Select "Open" under "File" and choose your QuickTime movie. Then select "Save" and remember to save your QuickTime movie as an MPEG movie. Then use the default settings to complete the formation of your MPEG movie.

    NOW WASN'T THAT EASY!!!


Click image to return to Visualization home page.
R.D. Kriz
Virginia Tech
College of Engineering
Revised 01/10/99
http://www.sv.vt.edu/classes/ESM4714/exercises/exer16/exer16.html