EncodingSpace

Contents

EncodingSpace#

class pulserver.mrd.EncodingSpace[source]#

Bases: object

Buffer layout of one encoding space of an MRD header.

Parameters:
  • index (int) – Position in the header’s encoding list; what encoding_space_ref names.

  • coils (int) – Receive channels.

  • readout (int) – Samples per readout.

  • phase_encodes – Extent along kspace_encode_step_1 and kspace_encode_step_2.

  • partitions – Extent along kspace_encode_step_1 and kspace_encode_step_2.

  • loops (tuple[str, ...]) – Counters that vary in this space and are laid out as axes, outermost first: those of LOOP_COUNTERS, and segment when from_header() was asked for it.

  • loop_sizes (tuple[int, ...]) – Extent of each counter in loops.

  • recon_matrix (tuple[int, ...]) – Image matrix, (n_y, n_x) for a plane or (n_z, n_y, n_x) for a volume. Independent of the buffer axes: a stack of spokes has no partition axis and a three-dimensional matrix.

  • recon_fov (tuple[float, ...] | None) – Field of view of the image in metres, ordered as recon_matrix; None when the header states none.

  • cartesian (bool) – Whether the space samples a Cartesian grid. A readout of a Cartesian space is placed by its echo along the readout, and its lines by their offset from the k-space centre; a non-Cartesian space places a readout as it arrives and a view by its counter.

  • phase_center – Counter value of the k-space centre along kspace_encode_step_1 and kspace_encode_step_2, from the center of the header’s encoding limits; None where the header states none, so the counter is the position on the grid.

  • partition_center – Counter value of the k-space centre along kspace_encode_step_1 and kspace_encode_step_2, from the center of the header’s encoding limits; None where the header states none, so the counter is the position on the grid.

Examples

>>> import pulserver.mrd as mrd
>>> space = mrd.EncodingSpace(
...     index=0, coils=4, readout=64, phase_encodes=32, partitions=1,
...     loops=("slice",), loop_sizes=(2,), recon_matrix=(32, 32),
... )
>>> space.shape
(4, 2, 32, 64)

Methods

all_from_header

Read every encoding space of a parsed MRD header, in index order.

from_header

Read encoding space index of a parsed MRD header.

offset

Shift that places a counter of axis on this space's grid.

Attributes

axes

Axis names of a buffer of this space.

cartesian

extents

Placement axes and their extents, outermost first, including extents of 1.

partition_center

phase_center

recon_fov

shape

Shape of a buffer of this space, named by axes.

index

coils

readout

phase_encodes

partitions

loops

loop_sizes

recon_matrix