offtrack
Description
offtrack is a comprehensive utility for simulating and processing sidescan sonar data, particularly GLORIA imagery, by incorporating detailed physical modeling. It can perform several key functions:
- Full Slant Range Correction (
-fullslr): Corrects sidescan imagery by taking into account detailed seafloor topography and water column refraction effects. - Mock Image Generation (
-mock): Creates synthetic sidescan images that simulate how an area would appear based on its topography, beam pattern, and water column properties. - Backscatter Strength Calculations (
-backscatter): Derives quantitative backscatter strength (S_b) values for each pixel, correcting for geometry, transmission loss, beam patterns, and insonified area. - Depth Equivalent Image Generation (
-depth): Generates an image where pixel values directly represent the seafloor depth.
This tool integrates information from various environmental and system parameters, including detailed topography, water column sound velocity structure, beam patterns, aspherical spreading, magnetic declination, and sonar system characteristics. It also handles edge cases like cast shadows and data outside the Digital Terrain Model (DTM).
Usage
offtrack -topo <topo_file | flat> -water <wc_file_prefix> -image <image_file> -pix <pixel_size> [-proj_lat <lat>] [-declin <declin_val>] [-somers_delay <delay>] [-min_beam <gain>] [-clip_beam <angle>] [-port_offset <offset>] [-starboard_offset <offset>] [-mock <mock_file> | -fullslr <slr_file> | -backscatter <bksct_file_prefix> | -depth <depth_file>] [-maxangle <angle>] [-maxdepth <depth>] [-mindepth <depth>] [-min <dB>] [-max <dB>] [-nadirbias] [-nofocus] [-squared] [-cast_shadow] [-debug <record>] [-first <rec>] [-last <rec>] [-verbose]
Arguments
| Option | Description |
|---|---|
-topo <topo_file | flat> | Required. Input topographic file (e.g., a .r4 grid) or the string “flat” to assume nadir topography only. |
-water <wc_file_prefix> | Required. Prefix for water column related files. Expects: <prefix>.time_lag, <prefix>.grazing_angle, <prefix>.beam_port, <prefix>.beam_stbd, <prefix>.aspherical, <prefix>.beam_angle. |
-image <image_file> | Required. Input merged GLORIA image file (e.g., a .des or .mer file). |
-pix <pixel_size> | Required. Output pixel size in meters. |
-proj_lat <lat> | Projection latitude for Mercator projection. Default is taken from the topography file header. |
-declin <declin_val> | Magnetic declination in degrees. Used to correct azimuth. |
-somers_delay <delay> | Time delay (in seconds) applied for Somers correction. |
-min_beam <gain> | Minimum beam gain factor to consider. |
-clip_beam <angle> | Minimum beam angle (in degrees) to map. Beams below this angle are masked. |
-port_offset <offset> | Sample offset to apply to port side data in the input image. |
-starboard_offset <offset> | Sample offset to apply to starboard side data in the input image. |
-mock <mock_file> | Output a synthetic sidescan image to <mock_file>. (Mutually exclusive with -fullslr, -backscatter, -depth). |
-fullslr <slr_file> | Output a full slant-range corrected image to <slr_file>. (Mutually exclusive with -mock, -backscatter, -depth). |
-backscatter <bksct_file_prefix> | Output a quantitative backscatter strength image to <bksct_file_prefix>.bksct and an impinging angle image to <bksct_file_prefix>.imping. (Mutually exclusive with -mock, -fullslr, -depth). |
-depth <depth_file> | Output a depth equivalent image to <depth_file>. (Mutually exclusive with -mock, -fullslr, -backscatter). |
-maxangle <angle> | Maximum angle (in degrees) for synthetic image generation or backscatter mapping. |
-maxdepth <depth> | Maximum depth for scaling in depth equivalent images (negative values are shallower). |
-mindepth <depth> | Minimum depth for scaling in depth equivalent images (negative values are deeper). |
-min <dB> | Minimum dB value for scaling backscatter output to 8-bit. |
-max <dB> | Maximum dB value for scaling backscatter output to 8-bit. |
-nadirbias | Apply a nadir bias correction (linear weighting between DTM and PDR depth). |
-nofocus | Disable beam focusing. |
-squared | Square the TVG (Time Varying Gain) correction in backscatter calculations. |
-cast_shadow | Enable cast shadow detection. |
-debug <record> | Enable debug mode for a specific record, outputting detailed ASCII values. |
-first <rec> | First record to process (ignored in debug mode). |
-last <rec> | Last record to process (ignored in debug mode). |
-verbose | Enable verbose output. |
How It Works
offtrack operates by ray-tracing through a 3D environment defined by the seafloor topography and water column sound velocity structure. For each pixel in the input sidescan image, it determines the true seafloor coordinates, grazing angle, and acoustic path properties.
- Input Loading:
- Loads various look-up tables (LUTs) from JHC image files, including:
- Topography (
-topo): A Digital Terrain Model (DTM) or assumes a flat seafloor. - Water Column (
-water): Time-lag vs. range, grazing angle vs. range, port/starboard beam patterns, and aspherical spreading component.
- Topography (
- Loads the input GLORIA image (
-image).
- Loads various look-up tables (LUTs) from JHC image files, including:
- Initialization: Initializes parameters like pixel size, projection latitude, magnetic declination, and TVG (
tvgarray). - Process GLORIA Records: The tool iterates through each record (ping) of the input GLORIA image.
- Across-Swath Processing: For each pixel (
j) across the swath (from starboard to port):- Georeferencing: Converts the pixel’s apparent position (relative to nadir and vessel) to a geographic coordinate (
xpos,ypos) on the DTM, accounting for ship’s heading and offsets. - Depth Query: Retrieves the seafloor depth (
value) from the DTM at(xpos, ypos). Ifflat_flagis set, uses a simplified nadir depth. - Nadir Bias Correction (
-nadirbias): If enabled, it blends the DTM-derived depth with a simplified nadir-only depth within a certain range around the nadir. - Acoustic Path Calculation: Using the interpolated depth and range to the seafloor:
rgraze: True grazing angle from the water column LUT.beam_focus: Beam focusing factor (from aspherical spreading LUT).pixel_time: Two-way travel time from the water column LUT.
- Footprint Check: Checks if the pixel is within the insonified footprint (valid
rgraze,beam_focus,pixel_time). - Derived Output Calculation (based on chosen flag):
- Depth Equivalent (
-depth): Scales thevalue(depth) to an 8-bit pixel intensity and writes it toout_rec. - Full Slant Range Corrected (
-fullslr): Calculates the corresponding pixel index (pixel) in the original GLORIA image based on thepixel_time. The pixel value from the original image at this corrected position is written toout_rec. Accounts forport_offset,starboard_offset, and asomers_delayto avoid TVG rollover. - Mock Image (
-mock): Calculates the true grazing angle (true_grazing_angle) at the seafloor using vector algebra on the DTM.angle_diffis computed asrgraze - true_grazing_angle. This difference is then scaled to an 8-bit value and written toresult_rec. - Backscatter Strength (
-backscatter): This is the most complex mode:- Determines
rbeam(beam gain) from the port/starboard beam pattern LUTs. - Converts the input GLORIA image’s 8-bit intensity (
old_8bit) to a 12-bit value (r12_bit) and then to acoustic intensityI_b. - Corrects
I_bfor TVG (tvg[index]) with optional squaring (-squared). - Calculates
inson_area(insonified area) based on slant range, beam width, sound speed, and pulse width, using thetrue_grazing_angle. - Calculates
range_decaybased on absorption coefficient and slant range. - Finally, calculates the quantitative backscatter strength
S_busing the sonar equation. - Scales
S_b(in dB) to an 8-bit value (new_8bit) usingmin_dBandmax_dB. This is written toresult_rec. - The
true_grazing_angleis scaled and written toout_recas the impinging angle image. - Cast Shadow Detection (
-cast_shadow): If enabled, it attempts to detect shadows by comparing currentbeam_angleto a previous one. If a shadow is detected, thetrue_grazing_angleis set to an error code. - Beam Clipping (
-clip_beam): Pixels withbeam_anglebelowclip_beamare masked out.
- Determines
- Debugging (
-debug): If enabled, outputs detailed ASCII values for various calculated parameters tofullslrfileinstead of a GLORIA image.
- Depth Equivalent (
- Georeferencing: Converts the pixel’s apparent position (relative to nadir and vessel) to a geographic coordinate (
- Output: The generated or corrected records (
out_rec,result_rec) are written to the appropriate output files. - Loop: This process repeats until all records have been processed.