TrueFISPSimulator

TrueFISPSimulator#

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

Bases: Simulator

A balanced SSFP train from equilibrium, optionally inverted first.

The pulses alternate in phase and each sample is demodulated by the phase of its own pulse. An alpha/2 pulse of opposite phase, played before the train, damps the oscillation of the approach to the steady state [1]; after an inversion, the train is the inversion-recovery TrueFISP whose recovery curve carries T1, T2 and the proton density together [2]. Every pulse is a windowed sinc played sample by sample, so the magnetization relaxes, precesses off resonance and exchanges between pools while it plays, unless pulse_duration is zero and each is an instantaneous rotation. This is the sequence BART’s sim plays as BSSFP and IR-BSSFP, and with instantaneous pulses the one its epg plays as bSSFP.

References

Examples

from torchsim.simulators import TrueFISPSimulator

sequence = TrueFISPSimulator(
    flip=45.0, TR=4.5, nshots=200, inversion="adiabatic"
)
signal = sequence.simulate(T1=1000.0, T2=100.0)
print(signal.shape)
torch.Size([200])

Methods

bind

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

describe

Return the description this protocol plays.

evaluate

Run one simulation of the described protocol.

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 train, one sample per shot.

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.

layout(*, flip, TR, nshots, TE=None, pulse_duration=1.0, bandwidth_time=4.0, half_alpha=True, preparation=None, inversion=None, inversion_duration=10.0, inversion_phase=0.0, spoiler=0.0, dwell=0.01)[source]#

Return the train, one sample per shot.

Parameters:
  • flip (float or array-like) – Flip angle in degrees, scalar or one per shot.

  • TR (float) – Repetition time in milliseconds, pulse centre to pulse centre.

  • nshots (int) – Excitations in the train.

  • TE (float, optional) – Echo time in milliseconds, from the centre of the pulse; half the repetition time when not given, where a balanced train refocuses.

  • pulse_duration (float, optional) – Duration of each pulse in milliseconds. Zero plays each as an instantaneous rotation.

  • bandwidth_time (float, optional) – Zero crossings of the Hamming-windowed sinc across the pulse.

  • half_alpha (bool, optional) – Whether an alpha/2 pulse prepares the train.

  • preparation (float, optional) – Time in milliseconds from the start of the alpha/2 pulse to the start of the train’s first pulse, half the repetition time when not given. Zero is an instantaneous alpha/2 rotation at the start of the train.

  • inversion ({None, "ideal", "adiabatic"}, optional) – What comes before the preparation: nothing, an instantaneous inversion scaled by inv_efficiency, or a hyperbolic secant played sample by sample.

  • inversion_duration (float, optional) – Duration of the adiabatic inversion in milliseconds.

  • inversion_phase (float, optional) – Phase of the adiabatic inversion in degrees, relative to the train’s first pulse, which decides where the transverse magnetization the inversion leaves points.

  • spoiler (float, optional) – Time in milliseconds between the inversion and the preparation, at the end of which the transverse magnetization is spoiled.

  • dwell (float, optional) – How long each sample of a pulse is held, in milliseconds.

Raises:

ValueError – If the sample falls inside the pulse or after the next one, if the preparation is shorter than its pulse, if flip is neither scalar nor one per shot, or if a pulse is not a whole number of samples.