ESM4714
Scientific Visual Data Analysis and Multimedia
Exercise #12: Sun <--> Mac color maps that reveal significant properties


NOTE: Highlighted italic text denotes user response.

Objective:
Investigate data in red-green-blue (r-g-b) images on the Sun workstations by manipulating the r-g-b color tables and then present these images on the Mac. Both images and color tables are mapped from the Sun: range (0 - (???)) > 256), to the Mac: range (1 - 254). The 0-th and 255-th colors are reserved on the Mac for white and black respectively.


Procedure:
Creating images and color tables on Sun that will create the same images on the Mac.

NOTE: here we arbitrarily select a total of 240 colors for our image on the Mac or (???) --> 239 for the Sun.

  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).
  3. Go to the ESM4714/examples directory.

  4. Locate the directory that contains PV-Wave procedure files for generating a simple 2D sinusoidal image and corresponding color maps and start wave.

    viz?% cd /opdisk/ESM4714/examples/color/sine
    viz?% ls -lag
    viz?% wave
    wave>_
    wave> device,pseudo_color=8    (Note: Setup for Sparc20s in Viz Lab)

  5. Create a Sun ASCII color table with 240 r-g-b color entries: range (0 - 239).

    NOTE: This is done to reserve the last 16 of the 256 colors for X-window applications. The net effect is that the X-window background colors do not change as we move the cursor into a X-window (e.g. PV-Wave window). Some users find this to be distracting interface feature. Because each UNIX operating system sets up the X-window applications different we can only give general guidelines on how to alter the systems defaults. You may want to experiment with the parameter of colors = -16 on a PV-Wave window command (see pg. C-64) when running on the Sun. This command reserves the first 16 colors instead of the last 16. Although this command will eliminate color changes on the Sun but it may not work on the SGI and DEC workstations. Additional changes are then necessary to map the last 240 colors onto the 1-254 usable color range on the Macs.

    wave> m_color,240 -> prompts you for a filename for the altered color map
    **** Enter filename for altered color map ****
    : sun_5_240.ascii
    **** Use existing color / Choose new color (0/1) ****
    : 1
    **** Choose initial color map number (1 -13) ****
    : 5

  6. You are prompted with a color palette that is similar to the figure shown below. You can now alter colors over the range 0 - 239. For example click the left mouse button on the upper right corner of the table and observe how the number 0 appears below the upper left most column. You can change the 0-th color by holding down the left mouse button and dragging the cursor within the horizontal columns labeled Red, Green, and Blue. Similarly you can independently manipulate the 239-th color by selecting the lower left corner. Hence unique colors can be assigned to specific numbers that may be physically significant. For example we anticipate that the zero value in or sine wave image will be half the range of (0-239) or 119. We assign turquoise to the 119-th color by selecting Red=0, Green=255, and Blue=255. This selection is shown in the image below. Finally press the right mouse button and this modified color table is then saved as a file with the name sun_5_240.ascii. This color table will also be used to highlight zero in our sine image..

    If you look at the color map file you will see that there are three separate sections corresponding to red, green, and blue. Each section has 240 entries: 26 rows with 9 entries per row and the 27-th last row with 6 entries. The numbers in each section range from 0 to 256.

  7. Create a color bar with 240 r-g-b values that will be embedded in the sine figure, where the background color is 0=black and the edge colors (letters, etc.) are 239=white.

    wave> m_bar,240,0,239
    **** Enter filename for color map to be loaded ****
    : sun_5_240.ascii

    NOTE: This will generate a color image as shown below where the 119th color is turquoise.

  8. Create a 2D sine array image with one period in the x &y direction and 240 colors.

    wave> m_sine,1,240
    **** Enter filename for color map to be loaded ****
    : sun_5_240.ascii
    This wave procedure will generate an image as show below.

    NOTE: the turquoise color near zero or the light gray region if you are looking at a grayscale.

  9. Convert the sine image from the Sun to the Mac.

    viz?% itoa.x < sine.byt > sine.ascii
    viz?% wave
    wave> adj_image_suntomac,240,360,360
    **** Read-in Sun image ASCII filename *****
    : sine.ascii
    **** Write-out Modified Mac image ASCII filename ****
    : sine_mod.ascii
               0      239   (image color range on Sun)
               1      254   (image color range on Mac)
    
    wave> quit
    viz?% atoi.x < sine_mod.ascii > sine_mod.bin

  10. Convert the color table from the Sun to the Mac.

    viz?% wave
    wave> adj_ct_suntomac,240
    **** Read-In ASCII Sun color-map filename ****
    : sun_5_240.ascii
    **** Write-out ASCII Mac color-map filename ****
    : mac_5.ascii
    wave> quit
    viz?% atoi.x < mac_5.ascii > mac_5.bin

  11. Transfer files: sine.byt, sine_mod.bin and mac_5.bin from the Sun to the Mac.

  12. Start-up NCSA Image on the Mac, Open files sine.byt and sine_mod.bin and compare both images with the same palette: mac_5.bin (recall both images are raw 360 by 360)

    File: sine.byt: color range 0-240 (not scaled), colors: 0=white 240=light yellow.

    NOTE: Both images above and below are rotated 90 degrees clockwise and then transposed because the first pixel is defined in the lower left corner of PV-Wave image and in the upper left corner of NCSA Image. You can correct image orientation with the PV-Wave command image=rotate(image,7)

    File: sine_mod.bin: color range 1-254 (scaled for Mac), colors: 0=white and 255=black are avoided where 1=black and 254=white (see the letters, 254=white)


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/exer12/exer12.html