toupy.simulation package¶
Submodules¶
toupy.simulation.phantom_creator module¶
Module to create the Shepp-Logan phantom for simulation Forked from https://jenda.hrach.eu/f2/cat-py/phantom.py
- toupy.simulation.phantom_creator.phantom(N=256, phantom_type='Modified Shepp-Logan', ellipses=None)[source]¶
Create a Shepp-Logan 1 or modified Shepp-Logan phantom 2 . A phantom is a known object (either real or purely mathematical) that is used for testing image reconstruction algorithms. The Shepp-Logan phantom is a popular mathematical model of a cranial slice, made up of a set of ellipses. This allows rigorous testing of computed tomography (CT) algorithms as it can be analytically transformed with the radon transform.
- Parameters
N (int) – The edge length of the square image to be produced
phantom_type (str, optional) – The type of phantom to produce. Either
Modified Shepp-Logan
orShepp-Logan
. The default value isModified Shepp-Logan
. This is overriden ifellipses
is also specified.ellipses (array like) – Custom set of ellipses to use.
Note
To use ellipses, these should be in the form
[[I, a, b, x0, y0, phi], [I, a, b, x0, y0, phi], ...]
where each row defines an ellipse and:I
: Additive intensity of the ellipse.a
: Length of the major axis.b
: Length of the minor axis.x0
: Horizontal offset of the centre of the ellipse.y0
: Vertical offset of the centre of the ellipse.phi
: Counterclockwise rotation of the ellipse in degrees, measured as the angle between the horizontal axis and the ellipse major axis.
The image bouding box in the algorithm is
[-1, -1], [1, 1]
, so the values ofa
,b
,x0
andy0
should all be specified with respect to this box.- Returns
P – A 2-dimensional array containing th Shepp-Logan phantom image.
- Return type
ndarray
Examples
>>> import matplotlib.pyplot as plt >>> P = phantom() >>> # P = phantom(256, 'Modified Shepp-Logan', None) >>> plt.imshow(P)
References
- 1
Shepp, L. A., Logan, B. F., “Reconstructing Interior Head Tissue from X-Ray Transmission”, IEEE Transactions on Nuclear Science, Feb. 1974, p. 232
- 2
Toft, P., “The Radon Transform - Theory and Implementation”, Ph.D. thesis, Department of Mathematical Modelling, Technical University of Denmark, June 1996