Acquisition conventions#

AcquisitionData stores complex samples as (frame, coil, *encoding_shape) for Cartesian data or (frame, coil, sample) for trajectories.

  • Trajectory columns follow encoding_axes, in cycles per pixel of the encoding grid. Cartesian DC is at size // 2. The inverse FFT is centered and orthonormal.

  • acquired marks measured support, including measured zeros. Iterative objectives use this measured support. Completed samples serve initialization.

  • density supplies quadrature weights for initialization. statistical_weights supplies confidence in the likelihood. Sampling masks are binary.

  • domain="adc" requires spatial encoding before MRI reconstruction.

  • Auxiliary samples hold complex calibration data. Auxiliary coordinates hold real values such as navigator times. auxiliary_frame_axes declares their frame-dependent axes for selection, batching and saving.

DataSet.kspace, trajectory, density and sampling masks mirror the acquisition. AcquisitionData.select_frames selects output frames and their associated native measurements.

Importers normalize storage order, polarity, Fourier signs, units and receiver calibration. Recipes specify image permutations, flips and cropping. stack_slices and average_repeats map native readouts to output frames. Model-based encoding reverses this layout. Sensitivities may be shared or vary by frame, with an explicit receiver axis. Acquisition archives use arrays and JSON with explicit numeric arrays.

Readouts can carry nonuniform coordinates and polarity. FFT initialization uses direct Fourier quadrature by default. Linear and windowed-sinc interpolation are alternatives. Coordinates retain their declared span. Iterative solvers encode the original measurements. ReadoutModel optionally initializes delayed or paired profiles with a truncated-SVD inverse and reports rank and conditioning.

class mrax.data_struct.AcquisitionData(samples: ~numpy.ndarray, encoding_shape: tuple[int, ...], encoding_axes: tuple[str, ...], kind: str = 'cartesian', domain: str = 'kspace', acquired: ~numpy.ndarray | None = None, trajectory: ~numpy.ndarray | None = None, density: ~numpy.ndarray | None = None, statistical_weights: ~numpy.ndarray | None = None, readout_polarity: ~numpy.ndarray | None = None, readout_coordinates: ~numpy.ndarray | None = None, auxiliary_samples: ~typing.Mapping[str, ~numpy.ndarray] = <factory>, geometry: ~mrax.data_struct.geometry.SpatialGeometry | None = None, frame_coordinates: ~typing.Mapping[str, ~numpy.ndarray] = <factory>, recipe: ~mrax.data_struct.acquisition.ReconstructionRecipe = <factory>, readout_model: ~mrax.data_struct.acquisition.ReadoutModel | None = None, schema_version: int = 1, auxiliary_coordinates: ~typing.Mapping[str, ~numpy.ndarray] = <factory>, auxiliary_frame_axes: ~typing.Mapping[str, int] = <factory>)#

Measured samples with explicit frame, receiver, and encoding axes.

Cartesian samples are (frame, coil, *encoding_shape). Sampled data are (frame, coil, sample). Trajectory columns follow encoding_axes and use cycles/pixel of the explicitly declared encoding grid. This normalized coordinate view is independent of the source’s physical coordinate units. Validity is separate from signal values and from quadrature/statistical weights. The numerical contract contains normalized arrays and geometry. Import metadata retains source paths and vendor dictionaries.

select_frames(indices) → AcquisitionData#

Select reconstructed frames while retaining their raw slice groups.

Encoding coordinates and calibration streams remain unchanged. Arrays with an explicit acquisition-frame axis follow the selection. Shared masks and weights remain shared. Selection follows the explicitly declared acquisition-frame axis.

class mrax.data_struct.ReconstructionRecipe(image_shift: tuple[float, ...] = (), frame_image_shifts: tuple[tuple[float, ...], ...] = (), partial_fourier: str = 'none', partial_fourier_iterations: int = 12, phase_window: str = 'boxcar', homodyne_weighting: str = 'step', partial_fourier_tolerance: float = 0.0, epi_phase_correction: str = 'none', epi_phase_prior: tuple[float, float] = (0.0, 0.0), coil_combine: str = 'rss', output_scale: float = 1.0, encoding_scale: float | None = None, output_permutation: tuple[int, ...] = (), output_flips: tuple[int, ...] = (), frame_permutations: tuple[tuple[int, ...], ...] = (), stack_slices: int = 1, output_stack_permutation: tuple[int, ...] = (), output_frame_indices: tuple[int, ...] = (), output_shape: tuple[int, ...] = (), crop_offset: tuple[int, ...] = (), gridding_shape: tuple[int, ...] = (), gridding_kernel_width: float = 3.0, gridding_shape_parameter: float = 6.0, deapodize: bool = False, deapodization_normalization: str = 'relative', checkerboard: bool = False, elliptical_support: bool = False, profile_inversion: bool = False, average_repeats: int = 1, readout_regrid: bool = True, readout_interpolation: str = 'adjoint', readout_kernel_radius: int = 8, output_product: str = 'image', echo_spacing_seconds: float | None = None, product_unwrap: bool = True, product_unwrap_method: str = 'quality_guided', product_mask_snr: float = 0.0, product_signal_fraction: float = 0.0, product_corner_fraction: float = 0.2, kspace_window: tuple[str, ...] = (), window_parameters: tuple[float, ...] = (), window_powers: tuple[int, ...] = (), output_slice_counts: tuple[int, ...] = ())#

Numerical operations expressed through the acquisition contract.

class mrax.reco.ReconstructionPipeline(stages: tuple[ReconstructionStage, ...])#

Ordered stage plan for the shared acquisition reconstruction entry point.

Shift and partial-Fourier/gridding stages precede exactly one solver. Output formatting and coil combination follow it. Partial-Fourier values initialize iterative solvers. The acquired support defines their data term.

classmethod from_acquisition(acquisition: AcquisitionData, *, method='fft', **optimizer_options)#

Make the importer’s suggested numerical operations visible/editable.

classmethod from_toml(path: str | Path)#

Read a declarative plan using allowlisted keys and values.

replace_stage(kind, *, replacement=None, **options)#

Return a modified plan. The original acquisition remains untouched.

class mrax.reco.ReconstructionStage(kind: str, options: Mapping[str, ~typing.Any]=<factory>)#

One named algorithm and explicit options. Unknown names are rejected.