OMatrix#

Import: cmrseq.OMatrix

class OMatrix(position, slice_normal, readout_direction, system_specs)[source]#

Bases: object

Captures the transformation of a slice coordinate system (Readout, Phase encoding, Slice Normal) to XYZ scanner coordinates.

When applied to Gradient and corresponding RFPulse objects, a transformed definition of the waveforms is returned.

Raises:

BuildingBlockArgumentError if slice_normal and readout_direction are not orthogonal

Parameters:
  • position (Quantity) – Scalar length value for a positional offset along the slice-normal direction

  • slice_normal (ndarray) – (3, ) 3D vector containing the slice normal

  • readout_direction (ndarray) – (3, ) 3D vector containing the readout direction

  • system_specs (SystemSpec) –

Methods:

apply(block)

Applies the spatial transformation from Slice-coordinates to XYZ-coordinates to the specified block.

update([position, slice_normal, ...])

Updates all specified properties of the OMatrix.

Attributes:

pos_offset

Scalar positional offset in 3D

readout_direction

Return read-only view of the readout direction

slice_normal

Return read-only view of the slice-normal

tmatrix

Returns the (4x4) transformation matrix

apply(block)[source]#

Applies the spatial transformation from Slice-coordinates to XYZ-coordinates to the specified block.

For a Gradient block this means a rotation of the vector defined as the gradient channels [gx, gy, gz], where the total gradient area on all channels is preserved. The returned values are the time-points (t, ) and transformed gradient-waveform (3, t).

For a RFPulse the application of the OMatrix only makes sense in presence of a corresponding Trapezoidal gradient defining the slice-selective excitation. If given a tuple containing (RFPulse, TrapezoidalGradient), the frequency-modulated RF waveform is returned as time-points (t, ) and complex-wf (t, ).

Parameters:

block (Union[Gradient, Tuple[RFPulse, TrapezoidalGradient]]) – Either an instance of a Gradient, or a tuple containing an RFPulse as well as a corresponding TrapezoidalGradient object defining the slice-selective excitation

Return type:

Tuple[Quantity, Quantity]

update(position=None, slice_normal=None, readout_direction=None)[source]#

Updates all specified properties of the OMatrix.

Parameters:
  • position (Optional[Quantity]) – Scalar length value for a positional offset along the slice-normal direction

  • slice_normal (Optional[ndarray]) – (3, ) 3D vector containing the slice normal

  • readout_direction (Optional[ndarray]) – (3, ) 3D vector containing the readout direction

Return type:

None

Returns:

property pos_offset#

Scalar positional offset in 3D

property readout_direction#

Return read-only view of the readout direction

property slice_normal#

Return read-only view of the slice-normal

property tmatrix#

Returns the (4x4) transformation matrix