ReadSpotHeader, ReadSpotImage & ReadSpotImageAlt

Synopsis

ReadSpotHeader reads the header information contained within a SPOT header file. ReadSpotImage reads all or part of the contents of a SPOT Panochromatic or Multispectral image into AVS/Express. ReadSpotImageAlt provides an alternative way of specifying the scaling and window parameters.


module ReadSpotHeader <src_file="rspt_hdr.cxx",
                       cxx_src_files="gsspot.cxx">
{
   ReadSpotInputParams+IPort2 &input_params;
   cxxmethod+notify_inst+req update(
      .input_params+read+notify+req,
      .input_params.HeaderFileName+read+notify+req,
      .output_params+write,
      .output_params.ProcessingLevel+write,
      .output_params.NumberOfBands+write,
      .output_params.NumberOfRows+write,
      .output_params.NumberOfColumns+write,
      .output_params.Year+write,
      .output_params.Month+write,
      .output_params.Day+write,
      .output_params.Hour+write,
      .output_params.Minute+write,
      .output_params.Second+write
   );
   ReadSpotOutputParams+OPort2 output_params;
};
module ReadSpotImage <src_file="rspt_img.cxx",
                      cxx_src_files="gsspot.cxx",
                      cxx_hdr_files="fld/Xfld.h">
{
   ReadSpotInputParams+IPort2 &input_params;
   cxxmethod+notify_inst+req update(
      .input_params+read+notify,
      .input_params.HeaderFileName+read+notify+req,
      .input_params.ImageFileName+read+notify+req,
      .input_params.BandNumberToRead+read+notify,
      .input_params.StartRow+read+notify,
      .input_params.StartColumn+read+notify,
      .input_params.NumberOfOutputRows+read+notify,
      .input_params.NumberOfOutputColumns+read+notify,
      .input_params.XScaleFactor+read+notify,
      .input_params.YScaleFactor+read+notify,
      .input_params.ActivateFlag+read+notify,
      .Image+write
   );
   Field_Unif+Dim2+Byte+Space2+Node_Data+OPort2 Image;
};
ReadSpotImage ReadSpotImageAlt {
   NumberOfOutputRows =>
	       input_params.NumberOfRows * input_params.YScaleFactor;
   NumberOfOutputColumns =>
	       input_params.NumberOfColumns * input_params.XScaleFactor;
};

Description

These three low-level modules read SPOT image files. The ReadSpotHeader module reads the header information from a SPOT header file and outputs that information as a block of parameters. The ReadSpotImage module reads the actual image data from a SPOT file and outputs that information as a 2D AVS/Express image field. The ReadSpotImageAlt module is derived from the ReadSpotImage module and provides an alternate way of specifying scaling and window parameters.

The SPOT file format was created by the SPOT Image Corporation so that data from the SPOT series of satellites could be distributed. The SPOT satellites produce panchromatic imagery with a resolution of about 10 meters. They produce multispectral imagery with a resolution of about 30 meters.

SPOT images are available with many levels of processing. Level 1A is essentially raw data. It has been radiometrically corrected, but has not been rectified. Level 1B has been radiometrically corrected and has been rectified. However, the rectification technique is very coarse, and does not consider local perturbations caused by terrain. Level 2 data is radiometrically corrected and rectified using techniques that consider perturbations caused by terrain and other factors. These modules can not read SPOT files with level 2 processing.

Panchromatic level 1A scenes have 6000 pixel rows and 6000 pixel columns. Multispectral level 1A scenes have 3000 pixel rows and 3000 pixel columns. Panchromatic level 1B scenes have from 5900 to 6100 pixel rows and from 5900 to 8000 pixel columns. Multispectral level 1B scenes have from 2900 to 3100 pixel rows and from 2900 to 5000 pixel columns.

The ReadSpot modules should be able to display virtually any SPOT image. They are able to read level 1A and 1B images in both panchromatic or multispectral forms. As SPOT images can be very large scaling factors and a window within the image can be specified. The ReadSpotImage and ReadSpotImageAlt modules manage access to the SPOT file so that only the appropriate parts of the image file are accessed for visualization.

Specifying the scaling and window parameters for the ReadSpotImage module can be difficult so below are two examples of setting up image parameters.

To display a 1000 x 1000 image derived from the entire contents of a level 1A SPOT panchromatic scene, you would set the following values:

Parameter
Value
Start Row 0
Start Column 0
Number of Output Rows 1000
Number of Output Columns 1000
X Scale Factor 1000 / 6000 = 0.16666
Y Scale Factor 1000 / 6000 = 0.16666

To display a 1000 x 1000 image derived from a 2000 x 2000 sub-image starting at row 300, column 500 of a SPOT scene, you would set the following values:

Parameter
Value
Start Row 300
Start Column 500
Number of Output Rows 1000
Number of Output Columns 1000
X Scale Factor 1000 / 2000 = 0.5
Y Scale Factor 1000 / 2000 = 0.5

The ReadSpotImageAlt module provides an alternate way of specifying the number of rows and columns that are to be read. Instead of specifying the number of output rows and columns that you want the final AVS field to have you specify the number of rows and columns that are to be read from the SPOT file. Which of these two modules are used depends on your problem domain and your personal preference. Shown below are the same two examples of setting up image parameters revised so that they work with the ReadSpotImageAlt module.

To display a 1000 x 1000 image derived from the entire contents of a level 1A SPOT panchromatic scene, you would set the following values:

