Parameters¶
Parameters in the file¶
Every zea HDF5 file stores all parameters needed to process the acquisition
alongside the raw data. They are split into two groups:
- Probe (
probe/) Fixed for the whole acquisition — element geometry, center frequency, bandwidth, lens properties. Shared across all tracks. Defined by
ProbeSpec.- Scan (
scan/) Per-track transmit sequence — delays, apodizations, angles, waveforms, sound speed. Each track has its own
ScanSpec.
See the Group reference table for the complete field listing.
zea.Parameters¶
load_parameters() merges the probe and scan groups into a
single Parameters object and adds derived quantities
(wavelength, n_tx, grid, xlims/zlims, selected_transmits):
with zea.File("data.hdf5") as f:
parameters = f.load_parameters() # single-track
parameters = f.tracks[0].load_parameters() # multi-track
Config¶
A config is a YAML file (loaded as Config) that specifies where
the data lives, the pipeline to run, the device to use, and any parameter
overrides.
>>> from zea import Config
>>> from zea.config import check_config
>>> config = Config.from_path("../configs/config_picmus_rf.yaml")
>>> config = check_config(config) # fills defaults, validates
>>> config.pipeline.operations
['demodulate',
{'name': 'downsample', 'params': {'factor': 4}},
{'name': 'beamform', 'params': {'beamformer': 'delay_and_sum', 'enable_pfield': False}},
'envelope_detect',
'normalize',
'log_compress']
>>> config.to_yaml("my_config.yaml")
Supported keys¶
data — where to find the file
Key |
Default |
Description |
|---|---|---|
|
|
Full path to the HDF5 file. Supports local absolute paths, paths relative
to the user data root (set in |
|
|
Whether to use local data ( |
|
|
Which frames to load: |
parameters — override any field from the Group reference or pass custom keys straight through to the pipeline:
parameters:
center_frequency: 5.0e6
xlims: [-0.02, 0.02]
grid_size_x: 512
pipeline — list of operations (see Pipeline):
Key |
Default |
Description |
|---|---|---|
|
|
Ordered list of operations. Each entry is either an operation name (string)
or a mapping with |
|
|
JIT scope: |
|
|
Whether operations expect a leading batch dimension. |
Top-level keys
Key |
Default |
Description |
|---|---|---|
|
|
Target hardware: |
|
|
Device indices to exclude from auto-selection (int or list of ints). |
|
|
Git commit or branch recorded for reproducibility. |
The top-level config is open: arbitrary extra sections (model:, etc.)
are accepted and passed through unchanged.
Defining a beamforming grid¶
A zea.Parameters object builds a default beamforming grid from what a file
records: the probe geometry, the transmits (polar_angles, transmit_origins and
focus_distances) and the record length. You choose the grid type with grid_type
and enable_scanline, and can tune the result with a few overrides. Positions are in
the transducer frame: z = 0 at the middle of the array, +z into the medium, and
angles measured from +z, positive toward +x (see Angle and radius names).
zlimsDepths below the transducer. Defaults to the end of the record,
sound_speed * n_ax / sampling_frequency / 2.xlimsThe lateral extent of the grid. For a cartesian grid it covers what the transmits insonify down to
zlims[1], and at least the probe width. For a polar grid it is the width of the sector; an explicit value sets the width of the scan-converted image instead (crop or pad).grid_apexThe point a polar grid fans out from,
(0, 0, -d)on the central axis at or behind the array. It is derived from where the transmits fan out from: the point where steered transmit axes meet (the middle of the array, a virtual apex behind a flat array whose transmits are spread over it, or a curved array’s centre of curvature), the virtual source of unsteered diverging waves, or else a curved array’s centre of curvature.polar_limitsThe angles of the first and last column of a polar grid: the range of the transmit angles, widened to cover what the transmits insonify at
zlims[1]. A focused transmit adds no margin; plane and diverging waves widen it. Setpolar_marginto widen by a fixed angle instead.rlimsThe radii of the first and last row of a polar grid, measured from the apex:
zlims - grid_apex[2]. Scan conversion reads the polar image throughrlimsandpolar_limits.extentFor a polar grid, the window the scan-converted image fills:
xlimswide, and on a flat array starting atzlims[0], which crops what a virtual apex places behind the array.enable_scanlineOne column per focused transmit: a polar grid at the transmit angles when their axes meet in one point, or a vertical column under each transmit when they are parallel.
f_numberThe receive cone of each element. Defaults to the element’s -6 dB acceptance angle, so 0 (no cone) for most phased arrays. It masks pixels but does not change the grid.
Both figures below are drawn by the pixel grid explorer, a JavaScript port of the code
checked against reference values computed by zea (docs/explorer). Open the
explorer on either one to change the probe, transmits and overrides; the address then
holds every setting, so you can share a link to the exact grid.
A polar grid on a curved array fans out from its centre of curvature.
Focused lines that leave from across a phased array: their axes meet behind it in a virtual apex, and the grid fans out from there.
Angle and radius names¶
zea uses two kinds of angles, in radians, both in the transducer frame (x along
the array, y across it, +z into the medium):
Transmit directions are spherical coordinates, as stored in the file format.
Grid and scan-conversion angles are projections onto the x-z and y-z planes, so a 3D volume is a frustum that extends the 2D sector in elevation.
Symbol |
Name |
Meaning |
|---|---|---|
\(\theta\) |
|
Spherical polar angle of each transmit: the angle between its direction and
|
\(\phi\) |
|
Spherical azimuth angle of each transmit: the rotation of its direction around
|
\(r\), \(\rho\) |
|
Radius from |
\(\operatorname{atan}(x/z)\) |
|
Polar angle of the first and last column of a polar grid, signed, positive toward
|
\(\operatorname{atan}(y/z)\) |
|
Elevation angle of the first and last sample of a 3D frustum, signed, positive
toward |
To find where a transmit falls on the grid, convert its spherical angles:
A transmit steered only along the array has a grid polar angle equal to \(\theta\). Once it is also steered in elevation, the two differ.
Signed \(\theta\). \(\theta\) is stored with a sign, positive toward
+x. 2D data stores \(\phi = 0\). 3D data keeps \(\phi\) in \((-\pi/2, \pi/2]\), so the sign of \(\theta\) still
gives the side in x.
Note
Physics vs. mathematics convention. zea uses the physics convention (ISO 80000-2):
\(\theta\) is the polar angle from +z and \(\phi\) the azimuth around
z.
Note
Ultrasound jargon. In ultrasound, “azimuth” usually names the lateral direction,
along the array (x). We instead follow the
spherical coordinate system where
azimuth \(\phi\) is the rotation around the z axis.
API reference¶
|
Config object for managing configuration settings. |
- zea.config.check_config(config, verbose=False)[source]
Check a config given dictionary