Skip to content

Data model

See the data-model guide for the schema and conventions.

A vendor-independent representation of one MRI acquisition.

Attributes:

Name Type Description
kspace Array

Complex k-space samples. See :data:KNOWN_AXES for the layout rules.

kspace_axes tuple[str, ...]

Names of the kspace axes, same length as kspace.ndim.

encoding EncodingSpace

:class:~unimri.data.EncodingSpace -- geometry and sampling.

acquisition AcquisitionInfo

:class:~unimri.data.AcquisitionInfo -- sequence / contrast parameters.

coils CoilInfo | None

:class:CoilInfo.

trajectory Trajectory | None

:class:~unimri.data.Trajectory for non-Cartesian data; None for Cartesian.

metadata ScannerMetadata

:class:~unimri.data.ScannerMetadata.

provenance Provenance

:class:~unimri.data.Provenance -- processing history.

axis(name)

Return the integer position of a named axis.

validate()

Check internal consistency. Returns self so calls can be chained.

Raises:

Type Description
ValidationError

On the first inconsistency found.

Geometry and sampling of the acquisition.

Attributes:

Name Type Description
recon_matrix tuple[int, int, int]

Target image matrix (nx, ny, nz) after reconstruction.

encoded_matrix tuple[int, int, int]

Nominal fully-sampled k-space matrix (nx, ny, nz) (before removing oversampling, before acceleration). For non-Cartesian data this is the gridding target.

fov FieldOfView

Field of view in mm.

sampling SamplingPattern

The :class:SamplingPattern.

acceleration tuple[int, ...]

Parallel-imaging acceleration per phase-encode axis, e.g. (2, 1).

partial_fourier tuple[float, float, float]

Partial-Fourier fraction per axis (1.0 == full), (ro, pe1, pe2).

n_dims int

2 or 3.

affine list[list[float]] | None

Optional 4x4 voxel-to-world matrix (RAS+), if the reader computed one.

Field of view in millimetres along (x, y, z).

Bases: str, Enum

How k-space was sampled. Drives which operators a reconstruction builds.

Sample locations in k-space for a non-Cartesian (or arbitrary) acquisition.

Attributes:

Name Type Description
coords Array

Array of shape (n_dims, ...) where the trailing axes index the readout samples (e.g. (n_dims, n_shots, n_readout)). n_dims is 2 or 3. Row d corresponds to image axis d (NumPy order): (ky, kx) for a 2-D image (ny, nx), (kz, ky, kx) for 3-D (nz, ny, nx).

units TrajectoryUnits

Interpretation of coords -- see the module docstring.

density_compensation Array | None

Optional array broadcastable to coords[0]; per-sample DCF weights.

dwell_time_s float | None

Optional readout dwell time, for off-resonance / trajectory timing.

sample_shape property

Shape of the readout-sample axes (everything after n_dims).

Bases: str, Enum

Receive-coil information.

Pulse-sequence and contrast metadata for a dataset.

Times are in seconds, angles in degrees, unless noted. Lists hold one entry per contrast/echo where applicable.

expected_larmor_hz property

Larmor frequency predicted from nucleus and field strength.

gamma_hz_per_t property

Gyromagnetic ratio (Hz/T) for :attr:nucleus, if known.

Return gamma-bar in Hz/T for a nucleus label (e.g. "23Na"), or None.

Information about the acquisition system.

All fields are optional; readers fill in what the source format provides. Anything without a typed home goes in :attr:extra.

Ordered history of everything done to a dataset.

Reproducibility is a first-class feature of UniMRI: reading a file and every subsequent transform should append a :class:ProvenanceStep here.

record(operation, *, params=None, backend='')

Append a step and return it.