https://github.com/JuliaImageRecon/ImagePhantoms.jl
This Julia language repo provides tools for working with software-defined image phantoms like the Shepp-Logan phantom (both 2D and 3D versions).
For each phantom shape,
methods are available for computing samples of
its image
(using phantom
),
its Radon transform (2D) or X-ray line integrals (3D),
(using radon
),
and its 2D or 3D Fourier transform
(using spectrum
).
For explanations and examples see the documentation using the blue "docs" links above.
using Pkg
Pkg.add("ImagePhantoms")
using ImagePhantoms
image = shepp_logan(256)
p = shepp_logan(SheppLoganToft())
sinogram = radon(range(-1,1,101), deg2rad.(0:180), p) # 101 × 181
using ImagePhantoms
using MIRTjim: jim
using Plots # @animate, gif
function disk_phantom(title::String)
(dx,dy) = (1, 1)
(M,N) = (2^8,2^8)
x = (-M÷2:M÷2-1) * dx
y = (-N÷2:N÷2-1) * dy
params = disk_phantom_params( ; rhead = () -> rand(100:105))
objects = ellipse(params) # vector of Object2d{Ellipse}
img = phantom(x, y, objects) # sampled at all (x,y) pairs
jim(x, y, img; title, clim=(0,1300))
end
anim = @animate for i in 1:8
disk_phantom("Realization $i")
end
gif(anim, "disk.gif", fps = 8)
Often "phantoms" are treated as digital images. Here, the shapes (rectangles, gaussians, ellipses, etc.) are all defined analytically as functions, as are their line integrals and Fourier transforms. Then one can sample those analytical functions to make digital images, sinograms, and spectra.
Most of the methods here are of general use
for any imaging modality.
There are a few methods
(mri_smap_basis
, mri_smap_fit
, mri_spectra
)
that are specific to simulating parallel MRI
(multiple receive coils)
based on the
2012 paper by Guerquin-Kern et al..
See the
documentation
for details.
For more examples with graphics, see the documentation.
Currently the package supports the following 2D shapes: ellipses/circles, rectangles/squares, gaussians, triangles, and the following 3D shapes: ellipsoids/spheres, cuboids/cubes, gaussians, cylinders, cones.
- AxisArrays.jl
- ImageGeoms.jl
- JuliaImages/Images.jl
shepp_logan
- TestImages.jl:
shepp_logan
- KomaMRI.jl
Tested with Julia ≥ 1.10.