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
- Read Mean Beam Pattern File:
- The tool first reads the
meanfileto 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, anddel_depthfrom the headers of the first and last records in themeanfile. - It loads the entire beam pattern data into an
unsigned chararraymeanand calculates the average mean intensityav_meanfor each depth bin.
- The tool first reads the
- 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
.beamextension (e.g.,input.glo->input.beam). - It reads each GLORIA record from the input file.
- It opens the input file for reading and creates an output file with a
- Correct Swath (
decon_swathfunction):- For each record, it determines the
depth(fromheader.altitude). - It calculates
frow, which is the floating-point index for the current depth based onmin_depthanddel_depth. - It then determines two integer row indices (
row1,row2) and their correspondingweight1,weight2for linear interpolation between the depth bins in themeanarray. - 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
valueby subtracting an interpolated correction factor from the original pixel value. The correction factor is derived from themeanandav_meanarrays for the current depth and angle. - The
valueis clamped between 0 and 254. - The corrected pixel value is written back to the record.
- For each record, it determines the
- Write Output: The corrected GLORIA record is written to the output file.
- Loop: This process repeats for all records in all input sidescan files.