glslant
Description
glslant is a utility designed to perform slant-range correction on JCU GLORIA format sidescan files. It takes an input GLORIA file, corrects the imagery for slant range distortion based on the vehicleβs altitude, a specified pixel size, and the sound speed in water, and then outputs a new GLORIA file with the corrected imagery. It allows for optional pixel skipping on the port and starboard sides.
Usage
glslant [-V] [-v <sound_speed>] [-l <port_skip>] [-r <stbd_skip>] [-p <pixel_size>] <infile> <outfile>
Arguments
| Option | Description | Β |
|---|---|---|
-V | Enable verbose output, printing progress messages. | Β |
-v <sound_speed> | Specifies the sound speed in water (in m/s). | 1500.0 |
-l <port_skip> | Specifies the number of pixels to skip on the port side. | 0 |
-r <stbd_skip> | Specifies the number of pixels to skip on the starboard side. | 0 |
-p <pixel_size> | Specifies the resultant pixel size (in meters) after correction. | 90 |
<infile> | Required. The input JCU GLORIA file to be slant-range corrected. | Β |
<outfile> | Required. The output JCU GLORIA file with slant-range corrected imagery. | Β |
How It Works
- Argument Parsing: The tool parses command-line arguments to configure sound speed, pixel skipping, and output pixel size.
- File Opening: It opens the input GLORIA file (
infd) for reading and the output GLORIA file (outfd) for writing. - Record Processing Loop: The tool reads each GLORIA record (
gl_in) from the input file:- Header Copy: The header information from
gl_inis copied togl_out. - Slant-Range Correction for Each Pixel: For each pixel
jacross the swath (from 0 to 511):- Across-Track Distance:
offsetis calculated as the ground distance from the nadir to the pixel (((float)j + 0.5) * pixel_size). - Slant Range: The
slant_rangeto the seafloor is calculated using the Pythagorean theorem:sqrt(offset^2 + gl_out.header.altitude^2). - Time of Arrival:
timeis calculated as2 * slant_range / sound_speed. - Original Pixel Index:
pixelis the index in the original (un-corrected) image data that corresponds totime. This conversion uses eithergl_out.header.small_pixelorgl_out.header.ping_rate. - Data Transfer:
- If
pixelis within the valid range and consideringstbd_skip, the pixel value fromgl_in.stbd_dataat the calculated original index is copied togl_out.stbd_data. - Similarly for the port side, considering
port_skip. - If
pixelfalls outside valid bounds (e.g., beyond the swath or after skipping), the output pixel is set to 255 (invalid).
- If
- Across-Track Distance:
- Output Header Update:
gl_out.header.pixel_sizeis set to 0, andgl_out.header.small_pixelis updated to the newpixel_size. - Write Record: The corrected
gl_outrecord is written to the output file.
- Header Copy: The header information from
- Loop: This process repeats until all records in the input file have been processed.
- Error Exit (
err_exit): A helper function to print usage information and exit on error.