io.read_mrd_stream

io.read_mrd_stream#

bartorch.io.read_mrd_stream()#

Read the readouts of one encoding space of an MRD stream, as read_mrd() reads a file’s.

A stream is what a scanner sends a reconstruction: the XML header, then one acquisition per readout, each with its samples, its trajectory and its counters. The readouts are placed, and the noise readouts set apart, exactly as read_mrd() does for the same readouts in a file.

Parameters:
  • header (str or ismrmrd.xsd.ismrmrdHeader) – The stream’s XML header, as text or as ismrmrd parses it.

  • acquisitions (iterable of ismrmrd.Acquisition) – The stream’s acquisitions, in the order they arrived.

  • encoding (int, default=0) – Encoding space to read, as the readouts’ encoding_space_ref names it.

  • trajectory_units ({None, "grid", "1/m", "fraction"}, default=None) – Units the stream’s trajectories are in, as read_mrd() takes them.

Returns:

As read_mrd() returns it.

Return type:

MrdRaw

Raises:
  • ValueError – If the header has no such encoding space, the stream holds no readout or none belongs to the space, or a counter runs past the extent the header states.

  • ImportError – If ismrmrd is not installed.