Installation
============
.. code-block:: bash
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:
.. code-block:: bash
# python -m phantominator.examples.[example-name], e.g.:
python -m phantominator.examples.shepp_logan
Basic usage:
.. code-block:: python
# 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:
.. code-block:: python
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:
.. code-block:: python
# 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:
.. code-block:: python
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:
.. code-block:: python
# 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)
Raw data
{
"_id": null,
"home_page": "https://github.com/mckib2/phantominator",
"name": "phantominator",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Nicholas McKibben",
"author_email": "nicholas.bgp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9a/9d/f50dfac33ef59dab3fc90b9606dae8b8eb5a63d6a7cf295d4923e55c305d/phantominator-0.7.0.tar.gz",
"platform": null,
"description": "Installation\n============\n\n.. code-block:: bash\n\n python -m pip install phantominator\n\nThe goal is to have easy installation and usage for everyone. If\nsomething doesn't work, please open an issue and/or submit a pull\nrequest. We'll get it figured out.\n\n`pygrappa` is an optional dependency required to run the\n`phantominator.examples.radial_coil_sens` example.\n\nAbout\n=====\n\nPython package for easy generation of numerical phantoms. I often\nneed a simple image to try something out on. In MATLAB, I would use\nthe `phantom` command to quickly get something to work with. In\nPython, it's not always quite so easy, so I made this package that's quick\nto install and use so there's as little friction as possible. There\nare other implementations of Shepp-Logan available from other\nprojects, but they are usually not as easy to install or include other\nthings that I don't want for this project.\n\nThis package offers both CT and MR versions.\n\nGoing forward, this module will support Python >= 3.8.\n\nUsage\n=====\n\nAlso see the `examples` module and docstrings. The interface for CT\nphantom generation is similar to MATLAB's `phantom` function.\n\nExamples can be run as:\n\n.. code-block:: bash\n\n # python -m phantominator.examples.[example-name], e.g.:\n python -m phantominator.examples.shepp_logan\n\nBasic usage:\n\n.. code-block:: python\n\n # CT phantom\n from phantominator import shepp_logan\n ph = shepp_logan(128)\n\n # MR phantom (returns proton density, T1, and T2 maps)\n M0, T1, T2 = shepp_logan((128, 128, 20), MR=True)\n\nThe Shepp-Logan 3D phantom has ellipsoids in [-1, 1] along the z-axis.\nThe 2D Shepp-Logan exists at z=-0.25, so if we want just a subset\nalong the z-axis with the first slice being the traditional 2D\nphantom, we can use the `zlims` option:\n\n.. code-block:: python\n\n from phantominator import shepp_logan\n M0, T1, T2 = shepp_logan((64, 64, 5), MR=True, zlims=(-.25, .25))\n\nWe can also generate simple oscillating concentric circles:\n\n.. code-block:: python\n\n # Dynamic (concentric circles), 20 time frames\n from phantominator import dynamic\n ph = dynamic(128, 20)\n\nIf we want to modify ellipse/ellipsoid parameters or we just want to\nsee what they are. For example, we can get the MR ellipsoid\nparameters like this:\n\n.. code-block:: python\n\n from phantominator import mr_ellipsoid_parameters\n E = mr_ellipsoid_parameters()\n\nSee docstrings for `ct_shepp_logan`, and `mr_shepp_logan` for how\nthe array `E` is structured. It follows conventions from MATLAB's\nphantom function.\n\nArbitrary k-space sampling is supported for the single coil 2D\nShepp-Logan phantom:\n\n.. code-block:: python\n\n # Given k-space coordinates (kx, ky), where kx and ky are 1D\n # arrays using the same unit conventions as BART's traj command,\n # we can find the corresponding k-space measurements:\n from phantominator import kspace_shepp_logan\n k = kspace_shepp_logan(kx, ky)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate numerical phantoms.",
"version": "0.7.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "608b90b8ec082dee6249d841ffd54a4ccdd79f4ac456f3eb3375caacf54d104a",
"md5": "98e4cb34818e4154a88506111475c45c",
"sha256": "1951fd672aad3c0fdc5f733fe5946c6445f2634382db667b579a9751a20570e3"
},
"downloads": -1,
"filename": "phantominator-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "98e4cb34818e4154a88506111475c45c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 26361,
"upload_time": "2023-04-16T22:22:50",
"upload_time_iso_8601": "2023-04-16T22:22:50.437186Z",
"url": "https://files.pythonhosted.org/packages/60/8b/90b8ec082dee6249d841ffd54a4ccdd79f4ac456f3eb3375caacf54d104a/phantominator-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9a9df50dfac33ef59dab3fc90b9606dae8b8eb5a63d6a7cf295d4923e55c305d",
"md5": "b31bb64a597740ca0f883af98d2332e8",
"sha256": "b6409c3d1ab15d39278ed2244794191763d6558fc1f93d16eccde5a4ea3d5f4e"
},
"downloads": -1,
"filename": "phantominator-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "b31bb64a597740ca0f883af98d2332e8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 22828,
"upload_time": "2023-04-16T22:22:52",
"upload_time_iso_8601": "2023-04-16T22:22:52.803702Z",
"url": "https://files.pythonhosted.org/packages/9a/9d/f50dfac33ef59dab3fc90b9606dae8b8eb5a63d6a7cf295d4923e55c305d/phantominator-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 22:22:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "mckib2",
"github_project": "phantominator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "phantominator"
}