Pulseq and measurement readers#

Read Pulseq .seq files and pair their timing and trajectories with extracted measurements or supplied arrays. See Pulseq import for file formats, metadata overrides and reconstruction examples.

class mrax.io.MeasurementData(image_data: ndarray | None = None, acquisition: AcquisitionData | None = None, spatial_geometry: SpatialGeometry | None = None, normalized_metadata: NormalizedMetadata = <factory>, metadata: Mapping[str, object]=<factory>)#

Images and prepared measurements at the import boundary.

mrax.io.read_pulseq_measurement(path: str | Path, *, sequence_path=None, format=None, reader_options: Mapping | None = None, metadata_overrides: Mapping | None = None, definition_paths=()) → MeasurementData#

Read extracted pixels/raw data and optional Pulseq sequence metadata.

MRD/NIfTI images and MRD encoded samples support descriptor-free reading. Siemens streams require a matching descriptor. Explicit overrides use the normalized schema: timing in ms, flip angles in degrees.

mrax.io.import_pulseq_study(root: str | Path, *, sequence_map=None, image_data=None, reader_options=None, type_overrides=None, metadata_overrides=None, study_globals=None, device='cpu', progress_callback=None, include_dicom=True, definition_paths=(), dicom_series_groups=None)#

Import extracted images. Return raw-only entries for explicit reconstruction.

Per-file mappings use paths relative to root. Valid experiments continue importing when another input produces a warning. Raw-only entries remain available for explicit reconstruction as metadata['raw_measurements'].

mrax.io.read_measurement(path: str | Path, *, format: str | None = None, **options) → MeasurementData#

Read an extracted file using a named adapter or an unambiguous extension.

mrax.io.register_measurement_reader(name: str, extensions, reader, *, inspector=None, replace=False)#

Register a file adapter that reads source files and prepares import data.

class mrax.io.pulseq_import.PulseqSequenceInfo(path: Path, definitions: Mapping[str, object]=<factory>, trajectory: ndarray | None = None, trajectory_physical: ndarray | None = None, adc_times: ndarray | None = None, adc_counts: tuple[int, ...]=(), sequence_kind: str = 'unknown', sequence_type: str = 'standard', spatial_shape: tuple[int, ...] | None=None, normalized_metadata: NormalizedMetadata = <factory>, adc_echo_times_ms: ndarray | None = None)#

Parsed Pulseq sequence metadata and ADC trajectory.

mrax.io.pulseq_import.read_pulseq(seq_path: str | Path, *, normalize_trajectory: bool = True, definition_paths=(), definition_overrides: Mapping | None = None, calculate_trajectory: bool = True) → PulseqSequenceInfo#

Read a Pulseq .seq file and return definitions plus ADC trajectory.

mrax.io.pulseq_import.read_pulseq_acquisition(seq_path, samples, *, spatial_shape=None, density=None, sequence_type=None, rare_slice_order=None, sample_axis=-1, coil_axis=None)#

Prepare measured samples for explicit image reconstruction.

mrax.io.pulseq_import.read_pulseq_sidecar_metadata(seq_path: str | Path) → dict[str, object]#

Read optional Pulseq sidecar metadata from JSON files next to the sequence.

mrax.io.pulseq_import.import_pulseq_experiment(seq_path: str | Path, *, measurement_path: str | Path | None = None, reader_options: Mapping | None = None, metadata_overrides: Mapping | None = None, device='cpu', definition_paths=(), kspace: ndarray | None = None, image_data: ndarray | None = None, spatial_shape: tuple[int, ...] | None = None, density: ndarray | None = None, sample_axis: int = -1, coil_axis: int | None = None, sequence_type: str | None = None, rare_slice_order: Sequence[int] | None = None, override_type: str | None = None, name: str | None = None, model_map_by_type: Mapping[str, Model | Callable[[], Model]] | None = None) → tuple[Experiment, DataSet, Model, dict]#

Build MRax containers from a Pulseq sequence and optional acquired data.

Pulseq files define the sequence and ADC trajectory. Measured signal samples come from the paired recording. Supply image_data for the experiment and optionally kspace. Raw-only workflows use read_pulseq_acquisition and reconstruct separately.

mrax.io.pulseq_import.detect_pulseq_kspace_kind(trajectory: ndarray | None, adc_counts: Sequence[int] = ()) → str#

Infer whether a Pulseq ADC trajectory is Cartesian, EPI, or non-Cartesian.