SPGRModel#
- class torchsim.models.SPGRModel(diff=None, chunk_size=None, device=None, *args, **kwargs)[source]#
Bases:
AbstractModel
SPGR transverse signal at time TE after excitation.
This class models the transverse magnetization signal generated by the spoiled gradient echo (SPGR) sequence, calculated at echo time (TE) following RF excitation.
- set_properties(T1, T2star, M0=1.0, B0=0.0, chemshift=0.0):
Set tissue and system-specific properties for the SPGR model.
- set_sequence(flip, TR, TE):
Set sequence parameters including flip angle, repetition time (TR), and echo time (TE).
- _engine(T1, T2star, TR, TE, flip, M0=1.0, field_map=0.0, delta_cs=0.0):
Compute the SPGR signal for given tissue, sequence, and field parameters.
Examples
from torchsim.models import SPGRModel model = SPGRModel() model.set_properties(T1=1000, T2star=30) model.set_sequence(flip=13.0, TR=10.0, TE=5.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 SPGR model.
Set sequence parameters for the SPGR model.
- set_properties(T1, T2star, M0=1.0, B0=0.0, chemshift=0.0)[source]#
Set tissue and system-specific properties for the SPGR model.
- Parameters:
T1 (float | npt.ArrayLike) – Longitudinal relaxation time in milliseconds.
T2star (float | npt.ArrayLike) – Effective transverse relaxation time in milliseconds.
M0 (float | npt.ArrayLike, optional) – Proton density scaling factor, default is
1.0
.B0 (float | npt.ArrayLike, optional) – Frequency offset map in Hz, default is
0.0.
chemshift (float | npt.ArrayLik, optional) – Chemical shift in Hz, default is
0.0
.
- static _engine(T1, T2star, TR, TE, flip, M0=1.0, B0=0.0, chemshift=0.0)[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])
T2star (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
TR (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
TE (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])
M0 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
B0 (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])
chemshift (float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])