NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Gif`s in visad

Hi Olver,

> But, I really got a display with just 3 maps, longitude, latuitude and RGB
> like this:
> 
> visad.ScalarMap lonMap = new visad.ScalarMap(visad.RealType.Longitude, 
> visad.Display.XAxis );
> visad.ScalarMap latMap = new visad.ScalarMap(visad.RealType.Latitude, 
> visad.Display.YAxis );
> visad.ScalarMap varMap = new visad.ScalarMap(varRaster,visad.Display.RGB );
> 
> where varRaster is a RealType.
> 
> The GIFForm has as a range a tuple of 3 componets (R,G,B), and I need
> to convert it to a RealType to put into a map Display.RGB.
> 
> There's an example in the P5_09 from the visad's tutorial, but it use 5
> maps.

As described in tutorial section 5.9, a GIF image is read as
a FlatField with MathType:

  ( (ImageElement, ImageLine) -> (Red, Green, Blue) )

This means that it is a mapping from image line and element to
true-color red, green and blue components. A ScalarMap to RGB
uses psuedo-color when you want to adjust the color map for
a single RealType. You could use a ScalarMap of Red, Green or
Blue to RGB. Or could use ScalarMaps of all three to RGB, to
adjust non-linear mappings for each of Red, Green and Blue.

The domain of a GIF image is defined by simple line and element
coordinates, since GIF images do not include navigation information
for the mapping between (line, element) and (latitude, longitude).
[Note that the McIDAS and HDF-EOS images that VisAD reads do include
such navigation information, but they are much more complex file
formats than GIF.]

If you happen to know the mapping between (line, element) and
(latitude, longitude) for your GIF image, you can extract the
colors values from the FlatField by:

  float[][] colors = gif_field.getFloats();
  // now colors[0] is an array of red values, colors[1] is an
  // array of green values, and colors[2] is an array of blue
  // values

and then build a new FlatField with MathType:

  ((Latitude, Longitude) -> (Red, Green, Blue))

and use a Gridded2DSet for its domain Set, that defines the
(lat, lon) locations of the pixels.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: