Log Compression

The Log Compression algorithm applies the same log compression and optional normalization used in envelope detection to images that are already either scalar amplitude or interleaved IQ data. Use it when you have an envelope or magnitude image and only need B-mode–style display scaling, or when you want to compress IQ data without running full envelope detection.

Input

The algorithm expects pre-scan ultrasound data as a SharedImageSet, either as one or more offline frames or as an image or volume stream for online processing.

Each input slice must have one or two channels:

  • Two channels: interleaved in-phase and quadrature (IQ) samples, identical to the complex path in envelope detection. The magnitude \(\sqrt{I^2+Q^2}\) is formed internally before compression.

  • One channel: instantaneous amplitude (already equivalent to that magnitude). Values are treated as magnitudes; the absolute value is used so that signed inputs still compress predictably.

Two- and three-dimensional images (and corresponding sets) are supported.

Output

The result is a single-channel image: either normalized uint8 in the range [0, 255] or float dB in [-dynamic_range, 0], depending on the Normalize envelope option, with the same mask semantics as in the C++ implementation.

Algorithm Options

The following options are available in the controller for the Log Compression algorithm:

  • Dynamic range: Dynamic range of the log-compressed image (dB).

  • Reference amplitude: Reference amplitude for log compression (sets the 0 dB point).

  • Normalize envelope: Whether to map the compressed values to uint8 [0, 255]; if disabled, the output remains float in dB.

Python API

Use imfusion.ultrasound_image_formation.log_compression (see the Python package reference for parameters and return type).