MockDataLab
Medicine & ImagingRadiology / TMI-style referenceseed 4

Synthetic Shepp-Logan phantom

A 128 by 128 modified Shepp–Logan phantom is projected at 180 parallel-beam angles, noised at 2 percent of the sinogram RMS, and rebuilt with a Shepp–Logan filtered back projection. The pictures are mathematical. They are not a scan of a person.

Projection geometry

θ_k = k π / N, N = 180; detector t = x cos θ + y sin θ; filter |f| sinc(f/2)

Static snapshotCSV (seed 4) ↓

Phantom

Modified Shepp–Logan

Phantom synthetic CT figure

Sinogram

Radon transform, angle by detector

Sinogram synthetic CT figure

Reconstruction

Filtered back projection

Reconstruction synthetic CT figure

What this page generates

The modified Shepp–Logan phantom is ten ellipses on the unit square. Each ellipse has a signed density, two semi-axes, a center, and a rotation in degrees. A pixel’s value is the sum of the densities of the ellipses that cover it. The outer ellipse is the bright rim. A large negative ellipse cuts the interior down. Smaller ellipses add the dark lobes and the three tiny features near the bottom. Corners of the square sit outside every ellipse, so they stay 0. The center is covered by the outer ellipse and the large negative one, so it lands near 0.2.

The Radon transform here is a parallel-beam sum. For each angle θ = k π / 180, the image is sampled along lines perpendicular to a detector axis and added up with bilinear interpolation. The sinogram has one row per angle and one column per detector. A point off center traces a sine-shaped path through that image, which is why the picture is called a sinogram. Nothing in that sum is an X-ray measurement. The ellipse formula is the whole object.

Filtered back projection undoes the blur of plain back projection. Each projection is zero-padded, transformed, multiplied by a ramp times a sinc window (the Shepp–Logan filter), and transformed back. The filtered rows are smeared across the image and scaled by π over the number of angles. Two percent RMS Gaussian noise is added to the sinogram before that step, using seed 4. The reconstruction should resemble the phantom inside the circular field and look streakier outside it. The PNG files and the arrays are labeled synthetic. MockDataLab does not accept DICOM or any other patient upload.

Windowing for the on-screen phantom is fixed from 0 to 1. The sinogram and the reconstruction are stretched between their 1st and 99th percentiles so a few extreme bins do not paint the whole image white. The numeric arrays are not stretched. If you download the npz, you get the floats the algorithm produced, plus metadata.json repeating the banner and the seed.

Generating rule

Projection geometry

θ_k = k π / N, N = 180; detector t = x cos θ + y sin θ; filter |f| sinc(f/2)

Check values

Worked numbers

The modified ellipse sum on this 128 grid is 0 in the corner and 0.200 near the middle. One hundred eighty angles and a 0.02 RMS noise fraction, seed 4, are what the Shepp–Logan PNG pair was drawn from.

Parameters and defaults

Parameters, defaults, and what they change
ParameterDefaultRangeEffect
size12832 to 160Pixels on each side of the phantom and the reconstruction.
angles18012 to 360Parallel-beam views, evenly spaced on [0, π).
filterShepp–LoganRam–Lak, Shepp–Logan, cosineWindow on the ramp. Shepp–Logan softens the highest frequencies.
noise fraction0.020 to 1Gaussian std as a fraction of sinogram RMS.
seed4unsigned 32-bitRepeats the sinogram noise. The ellipses do not use the seed.

Python for this seed

Full script with mulberry32() & box_muller() available via Copy Python above

reproduce_seed_4.pyseed 4
# SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com)
SIZE = 128
ANGLES = 180
FILTER = "shepp-logan"
NOISE_FRACTION = 0.02
SEED = 4
phantom = shepp_logan(SIZE)
clean = radon(phantom, ANGLES)
# box_muller noise and fbp() are in the copied script

Exercises

  • EXERCISE 01Lecture figure for “what a sinogram is” without a scanner or a patient.
  • EXERCISE 02Regression test for a Radon or FBP implementation, compared with these PNGs.
  • EXERCISE 03Show students the difference between the ellipse image and the filtered reconstruction.

Questions

Is this the original Shepp–Logan or the modified one?

Modified. The large interior contrast is higher than in the 1974 original, which is the version most teaching codes draw.

Why is the rim so bright?

The outer ellipse density is 1 and nothing brighter is added on top of it. Interior ellipses mostly subtract.

Can I load a real CT slice here?

No. The bench draws ellipses only. Do not paste voxel values from a scan.

What does the banner on the PNG say?

SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com), plus the seed, both in the image footer and in a text chunk.

Related

SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com). Do not present the download as a real measurement.