read_spot & read_spot_alt

Synopsis

The read_spot and read_spot_alt user macros read all or part of the contents of SPOT Panochromatic or Multispectral images into AVS/Express. They also manage access to the large amounts of data in a SPOT image. The read_spot_alt macro provides an alternative way of specifying the scaling and windowing parameters.

Parameters

Name Type Description UI Control

HeaderFileName String Name of SPOT header file. File Dialog
ImageFileName String Name of SPOT image file. File Dialog
BandNumberToRead Integer Band to read from SPOT image. UI Field
StartRow Integer Row to start reading from. UI Field
StartColumn Integer Column to start reading from. UI Field
NumberOfRows Integer Number of rows to read. UI Field
NumberOfColumns Integer Number of columns to read. UI Field
XScaleFactor Float Horizontal scaling factor. UI Field
YScaleFactor Float Vertical scaling factor. UI Field
ActivateFlag Integer Toggles update of image. UI Toggle

Output Ports

Name Type Description

out_image 2D Uniform Field Image data read from SPOT file.
out_obj DataObject Directly renderable output object.
 
ProcessingLevel string Level of image processing ('1A' or '1B')
NumberOfBands integer Number of bands of data in SPOT file.
NumberOfRows integer Total number of rows of data.
NumberOfColumns integer Total number of columns of data.
Year
Month
Day
integer Date contained in SPOT file.
Hour
Minute
integer Time contained in SPOT file.
Second float Time contained in SPOT file.

Description

These two user macros read SPOT image files. The read_spot macro reads the both the header and image data from a set SPOT header and image files. The header information is displayed to the user and the image data is output as a 2D AVS/Express image field and renderable object. The read_spot_alt macro is derived from the read_spot macro 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 macros 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 macros 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 read_spot and read_spot_alt macros 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 read_spot 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 read_spot_alt 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 read_spot_alt 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 the user macros.

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>).

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>).

input_params.BandNumberToRead

Integer parameter that specifies which band should be read from the SPOT file. Currently the read_spot macro 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.

input_params.StartRow
input_params.StartColumn

Integer parameters that specify where the SPOT file should start to be to read from.

input_params.NumberOfRows
input_params.NumberOfColumns

Integer parameters that specify how many rows and columns should be read from the SPOT file. For the read_spot macro these parameters specify how many rows and columns the output AVS/Express field should have. Conversely for the read_spot_alt macro 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.

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.

Outputs

out_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.

out_obj

The directly renderable output of the read_spot and read_spot_alt macros. This output contains the image data read from the SPOT file in a form that can be rendered by the standard data viewers.

output_params

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

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 read_spot and read_spot_alt macro 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.

Utility Modules

The ReadSpotImageFunc functional macro uses the ReadSpotImage low-level module. The read_spot user macro uses this functional macro, the ReadSpotHeader low-level module and the ReadSpotUI user interface macro. The ReadSpotImageFuncAlt functional macro uses the ReadSpotImageAlt low-level module. The read_spot_alt user macro uses this functional macro, the ReadSpotHeader low-level module and the ReadSpotUIAlt user interface macro. All of these macros use the ReadSpotInputParams and ReadSpotOutputParams parameter blocks to communicate information between themselves.

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 ReadSpotMacs library inherits its process. As this library contains no procedural code, the process is not important. The modules in the low-level ReadSpotMods library execute under the process specified in that library, not the process defined in the high-level library.

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