bloch

Numerical bloch simulations using finite difference method.

mr_utils.sim.bloch.bloch.gre(T1, T2, M0, Nt, h, alpha, beta, gamma, TR, TE, Bx=0, By=0, Bz=3)[source]

Finite difference Bloch simulation of spoiled GRE pulse sequence.

T1 : array_like
longitudinal relaxation constant.
T2 : array_like
transverse relaxation constant.
M0 : array_like
value at thermal equilibrium.
Nt : int
number of time points for finite difference solution.
h : float
step size for finite difference solutions.
alpha : float
RF pulse tip angle about x.
beta : float
RF pulse tip angle about y.
gamma : float
RF pulse tip angle about z.
TR : float
repetition time.
TE : float
echo time.
Bx : float, optional
x component of magnetic field.
By : float, optional
y component of magnetic field.
Bz : float, optional
z component of magnetic field.
Returns:spins – Simulated spin vectors.
Return type:array_like

Notes

T1, T2, M0 can be arrays (must be same size) to simulate phantoms.

mr_utils.sim.bloch.bloch.rotation(alpha, beta, gamma)[source]

Create 3D rotation matrix from alpha,beta,gamma.

Parameters:
  • alpha (float) – Rotation angle about x in rad.
  • beta (float) – Rotation angle about y in rad.
  • gamma (float) – Rotation angle about z in rad.
Returns:

rot – Rotation matrix.

Return type:

array_like

mr_utils.sim.bloch.bloch.sim(T1, T2, M0, Nt, h, alpha, beta, gamma, Bx=0, By=0, Bz=3)[source]

Finite difference solution to Bloch equations.

T1 : array_like
longitudinal relaxation constant.
T2 : array_like
transverse relaxation constant.
M0 : array_like
value at thermal equilibrium.
Nt : int
number of time points for finite difference solution.
h : float
step size for finite difference solutions.
alpha : float
RF pulse tip angle about x.
beta : float
RF pulse tip angle about y.
gamma : float
RF pulse tip angle about z.
Bx : float, optional
x component of magnetic field.
By : float, optional
y component of magnetic field.
Bz : float, optional
z component of magnetic field.
Returns:spins – Simulated spin vectors.
Return type:array_like

Notes

T1, T2, M0 can be arrays (must be same size) to simulate phantoms.

See [1] for matrix form of Bloch equations.

References

[1]https://en.wikipedia.org/wiki/Bloch_equations#Matrix_form_of_Bloch_equations
mr_utils.sim.bloch.bloch.sim_loop(T1, T2, M0, Nt, h, alpha, beta, gamma, Bx=0, By=0, Bz=3)[source]

Loop implementation to verify matrix implementation.

T1 : array_like
longitudinal relaxation constant.
T2 : array_like
transverse relaxation constant.
M0 : array_like
value at thermal equilibrium.
Nt : int
number of time points for finite difference solution.
h : float
step size for finite difference solutions.
alpha : float
RF pulse tip angle about x.
beta : float
RF pulse tip angle about y.
gamma : float
RF pulse tip angle about z.
Bx : float, optional
x component of magnetic field.
By : float, optional
y component of magnetic field.
Bz : float, optional
z component of magnetic field.
Returns:spins – Simulated spin vectors.
Return type:array_like