mrpro.data.AcqInfo

class mrpro.data.AcqInfo(idx: AcqIdx, acquisition_time_stamp: Tensor, active_channels: Tensor, available_channels: Tensor, center_sample: Tensor, channel_mask: Tensor, discard_post: Tensor, discard_pre: Tensor, encoding_space_ref: Tensor, flags: Tensor, measurement_uid: Tensor, number_of_samples: Tensor, patient_table_position: SpatialDimension[Tensor], phase_dir: SpatialDimension[Tensor], physiology_time_stamp: Tensor, position: SpatialDimension[Tensor], read_dir: SpatialDimension[Tensor], sample_time_us: Tensor, scan_counter: Tensor, slice_dir: SpatialDimension[Tensor], trajectory_dimensions: Tensor, user_float: Tensor, user_int: Tensor, version: Tensor)[source]

Bases: MoveDataMixin

Acquisition information for each readout.

__init__(idx: AcqIdx, acquisition_time_stamp: Tensor, active_channels: Tensor, available_channels: Tensor, center_sample: Tensor, channel_mask: Tensor, discard_post: Tensor, discard_pre: Tensor, encoding_space_ref: Tensor, flags: Tensor, measurement_uid: Tensor, number_of_samples: Tensor, patient_table_position: SpatialDimension[Tensor], phase_dir: SpatialDimension[Tensor], physiology_time_stamp: Tensor, position: SpatialDimension[Tensor], read_dir: SpatialDimension[Tensor], sample_time_us: Tensor, scan_counter: Tensor, slice_dir: SpatialDimension[Tensor], trajectory_dimensions: Tensor, user_float: Tensor, user_int: Tensor, version: Tensor) None

Methods

__init__(idx, acquisition_time_stamp, ...)

clone()

Return a deep copy of the object.

cpu(*[, memory_format, copy])

Put in CPU memory.

cuda([device, non_blocking, memory_format, copy])

Put object in CUDA memory.

double(*[, memory_format, copy])

Convert all float tensors to double precision.

from_ismrmrd_acquisitions(acquisitions)

Read the header of a list of acquisition and store information.

half(*[, memory_format, copy])

Convert all float tensors to half precision.

single(*[, memory_format, copy])

Convert all float tensors to single precision.

to(*args, **kwargs)

Perform dtype and/or device conversion of data.

Attributes

idx

Indices describing acquisitions (i.e. readouts).

acquisition_time_stamp

Clock time stamp.

active_channels

Number of active receiver coil elements.

available_channels

Number of available receiver coil elements.

center_sample

Index of the readout sample corresponding to k-space center (zero indexed).

channel_mask

Bit mask indicating active coils (64*16 = 1024 bits).

discard_post

Number of readout samples to be discarded at the end (e.g. if the ADC is active during gradient events).

discard_pre

Number of readout samples to be discarded at the beginning (e.g. if the ADC is active during gradient events).

encoding_space_ref

Indexed reference to the encoding spaces enumerated in the MRD (xml) header.

flags

A bit mask of common attributes applicable to individual acquisition readouts.

measurement_uid

Unique ID corresponding to the readout.

number_of_samples

Number of sample points per readout (readouts may have different number of sample points).

patient_table_position

Offset position of the patient table, in LPS coordinates [m].

phase_dir

Directional cosine of phase encoding (2D).

physiology_time_stamp

Time stamps relative to physiological triggering, e.g. ECG.

position

Center of the excited volume, in LPS coordinates relative to isocenter [m].

read_dir

Directional cosine of readout/frequency encoding.

sample_time_us

Readout bandwidth, as time between samples [us].

scan_counter

Zero-indexed incrementing counter for readouts.

slice_dir

Directional cosine of slice normal, i.e. cross-product of read_dir and phase_dir.

trajectory_dimensions

Dimensionality of the k-space trajectory vector.

user_float

User-defined float parameters.

user_int

User-defined int parameters.

version

Major version number.

device

Return the device of the tensors.

is_cpu

Return True if all tensors are on the CPU.

is_cuda

Return True if all tensors are on a single CUDA device.

acquisition_time_stamp: Tensor

Clock time stamp. Not in s but in vendor-specific time units (e.g. 2.5ms for Siemens)

active_channels: Tensor

Number of active receiver coil elements.

available_channels: Tensor

Number of available receiver coil elements.

center_sample: Tensor

Index of the readout sample corresponding to k-space center (zero indexed).

channel_mask: Tensor

Bit mask indicating active coils (64*16 = 1024 bits).

clone() Self

Return a deep copy of the object.

cpu(*, memory_format: memory_format = torch.preserve_format, copy: bool = False) Self

Put in CPU memory.

Parameters:
  • memory_format – The desired memory format of returned tensor.

  • copy – If True, the returned tensor will always be a copy, even if the input was already on the correct device. This will also create new tensors for views

cuda(device: device | str | int | None = None, *, non_blocking: bool = False, memory_format: memory_format = torch.preserve_format, copy: bool = False) Self

Put object in CUDA memory.

