snake.core.phantom.shepp_logan
#
Shepp-Logan phantom generation.
Module Contents#
Functions#
Generate a Shepp-Logan phantom with MR tissue parameters. |
|
Return parameters of ellipsoids. |
|
Return MR relaxation parameters for certain tissues. |
|
Return array of index who fit in the ellipsoid. |
API#
- snake.core.phantom.shepp_logan.mr_shepp_logan(N: int | tuple[int, int, int], E: numpy.ndarray | None = None, B0: float = 3, zlims: tuple[float, float] = (-1, 1)) tuple[numpy.typing.NDArray, ...] [source]#
Generate a Shepp-Logan phantom with MR tissue parameters.
- Parameters:
N (int or array_like) β Matrix size, (N, N, N), or (L, M, N).
E (array_like, optional) β
ex13 numeric matrix defining e ellipses. The columns of E are:
x-coordinate of the center of the ellipsoid (in [-1, 1])
y-coordinate of the center of the ellipsoid (in [-1, 1])
z-coordinate of the center of the ellipsoid (in [-1, 1])
x principal axis of the ellipsoid
y principal axis of the ellipsoid
z principal axis of the ellipsoid
Angle of the ellipsoid (in rad)
spin density, M0
Parameter A for T1 determination
Parameter C for T1 determination
Explicit T1 value (in sec, or np.nan if model is used)
T2 value (in sec)
chi (change in magnetic susceptibility)
If spin density is negative, M0, T1, and T2 will be subtracted instead of cummulatively added.
B0 (float, optimal) β Field strength (in Tesla).
zlims (tuple, optional) β Only for 3D. Specify bounds along z. Often we only want the middle portion of a 3D phantom, e.g., zlim=(-.5, .5).
- Returns:
M0 (array_like) β The proton density.
T1 (array_like) β The T1 values.
T2 (array_like) β The T2 values.
T2star (array_like) β The T2 star values. The T2star values are calculated using magnetic susceptibility and T2.
labels (array_like) β An integer-labelled partition of the phantom.
Notes
Implements the phantoms described in [1]_.
If parameters A, C are given and T1 is None, T1 is determined according to the equation:
T1 = A*B0^C
The original source code [2]_
References
- snake.core.phantom.shepp_logan.mr_ellipsoid_parameters() numpy.ndarray [source]#
Return parameters of ellipsoids.
- Returns:
E β Parameters for the ellipsoids used to construct the phantom.
- Return type:
array_like
- snake.core.phantom.shepp_logan._mr_relaxation_parameters() dict [source]#
Return MR relaxation parameters for certain tissues.
- Returns:
params β Gives entries as [A, C, (t1), t2, chi]
- Return type:
Notes
If t1 is None, the model T1 = A*B0^C will be used. If t1 is not np.nan, then specified t1 will be used.
- snake.core.phantom.shepp_logan.idx_in_ellipse(E: numpy.ndarray, shape: tuple[int, int, int]) numpy.ndarray [source]#
Return array of index who fit in the ellipsoid.
- Parameters:
E (np.array) β 1d array defining the coordinate and size of the ellipsoid.
shape (tuple) β shape of the complete volume.
- Returns:
A boolean mask of index which are in the ellipse.
- Return type:
np.ndarray