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.
- set_properties(T1, T2, M0=1.0, B1=1.0)[source]#
Sets tissue relaxation properties and experimental conditions.
- Parameters:
T1 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
T2 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
M0 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
B1 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
- 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 tissue and system-specific properties for the MRF model.
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:
T1 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
T2 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
flip (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
ESP (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
phases (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
exc_flip (float)
exc_phase (float)
TR (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
M0 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
B1 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
slice_prof (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
nstates (int)