Skip to main content

Processing Library and Analysis Toolkit for Medical Imaging in Python

Project description

PlatiPy

Processing Library and Analysis Toolkit for Medical Imaging in Python

PlatiPy is a library of amazing tools for image processing and analysis - designed specifically for medical imaging!

Check out the PlatiPy documentation for more info.

This project was motivated by the need for a simple way to use, visualise, process, and analyse medical images. Many of the tools and algorithms are designed in the context of radiation therapy, although they are more widely applicable to other fields that use 2D, 3D, or 4D imaging.

PlatiPy is written in :snake: Python, and uses SimpleITK, VTK, and standard Python libraries. Jupyter notebooks are provided where possible, mainly for guidance on getting started with using the tools. We welcome feedback and contributions from the community (yes, you!) and you can find more information about contributing here (link to docs).

What can I do with platipy?

A lot! A good place to start is by looking in the examples directory.

Some examples of what PlatiPy can do:

  • DICOM organising and converting:
    • Bulk convert from multiple series and studies with a single function
    • Convert DICOM-RT structure and dose filesto NIfTI images
    • Create DICOM-RT structure files from binary masks e.g. from automatic contouring algorithms
  • Image registration
    • Register images and transform labels with a few lines of code
    • Linear transformations: rigid, affine, similarity
    • Non-linear deformable transformations: demons, b-splines
    • Multiple metrics for optimisation
  • Atlas-based segmentation
  • Synthetic deformation field generation
    • Simulate anatomically realistic shifts, expansions, and bending
    • Compare DIR results from clinical systems
  • Basic tools for image processing and analysis
    • Computing label similarity metrics: DSC, mean distance to agreement, Hausdorff distance, and more
    • Cropping images to a region of interest
    • Rotate images and generate maximum/mean intensity projections (beams eye view modelling)

A major part of this package is visualisation, and some examples are shown below!

Visualise some contours

from platipy.imaging import ImageVisualiser

vis = ImageVisualiser(image)
vis.add_contour(contours)
fig = vis.show()

Figure 1

Register some images

from platipy.imaging.registration.linear import linear_registration

image_2_registered, tfm = linear_registration(
image_1,
image_2
)

vis = ImageVisualiser(image_1)
vis.add_comparison_overlay(image_2_registered)
fig = vis.show()

Figure 2

Calculate deformation vector fields

from platipy.imaging.registration.deformable import fast_symmetric_forces_demons_registration

image_2_deformed, tfm_dir, dvf = fast_symmetric_forces_demons_registration(
image_1,
image_2_registered
)

vis = ImageVisualiser(image_2_deformed, axis="z")
vis.add_vector_overlay(
    dvf,
    subsample=12,
    arrow_scale=1,
    arrow_width=2,
    colormap=plt.cm.magma,
    name="DVF magnitude [mm]",
    color_function="magnitude"
)
fig = vis.show()

Figure 3

Getting started

There aren't many requirement, just an installed Python interpreter (3.6 or greater). The list of requirements can be found in requirements.txt.

PlatiPy can be installed with pip:

pip install git+https://github.com/pyplati/platipy.git

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

platipy-0.1.1.tar.gz (98.7 kB view details)

Uploaded Source

Built Distribution

platipy-0.1.1-py3-none-any.whl (145.2 kB view details)

Uploaded Python 3

File details

Details for the file platipy-0.1.1.tar.gz.

File metadata

  • Download URL: platipy-0.1.1.tar.gz
  • Upload date:
  • Size: 98.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for platipy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d25e1f5e6ceb0bb88824c8928e0f052b594b29f7a67efc718df420fabd3dccd9
MD5 2fd8fcfc0cae588fd99e1a09f45cf2db
BLAKE2b-256 7694bf3289376861e58f60014789b18aff978e5e8d3e3e0eed4ec0b47cfd0ad1

See more details on using hashes here.

File details

Details for the file platipy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: platipy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 145.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for platipy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09f87842d0aba0b419d960daa0807a54135cda60b227c5cba059cc691d63d290
MD5 4dcb0f48589793d7f65a567a4e848eaa
BLAKE2b-256 4a4e4cb8f8f60725e71a95d5044295a7e18109a038b121af8aa0a8a3d76e3167

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page