This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Create head phantom image


P = phantom(def, n)
P = phantom(E, n)
[P, E] = phantom(...)


P = phantom(def, n) generates an image of a head phantom that can be used to test the numerical accuracy of radon and iradon or other two-dimensional reconstruction algorithms. P is a grayscale intensity image that consists of one large ellipse (representing the brain) containing several smaller ellipses (representing features in the brain).

def specifies the type of head phantom to generate. Valid values are

  • 'Shepp-Logan' — Test image used widely by researchers in tomography

  • 'Modified Shepp-Logan' (default) — Variant of the Shepp-Logan phantom in which the contrast is improved for better visual perception

n is a scalar that specifies the number of rows and columns in P. If you omit the argument, n defaults to 256.

P = phantom(E, n) generates a user-defined phantom, where each row of the matrix E specifies an ellipse in the image. E has six columns, with each column containing a different parameter for the ellipses. This table describes the columns of the matrix.




Column 1


Additive intensity value of the ellipse

Column 2


Length of the horizontal semiaxis of the ellipse

Column 3


Length of the vertical semiaxis of the ellipse

Column 4


x-coordinate of the center of the ellipse

Column 5


y-coordinate of the center of the ellipse

Column 6


Angle (in degrees) between the horizontal semiaxis of the ellipse and the x-axis of the image

For purposes of generating the phantom, the domains for the x- and y-axes span [-1,1]. Columns 2 through 5 must be specified in terms of this range.

[P, E] = phantom(...) returns the matrix E used to generate the phantom.

Class Support

All inputs and all outputs must be of class double.


collapse all

Create the modified Shepp-Logan head phantom image and display it.

P = phantom('Modified Shepp-Logan',200);


For any given pixel in the output image, the pixel's value is equal to the sum of the additive intensity values of all ellipses that the pixel is a part of. If a pixel is not part of any ellipse, its value is 0.

The additive intensity value A for an ellipse can be positive or negative; if it is negative, the ellipse will be darker than the surrounding pixels. Note that, depending on the values of A, some pixels can have values outside the range [0,1].


[1] Jain, Anil K., Fundamentals of Digital Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1989, p. 439.

See Also


Introduced before R2006a

Was this topic helpful?