FSEModel#

class torchsim.models.FSEModel(diff=None, chunk_size=None, device=None, *args, **kwargs)[source]#

Bases: AbstractModel

Fast Spin Echo (FSE) Model.

This class models fast spin echo (FSE) signals based on tissue properties, pulse sequence parameters, and experimental conditions. It uses Extended Phase Graph (EPG) formalism to compute the magnetization evolution over time.

Parameters:
  • diff (str | tuple[str] | None)

  • chunk_size (int | None)

  • device (str | device | None)

set_properties(T1, T2, M0=1.0, B1=1.0)[source]#

Sets tissue relaxation properties and experimental conditions.

Parameters:
set_sequence(flip, ESP, phases=0.0, TR=1e6, exc_flip=90.0, exc_phase=90.0,

slice_prof=1.0, nstates=10)

Configures the pulse sequence parameters for the simulation.

_engine(T1, T2, flip, ESP, phases, TR=1e6, exc_flip=90.0, exc_phase=90.0,

M0=1.0, B1=1.0, slice_prof=1.0, nstates=10)

Computes the FSE signal for given tissue properties and sequence parameters.

Examples

import torch
from torchsim.models import FSEModel

model = FSEModel()
model.set_properties(T1=1000, T2=80, M0=1.0, B1=1.0)
model.set_sequence(flip=180.0 * torch.ones(128), ESP=2.0, TR=5000.0)
signal = model()

Methods

__init__

Initialize the model with automatic parameter segregation and engine setup.

forward

Get forward method.

jacobian

Get Jacobian method.

set_properties

Set tissue and system-specific properties for the MRF model.

set_sequence

Set sequence parameters for the SPGR model.

set_properties(T1, T2, M0=1.0, B1=1.0)[source]#

Set tissue and system-specific properties for the MRF model.

Parameters:
  • T1 (float | npt.ArrayLike) – Longitudinal relaxation time in milliseconds.

  • T2 (float | npt.ArrayLike) – Transverse relaxation time in milliseconds.

  • M0 (float or array-like, optional) – Proton density scaling factor, default is 1.0.

  • B1 (float | npt.ArrayLike, optional) – Flip angle scaling map, default is 1.0.

set_sequence(flip, ESP, phases=0.0, TR=1000000.0, exc_flip=90.0, exc_phase=90.0, slice_prof=1.0, nstates=10)[source]#

Set sequence parameters for the SPGR model.

Parameters:
  • flip (float | npt.ArrayLike) – Refocusing flip angle train in degrees.

  • ESP (float) – Echo spacing in milliseconds.

  • phases (float | npt.ArrayLike, optional) – Refocusing flip angle phases in degrees. The default is 90.0.

  • TR (float | npt.ArrayLike, optional) – Repetition time in milliseconds. The default is 1e6.

  • exc_flip (float, optional) – Excitation flip angle train in degrees. The default is 90.0.

  • exc_phase (float, optional) – Excitation flip angle phase in degrees. The default is 90.0.

  • slice_prof (float | npt.ArrayLike, optional) – Flip angle scaling along slice profile. The default is 1.0.

  • nstates (int, optional) – Number of EPG states to be retained. The default is 10.

static _engine(T1, T2, flip, ESP, phases=0.0, exc_flip=90.0, exc_phase=90.0, TR=1000000.0, M0=1.0, B1=1.0, slice_prof=1.0, nstates=10)[source]#

Core computational function for the model.

Parameters: