MP2RAGESimulator#

class torchsim.simulators.MP2RAGESimulator(*args, **kwargs)[source]#

Bases: Simulator

Two gradient-echo blocks read at two inversion times, in closed form.

The train is spoiled and sampled at the k-space centre of each block, so only the longitudinal magnetization carries between shots and the steady state it settles into has a closed form. Combining the two blocks into one ratio gives an image free of the receive bias field, which is what the sequence is for [1].

References

Examples

from torchsim.simulators import MP2RAGESimulator

sequence = MP2RAGESimulator(
    TI=(500.0, 1500.0),
    flip=5.0,
    TRspgr=5.0,
    TRmp2rage=3000.0,
    nshots=128,
)
signal = sequence.simulate(T1=(200.0, 1000.0), inv_efficiency=0.95)

Methods

bind

This simulator with more fixed on it, values or settings alike.

describe

Return the description this protocol plays.

evaluate

Evaluate the closed form, no state machine and no description.

from_description

Return a simulator over a stream someone else assembled.

from_pulseq

Return a simulator over one repetition of a Pulseq sequence.

jacobian

Return the signal and its derivative with respect to diff.

layout

Return the whole train: one inversion, then two blocks of readouts.

played

Return the protocol as it will be laid out.

repetition_s

Return how long one repetition lasts, given what the layout played.

simulate

Return the recorded signal.

evaluate(properties, **sequence)[source]#

Evaluate the closed form, no state machine and no description.

layout(*, TI, flip, TRspgr, TRmp2rage, nshots, phases=0.0)[source]#

Return the whole train: one inversion, then two blocks of readouts.

The closed form of evaluate() is what a lookup table is built from, because it costs one expression per T1. This is the same sequence written out event by event, which is what a description arriving from a scanner is compared against and what carries a train the closed form has no parameter for.

Parameters:
  • TI (array-like) – The two inversion times in milliseconds, each measured to the sampled shot of its block.

  • flip (float or array-like) – Excitation flip angle in degrees, one per block or one shared.

  • TRspgr (float or array-like) – Repetition time in milliseconds of one readout.

  • TRmp2rage (float or array-like) – Repetition time in milliseconds of the whole inversion block.

  • nshots (int or array-like) – Readouts per block, either the total – halved for each block – or (before, after) the sampled shot.

  • phases (float or array-like, optional) – Excitation phases in degrees, one per block or one shared.

Raises:

ValueError – If either inversion time falls before its block’s first excitation, or if the second block does not fit inside the repetition time.