RivaFile Format
RIVA system has its own data format
called the RivaFile format. RIVA takes two dimensional or three dimensional
regular grid structured data. Two dimensional datasets are image data or
digital elevation data in either cylindrical projection or sinusodial
projection. Three dimensional datasets are time-varying datasets with time
as the 3rd dimension. 3D dataset could be an multi-timestep image dataset
that is used as an overlay on top of the base terrain image or an displacement
dataset that adds a delta value to the base elevation file at every time step. The 3D dataset is usually used for model or simulation output.
A RivaFile consists of a short header (typically
1024 bytes), followed by raw image data.
The header contains meta information
about the image data in the form of 'FIELD=value' pairs. For example, here
is the header of a small DEM (digital elevation model) file:
% rivheader dem.riv
RivaFile: dem.riv
LBLSIZE=1024
TYPE='DEM'
NL=171
NS=98
BPP=2
SUNFORMAT=1
PROJECTION='CYLINDRICAL'
LONG0=-117.917
LAT0=38.4167
LONG1=-114.667
LAT1=33.6667
PIXMETERS=30.9
ZMETERS=1
ZDELTA=100
The RivaFile's header contains important information about the file's contents.
Standard Header Fields
The following is a glossary of the header fields used in RivaFiles.
-
BPP (positive integer)
-
Bytes Per Pixel. An RGB image file would have BPP=3 and a grayscale
image file would have BPP=1. A LandSAT image file may have 6
bands or 6 bytes per pixel BPP=6. A DEM file using short type for
elevation would have BPP=2. A displacement file may be in float
and has BPP=4.
-
BANDS (text, for IMAGE only)
-
Assigns a one character name to each band in the file. By default, the
bands are named '1', '2', '3', and so on. Example:
BANDS='#742135'
The value '#742135' names six bands of data; the '#' character
is a required bit of syntax to keep the field from being interpreted as
a number. The number of characters following the '#' character must be
the same as BPP (byte per pixel); the names are applied in order. Thus, the first band is
called '7', the second '4', and so on. BANDS field only applies to image
data file. By default, the first three bands will be mapped to Red, Green, and Blue colors, respectively. It can be changed by the RIVA Graphic User Interface
to map a band to any color channel.
-
GRIDWIDTH (positive integer, power of 2)
-
The tiling grid width for tiled images.
See the documentation on the rivtiler
utility for more information.
-
LAT0 (real)
-
The latitude, in decimal degrees North, of the upper left corner of the
image. See Georeferencing for more information.
-
LAT1 (real)
-
The latitude, in decimal degrees North, of the lower right corner of the
image. See Georeferencing for more information.
-
LBLSIZE (positive integer)
-
The size of the RivaFile header, in bytes. This field is established when
the RIVA file is first created; it cannot be modified afterwards.
-
LONG0 (real)
-
The longitude, in decimal degrees East, of the upper left corner of the
image. See Georeferencing for more information.
-
LONG1 (real)
-
The longitude, in decimal degrees East, of the lower right corner of the
image. See Georeferencing for more information.
-
NL (positive integer)
-
The number of lines of data in the image.
-
NS (positive integer)
-
The number of samples (pixels) per line of data.
-
NT (positive integer)
-
The number of time steps in the data file.
-
NTILES (positive integer)
-
In a tiled image, the number of tiles in the
file. This field is generated by rivtiler. See the documentation on the rivtiler
utility for more information.
-
PIXMETERS (positive integer)
-
The approximate width of a pixel, in meters.
-
PROJECTION (symbolic text)
-
The data's map projection. Most data stored in RivaFiles is geo-referenced
in some way. The RIVA renderer expects PROJECTION='CYLINDRICAL'
or PROJECTION='SINUSOIDAL'. The Flexible Flyer expects PROJECTION='CYLINDRICAL'.
See Georeferencing for more information.
-
SUNFORMAT (boolean flag, 0 or 1, for DEM only)
-
Byte order is significant for DEMs. If SUNFORMAT=1,
Sun byte order is assumed; the same order is appropriate for SGI's and
Crays. If SUNFORMAT=0 or the field is not defined, the reversed
order is assumed. The Sun byte order for a 2-byte short is most significant
byte first followed by the least significant byte.
-
TILEHDRFMT (text comment)
-
This field documents the tile header format for tiled
images. See the documentation on the rivtiler
utility for more information.
-
TILEHDRSIZ (positive integer)
-
This field gives the size (in bytes) of tile headers for tiled
images. This field is generated by rivtiler. See the documentation on the rivtiler
utility for more information.
-
TYPE (symbolic text)
-
The kind of data contained in the file. Currently supported values are
'IMAGE', 'DEM', and 'DISPLACE'.
TYPE='IMAGE' implies terrain image data.
It could be a time-varying imagery overlay generated by a simulation program.
TYPE='DEM' implies digital elevation data.
TYPE='DISPLACE' implies vertical displacement data. The displacement data set is usually time-varying simulation data.
-
ZDELTA (positive number, for DEM only)
-
By convention, DEM files contain unsigned short integers.
However, elevation data is usually relative to mean sea level (or the equivalent),
which implies that some elevations will be negative (e.g., Death Valley).
Thus, a delta is usually added to each pixel to ensure that all values
are positive. This field is the delta value in meters.
-
ZMETERS (positive number, for DEM only)
-
Specifies the size of each unit of elevation data, in meters.
-
XOFFSET (positive number)
-
YOFFSET (positive number)
-
If the image data is stored in a seperate file. These two fields
specify the start coordinates on the input file that maps to the origin
of the Riva File. This allows RIVA to read in a region from
a bigger dataset.
In this case, the RIVA file contains only the header
block. The data is stored in another file in some image format. The data
file will be read in using SGI's Image File Library (IFL).
Types of RivaFiles
RIVA stores several kinds of data in RivaFiles. The different kinds can
be distinguished by the contents of their headers:
- Terrain Image
-
A terrain image is a RivaFile image which represents a particular region
on a planetary surface. It always has TYPE='IMAGE'. An RGB image file would have 3 bytes per pixel,BPP=3 and
a grayscale image file would have BPP=1. A LandSAT image file may have 6
bands or 6 bytes per pixel BPP=6.
It must define the PIXMETERS field, and the latitude/longitude
boundary fields: LAT0, LONG0, LAT1, LONG1.
It may be in the cylindrical projection or the Sanson-Flamsteed sinusoidal
projection. If PROJECTION='SINUSOIDAL', then the latitude/longitude
boundary should encompass the whole planet.
-
Digital Elevation Model (DEM)
-
A DEM is a RivaFile image which represents the elevations of a particular
region on a planetary surface. It should have TYPE='DEM'. Pixels
may be one or two bytes long, and are interpreted as unsigned integers.
Like terrain images, DEMs must define the PIXMETERS field and
the latitude/longitude boundary fields, and may be in the cylindrical or
sinusoidal projection. In addition, the SUNFORMAT, ZMETERS,
and ZDELTA fields might be defined.
-
Displacement Data
-
The displacement data is usually a time-varying float-point data set
representing the vertical displacement of the base elevation. This data type
was invented to visualize the postseismic activities generated by an earthquake
model.
It should have TYPE='DISPLACE'. Pixels
may be one, two, or four bytes long. When pixels are one byte or two bytes,
they are interpreted as signed integers. When they are four bytes, they
are interpreted as single precision floating point numbers.
Like DEMs, displacement datasets must define the PIXMETERS field and
the latitude/longitude boundary fields, and may be in the cylindrical or
sinusoidal projection.
-
Tiled Images
-
All RivaFile images can be tiled. Tiling
is done to facilitate distributing the image across the PEs of a massively
parallel processor. For fast input data loading, RIVA only reads tiled images.
If an image is tiled, the GRIDWIDTH, NTILES,
TILEHDR, and TILEHDRSIZ fields will be defined. See the
documentation on the rivtiler utility for more
information.
Georeferencing
The RIVA system is designed to visualize terrain data, e.g., imagery draped
over digital elevation on a planetary globe. RIVA's renderer needs to know
where the data falls on the globe, particularly if several data sets are
being rendered together. Thus, accurate georeferencing is a must.
The renderer assumes that most data will be in a cylindrical Mercator
projection. Rows of data are parallel with lines of latitude; columns run
directly north/south. The upper-left and lower-right corners are specified
using the LAT0, LONG0, LAT1 and LONG1
header fields.
Global data (only) may be in the Sanson-Flamsteed sinusoidal projection.
In this case, LAT0, LAT1, LONG0, and LONG1
represent the range of latitudes and longitudes, typical 90 to -90
and -180 to 180.
In either event, latitudes are expressed in degrees North, and
longitudes in degrees East.
|