debeam

Description

debeam is a utility designed to normalize the amplitudes of a sidescan (GLORIA/MR1) image across the swath. It uses a depth-dependent function, empirically derived from a large number of swaths (presumably using a tool like mabeam), to correct for beam pattern variations. The tool performs linear interpolation between depth bins for a smoother correction.

Usage

debeam <meanfile> <file1> [file2 ...]

Arguments

Option Description
<meanfile> Required. The input file containing the empirically derived mean beam pattern (typically generated by mabeam or a similar tool).
<file1> [file2 ...] Required. One or more input sidescan files (GLORIA/MR1 format) to be corrected.

How It Works

  1. Read Mean Beam Pattern File:
    • The tool first reads the meanfile to load the empirically derived beam pattern. This file is expected to contain GLORIA-like records where the image data represents the mean amplitude for various depth and angle bins.
    • It determines the min_depth, max_depth, and del_depth from the headers of the first and last records in the meanfile.
    • It loads the entire beam pattern data into an unsigned char array mean and calculates the average mean intensity av_mean for each depth bin.
  2. Process Sidescan Files: For each input sidescan file (file1, file2, etc.):
    • It opens the input file for reading and creates an output file with a .beam extension (e.g., input.glo -> input.beam).
    • It reads each GLORIA record from the input file.
  3. Correct Swath (decon_swath function):
    • For each record, it determines the depth (from header.altitude).
    • It calculates frow, which is the floating-point index for the current depth based on min_depth and del_depth.
    • It then determines two integer row indices (row1, row2) and their corresponding weight1, weight2 for linear interpolation between the depth bins in the mean array.
    • For each pixel in the sidescan data (stbd_data):
      • If the pixel value is 255 (indicating an unassigned or invalid pixel), it remains 255.
      • Otherwise, it calculates a value by subtracting an interpolated correction factor from the original pixel value. The correction factor is derived from the mean and av_mean arrays for the current depth and angle.
      • The value is clamped between 0 and 254.
      • The corrected pixel value is written back to the record.
  4. Write Output: The corrected GLORIA record is written to the output file.
  5. Loop: This process repeats for all records in all input sidescan files.