phantom¶
Simulate shepp logan phantoms.
To Generate phantoms. You can call the following functions with the desired phantom shape as input:
- modified_shepp_logan
- shepp_logan
- yu_ye_wang
You can generate a custom phantom by specifying a list of ellipsoid parameters by calling the phantom function. Ellipsoid parameters are as follows:
- A : value inside the ellipsoid
- a, b, c : axis length of the ellipsoid (in % of the cube shape)
- x0, y0, z0 : position of the center (in % of the cube shape)
- phi, theta, psi : Euler angles defining the orientation (in degrees)
Alternatively, you can generate only one ellipsoid by calling the ellipsoid function.
Examples
To generate a phantom cube of size 32 * 32 * 32:
>>> from siddon.phantom import *
>>> my_phantom = shepp_logan((32, 32, 32))
>>> assert my_phantom[16, 16, 16] == -0.8
Notes
You can take a look at those links for explanations: http://en.wikipedia.org/wiki/Imaging_phantom http://en.wikipedia.org/wiki/Ellipsoid http://en.wikipedia.org/wiki/Euler_angles This module is largely inspired by : http://www.mathworks.com/matlabcentral/fileexchange/9416-3d-shepp-logan-phantom
Original Author: Nicolas Barbey
-
mr_utils.test_data.phantom.phantom.
phantom
(shape, parameters_list, dtype=<class 'numpy.float64'>)[source]¶ Generate a cube of given shape using a list of ellipsoid parameters.
Parameters: - shape (tuple of ints) – Shape of the output cube.
- parameters_list (list of dictionaries) – List of dictionaries with the parameters defining the ellipsoids to include in the cube.
- dtype (data-type, optional) – Data type of the output ndarray.
Returns: cube – A 3-dimensional ndarray filled with the specified ellipsoids.
Return type: ndarray
See also
shepp_logan()
- Generates the Shepp Logan phantom in any shape.
modified_shepp_logan()
- Modified Shepp Logan phantom in any shape.
yu_ye_wang()
- The Yu Ye Wang phantom in any shape.
ellipsoid()
- Generates a cube filled with an ellipsoid of any shape.
Notes
-
mr_utils.test_data.phantom.phantom.
shepp_logan
(shape, **kargs)[source]¶ Generates a Shepp-Logan phantom with a given shape and dtype
Parameters: - shape (3-tuple of ints) – Shape of the 3d output cube.
- dtype (data-type) – Data type of the output cube.
Returns: cube – 3-dimensional phantom.
Return type: ndarray
-
mr_utils.test_data.phantom.phantom.
modified_shepp_logan
(shape, **kargs)[source]¶ Generates a Modified Shepp-Logan phantom with a given shape and dtype
Parameters: - shape (3-tuple of ints) – Shape of the 3d output cube.
- dtype (data-type) – Data type of the output cube.
Returns: cube – 3-dimensional phantom.
Return type: ndarray
-
mr_utils.test_data.phantom.phantom.
yu_ye_wang
(shape, **kargs)[source]¶ Generates a Yu Ye Wang phantom with a given shape and dtype
Parameters: - shape (3-tuple of ints) – Shape of the 3d output cube.
- dtype (data-type) – Data type of the output cube.
Returns: cube – 3-dimensional phantom.
Return type: ndarray
-
mr_utils.test_data.phantom.phantom.
ellipsoid
(parameters, shape=None, out=None, coordinates=None)[source]¶ Generates a cube filled with an ellipsoid of any shape.
Parameters: - parameters (list of dictionaries) – List of dictionaries with the parameters defining the ellipsoids to include in the cube.
- shape (tuple of ints, optional) – Shape of the output cube.
- out (array_like) – If None, initialized to all zeros.
- coordinates (list) – List of coordinates
Returns: out – The ellipsoid.
Return type: array_like
Notes
If out is given, fills the given cube instead of creating a new one.