Parameters:
  • device – The destination GPU device. Defaults to the current CUDA device.

  • non_blocking – If True and the source is in pinned memory, the copy will be asynchronous with respect to the host. Otherwise, the argument has no effect.

  • memory_format – The desired memory format of returned tensor.

  • copy – If True, the returned tensor will always be a copy, even if the input was already on the correct device. This will also create new tensors for views

property device: device | None

Return the device of the tensors.

Looks at each field of a dataclass implementing a device attribute, such as torch.Tensors or MoveDataMixin instances. If the devices of the fields differ, an InconsistentDeviceError is raised, otherwise the device is returned. If no field implements a device attribute, None is returned.

Raises:

InconsistentDeviceError: – If the devices of different fields differ.

Return type:

The device of the fields or None if no field implements a device attribute.

discard_post: Tensor

Number of readout samples to be discarded at the end (e.g. if the ADC is active during gradient events).

discard_pre: Tensor

Number of readout samples to be discarded at the beginning (e.g. if the ADC is active during gradient events)

double(*, memory_format: memory_format = torch.preserve_format, copy: bool = False) Self

Convert all float tensors to double precision.

converts float to float64 and complex to complex128

Parameters:
  • memory_format – The desired memory format of returned tensor.

  • copy – If True, the returned tensor will always be a copy, even if the input was already on the correct device. This will also create new tensors for views

encoding_space_ref: Tensor

Indexed reference to the encoding spaces enumerated in the MRD (xml) header.

flags: Tensor

A bit mask of common attributes applicable to individual acquisition readouts.

classmethod from_ismrmrd_acquisitions(acquisitions: Sequence[Acquisition]) Self[source]

Read the header of a list of acquisition and store information.

Parameters:

acquisitions – list of ismrmrd acquisistions to read from. Needs at least one acquisition.

half(*, memory_format: memory_format = torch.preserve_format, copy: bool = False) Self

Convert all float tensors to half precision.

converts float to float16 and complex to complex32

Parameters:
  • memory_format – The desired memory format of returned tensor.

  • copy – If True, the returned tensor will always be a copy, even if the input was already on the correct device. This will also create new tensors for views

idx: AcqIdx

Indices describing acquisitions (i.e. readouts).

property is_cpu: bool

Return True if all tensors are on the CPU.

Checks all tensor attributes of the dataclass for their device, (recursively if an attribute is a MoveDataMixin)

Returns False if not all tensors are on cpu or if the device is inconsistent, returns True if the data class has no tensors as attributes.

property is_cuda: bool

Return True if all tensors are on a single CUDA device.

Checks all tensor attributes of the dataclass for their device, (recursively if an attribute is a MoveDataMixin)

Returns False if not all tensors are on the same CUDA devices, or if the device is inconsistent, returns True if the data class has no tensors as attributes.

measurement_uid: Tensor

Unique ID corresponding to the readout.

number_of_samples: Tensor

Number of sample points per readout (readouts may have different number of sample points).

patient_table_position: SpatialDimension[Tensor]

Offset position of the patient table, in LPS coordinates [m].

phase_dir: SpatialDimension[Tensor]

Directional cosine of phase encoding (2D).

physiology_time_stamp: Tensor

Time stamps relative to physiological triggering, e.g. ECG. Not in s but in vendor-specific time units

position: SpatialDimension[Tensor]

Center of the excited volume, in LPS coordinates relative to isocenter [m].

read_dir: SpatialDimension[Tensor]

Directional cosine of readout/frequency encoding.

sample_time_us: Tensor

Readout bandwidth, as time between samples [us].

scan_counter: Tensor

Zero-indexed incrementing counter for readouts.

single(*, memory_format: memory_format = torch.preserve_format, copy: bool = False) Self

Convert all float tensors to single precision.

converts float to float32 and complex to complex64

Parameters:
  • memory_format – The desired memory format of returned tensor.

  • copy – If True, the returned tensor will always be a copy, even if the input was already on the correct device. This will also create new tensors for views

slice_dir: SpatialDimension[Tensor]

Directional cosine of slice normal, i.e. cross-product of read_dir and phase_dir.

to(*args, **kwargs) Self

Perform dtype and/or device conversion of data.

A torch.dtype and torch.device are inferred from the arguments args and kwargs. Please have a look at the documentation of torch.Tensor.to() for more details.

A new instance of the dataclass will be returned.

The conversion will be applied to all Tensor- or Module fields of the dataclass, and to all fields that implement the MoveDataMixin.

The dtype-type, i.e. float or complex will always be preserved, but the precision of floating point dtypes might be changed.

Example: If called with dtype=torch.float32 OR dtype=torch.complex64:

  • A complex128 tensor will be converted to complex64

  • A float64 tensor will be converted to float32

  • A bool tensor will remain bool

  • An int64 tensor will remain int64

If other conversions are desired, please use the torch.Tensor.to() method of the fields directly.

If the copy argument is set to True (default), a deep copy will be returned even if no conversion is necessary. If two fields are views of the same data before, in the result they will be independent copies if copy is set to True or a conversion is necessary. If set to False, some Tensors might be shared between the original and the new object.

trajectory_dimensions: Tensor

Dimensionality of the k-space trajectory vector.

user_float: Tensor

User-defined float parameters.

user_int: Tensor

User-defined int parameters.

version: Tensor

Major version number.