Installation
python -m pip install phantominator
The goal is to have easy installation and usage for everyone. If something doesn’t work, please open an issue and/or submit a pull request. We’ll get it figured out.
pygrappa is an optional dependency required to run the phantominator.examples.radial_coil_sens example.
About
Python package for easy generation of numerical phantoms. I often need a simple image to try something out on. In MATLAB, I would use the phantom command to quickly get something to work with. In Python, it’s not always quite so easy, so I made this package that’s quick to install and use so there’s as little friction as possible. There are other implementations of Shepp-Logan available from other projects, but they are usually not as easy to install or include other things that I don’t want for this project.
This package offers both CT and MR versions.
Going forward, this module will support Python >= 3.8.
Usage
Also see the examples module and docstrings. The interface for CT phantom generation is similar to MATLAB’s phantom function.
Examples can be run as:
# python -m phantominator.examples.[example-name], e.g.:
python -m phantominator.examples.shepp_logan
Basic usage:
# CT phantom
from phantominator import shepp_logan
ph = shepp_logan(128)
# MR phantom (returns proton density, T1, and T2 maps)
M0, T1, T2 = shepp_logan((128, 128, 20), MR=True)
The Shepp-Logan 3D phantom has ellipsoids in [-1, 1] along the z-axis. The 2D Shepp-Logan exists at z=-0.25, so if we want just a subset along the z-axis with the first slice being the traditional 2D phantom, we can use the zlims option:
from phantominator import shepp_logan
M0, T1, T2 = shepp_logan((64, 64, 5), MR=True, zlims=(-.25, .25))
We can also generate simple oscillating concentric circles:
# Dynamic (concentric circles), 20 time frames
from phantominator import dynamic
ph = dynamic(128, 20)
If we want to modify ellipse/ellipsoid parameters or we just want to see what they are. For example, we can get the MR ellipsoid parameters like this:
from phantominator import mr_ellipsoid_parameters
E = mr_ellipsoid_parameters()
See docstrings for ct_shepp_logan, and mr_shepp_logan for how the array E is structured. It follows conventions from MATLAB’s phantom function.
Arbitrary k-space sampling is supported for the single coil 2D Shepp-Logan phantom:
# Given k-space coordinates (kx, ky), where kx and ky are 1D
# arrays using the same unit conventions as BART's traj command,
# we can find the corresponding k-space measurements:
from phantominator import kspace_shepp_logan
k = kspace_shepp_logan(kx, ky)
Metadata
Release files for phantominator 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phantominator-0.7.0.tar.gz | 22.8 kB | Without provenance | Details for phantominator-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phantominator-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for phantominator-0.7.0-py3-none-any.whl |
Total release size: 49.2 kB
Release files / phantominator-0.7.0.tar.gz
| Download URL | phantominator-0.7.0.tar.gz |
|---|---|
| Size | 22.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6409c3d1ab15d39278ed2244794191763d6558fc1f93d16eccde5a4ea3d5f4e
|
|
BLAKE2b-256 checksum How to use checksums |
9a9df50dfac33ef59dab3fc90b9606dae8b8eb5a63d6a7cf295d4923e55c305d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / phantominator-0.7.0-py3-none-any.whl
| Download URL | phantominator-0.7.0-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1951fd672aad3c0fdc5f733fe5946c6445f2634382db667b579a9751a20570e3
|
|
BLAKE2b-256 checksum How to use checksums |
608b90b8ec082dee6249d841ffd54a4ccdd79f4ac456f3eb3375caacf54d104a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for phantominator 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.