Parameter
Value
Start Row 0
Start Column 0
Number of Input Rows 6000
Number of Input Columns 6000
X Scale Factor 1000 / 6000 = 0.16666
Y Scale Factor 1000 / 6000 = 0.16666

To display a 1000 x 1000 image derived from a 2000 x 2000 sub-image starting at row 300, column 500 of a SPOT scene, you would set the following values:

Parameter
Value
Start Row 300
Start Column 500
Number of Input Rows 2000
Number of Input Columns 2000
X Scale Factor 1000 / 2000 = 0.5
Y Scale Factor 1000 / 2000 = 0.5

Parameters

&input_params

Input parameter block that contains the input parameters for all three of the low-level modules.

input_params.HeaderFileName

String parameter that contains the name of the SPOT header file that should be read. The filename can either by relative or absolute and it can contain AVS/Express environment variables (i.e. $XP_ROOT, $XP_PATH<1>). This parameter is used all the low-level modules.

input_params.ImageFileName

String parameter that contains the name of the SPOT image file that should be read. The filename can either by relative or absolute and it can contain AVS/Express environment variables (i.e. $XP_ROOT, $XP_PATH<1>). This parameter is used by the ReadSpotImage and ReadSpotImageAlt modules.

input_params.BandNumberToRead

Integer parameter that specifies which band should be read from the SPOT file. Currently the ReadSpotImage module can read SPOT files that have either 1 or 3 bands. Therefore this parameter can only have the values 1,2 or 3. If no value is specified then all the bands will be read and the output data will be treated as greyscale or RGB data as appropriate. This parameter is used by the ReadSpotImage and ReadSpotImageAlt modules.

input_params.StartRow
input_params.StartColumn

Integer parameters that specify where the SPOT file should start to be to read from. This parameter is used by the ReadSpotImage and ReadSpotImageAlt modules.

input_params.NumberOfRows
input_params.NumberOfColumns

Integer parameters that specify how many rows and columns should be read from the SPOT file. For the ReadSpotImage module these parameters specify how many rows and columns the output AVS/Express field should have. Conversely for the ReadSpotImageAlt module these parameters specify how many rows and columns of data should be read from the input SPOT file.

input_params.XScaleFactor
input_params.YScaleFactor

Float parameters that specify the horizontal and vertical scaling factors that are to be used when a SPOT file is read. These scaling factors are intended to allow the user to downsize the SPOT image as it is read. This reduces the amount data that has to be processed by the visualization pipeline. The scaling factor is calculated as the output dimension divided by the input dimension. Therefore to downsize the SPOT data scaling factors of less than 1 would be used. This parameter is used by the ReadSpotImage and ReadSpotImageAlt modules.

input_params.ActivateFlag

Integer parameter that specifies whether the SPOT file should be read whenever a parameter is changed. If this parameter is set to 0 the SPOT file is never read. This allows the user to setup the scaling and window parameters without having to wait for SPOT file to load after each change. This parameter is used by the ReadSpotImage and ReadSpotImageAlt modules.

Outputs

output_params

Output parameter block that contains the header information read by the ReadSpotHeader module. The ReadSpotImage and ReadSpotImageAlt module do not use this parameter block as they access the header file directly. This parameter block is only intended to be used to provide information to the user.

output_params.ProcessingLevel

String parameter that states the processing level that this SPOT file was created with. This parameter can have the values '1A', '1B' or 'unknown'.

output_params.NumberOfBands

Integer parameter that states how many of bands of data are present in the SPOT file. The ReadSpotImage and ReadSpotImageAlt module can only read images with either 1 or 3 bands.

output_params.NumberOfRows
output_params.NumberOfColumns

Integer parameters that state the numbers of rows and columns that are present in the SPOT image.

output_params.Year
output_params.Month
output_params.Day

Integer parameters that state the date found in the SPOT header file.

output_params.Hour
output_params.Minute
output_params.Second

Integer and float parameters that state the time found in the SPOT header file. The hours and minutes are stated as integers. The number of seconds is stated as a floating point. The number of milliseconds read from the SPOT header is converted into seconds and stored in the seconds parameter.

Image

Field data output that contains the image data read from the SPOT file. This field data contains a 2D uniform mesh and one component of node data. If the SPOT file contains 1 band the node data will consist of scalar bytes. If the SPOT file contains 3 bands the node data will consist of a 3 byte vector that is treated as RGB data by the renderer.

Example

Two example applications are provided, ReadSpotEg and ReadSpotEgAlt, that demonstrate using the read_spot and read_spot_alt user macros to read and display SPOT files. No example SPOT files are included with the project as they would increase the size of the download by too much.

Files

iac_proj/rd_spot/rsptmods.v contains the V definitions of the ReadSpotInputParams and ReadSpotOutputParams groups and the ReadSpotHeader, ReadSpotImage and ReadSpotImageAlt low-level modules.

iac_proj/rd_spot/rsptmacs.v contains the V definitions of the read_spot and read_spot_alt User Macros, the ReadSpotImageFunc and ReadSpotImageFuncAlt Functional Macros and the ReadSpotUI and ReadSpotUIAlt UI Macros.

iac_proj/rd_spot/rsptapps.v contains the V definitions of the ReadSpotEg and ReadSpotEgAlt example applications.

Other Notes

The low-level ReadSpotMods library containing the low-level modules ReadSpotHeader, ReadSpotImage and ReadSpotImageAlt does not specify a process. By default the express process will be used.

Authors

Steve Walker
Advanced Visual Systems, Inc.

Modifications

Andrew Dodd
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also