convSUB16
Description
convSUB16 is a utility designed to convert 16-bit intensity sidescan data from Submetrix 2000 into an 8-bit GLORIA format (typically a .sst file). It processes OMG_HDCS merged files, extracting profile and beam information, and then reads associated 16-bit sidescan data (.ss_data). The tool offers various scaling options (linear, square root, TVG, or logarithmic) to effectively compress the high-resolution 16-bit data into an 8-bit dynamic range suitable for display or further processing.
Usage
convSUB16 [-v] [-linss | -sqrtss | -tvgss] [-dump_ping <ping_num>] [-dump_sample <sample_num>] [-min16 <value>] [-max16 <value>] <mergedfile>
Arguments
| Option | Description | Default |
|---|---|---|
-v | Enable verbose output, providing more detailed processing messages. | (None) |
-linss | Apply linear scaling to the 16-bit data. | (None, mutually exclusive) |
-sqrtss | Apply square root scaling to the 16-bit data. | (None, mutually exclusive) |
-tvgss | This option is present but its functionality for TVG-based scaling is not explicitly implemented in the provided code snippet (falls through to logarithmic by default). | (None, mutually exclusive) |
-dump_ping <ping_num> | Debugging option: Prints all samples for a specific ping and exits. | (None) |
-dump_sample <sample_num> | Debugging option: Prints the value of a specific sample for every other ping. | (None) |
-min16 <value> | Sets the minimum 16-bit value for the scaling range. | 0 |
-max16 <value> | Sets the maximum 16-bit value for the scaling range. | 64000 |
<mergedfile> | Required. The input OMG_HDCS merged file. The tool will also look for <mergedfile>.ss_data (for 16-bit sidescan) and will create <mergedfile>.sst (for 8-bit output). | Â |
How It Works
- Argument Parsing & Initialization: The tool parses command-line arguments to set scaling parameters (
min16,max16) and flags for different scaling methods (linear_ss,sqrtss,tvgss). - Min/Max Range Setup: It calls
set_Min_Max_Rangeto initialize internal min/max values for different scaling types. - File Handling:
- Opens the input OMG_HDCS merged file.
- Opens an associated
.sstfile for writing the 8-bit GLORIA output. - Opens an associated
.ss_datafile for reading the raw 16-bit sidescan data.
- Process Pings: It iterates through each ping (record) in the merged file:
- Read Profile: Reads the
OMG_HDCS_profile_headerfor the current ping. - Read GLORIA Header: Reads the corresponding GLORIA record header from the
.sstfile (to get byte offset and number of samples fromcb_offset[0]andcb_depth[0]). - Seek 16-bit Data: Uses the
byteoffsetandnosamsfrom the GLORIA header to seek to the correct location in the.ss_datafile and readsnosams16-bit samples intodat16. - Debug Options: If
-dump_pingor-dump_sampleare used, specific debugging information is printed. - Scaling and Compression: For each 16-bit sample (
fval) indat16:- Linear Scaling (
-linss):fval = (fval - min16) / (max16 - min16); - Square Root Scaling (
-sqrtss):fval = sqrt(fval); fval = (fval - minsqrt) / (maxsqrt - minsqrt); - Logarithmic Scaling (Default or if
-tvgss):fval = log(fval); fval = (fval - minlog) / (maxlog - minlog); - The scaled
fvalis then multiplied by 255.0 and clamped to the 0-255 range to create an 8-bit value (dat8).
- Linear Scaling (
- Collapse into 512 (
collapse_into_512): Thedat8array (containingnosams8-bit samples) is collapsed into a 512-sample GLORIA record. This involves averagingipack(whereipack = rxsamps / 512) samples into one GLORIA pixel. The processed 8-bit data is then assigned to the port or starboard side ofgrecbased oncurrent_side. - Write GLORIA Record: The resulting 8-bit
grecis written to the.sstfile.
- Read Profile: Reads the
- File Closing: All opened files are closed.