Skip to main content

PlatiPy

DOI

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 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.

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 files to 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 requirements, just an installed Python interpreter (3.7 or greater). PlatiPy can be installed with pip:

pip install platipy

The base installation of platipy does not include some large libraries needed for various components of platipy. The following extras are available to install to run specific platipy tools:

pip install platipy[cardiac]
pip install platipy[nnunet]
pip install platipy[backend]

Authors

Metadata

Release files for platipy 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for platipy 0.7.2
File Size Uploaded Provenance Actions
platipy-0.7.2.tar.gz 895.2 kB Without provenance Details for platipy-0.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for platipy 0.7.2
File Interpreter ABI Platform Actions
platipy-0.7.2-py3-none-any.whl Python 3 none any Details for platipy-0.7.2-py3-none-any.whl

Total release size: 2.0 MB

Release files / platipy-0.7.2.tar.gz

Download URL platipy-0.7.2.tar.gz
Size 895.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09b7952ee3226030714ad29116815967bcca4379dd19c1220e99611ec1baa48a
BLAKE2b-256 checksum
How to use checksums
31885617269ac1918edcb2722bc6e49d00af357f19ebcb24a5942bc1802fc045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.14 Linux/6.5.0-1022-azure

Release files / platipy-0.7.2-py3-none-any.whl

Download URL platipy-0.7.2-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5bfd4e8844f06381c7382527b8de2ad09718a98d18414293c8a26a19dc402552
BLAKE2b-256 checksum
How to use checksums
6c09cc11ab8b47d2aea669ad2049e2a79e94cb7aaa9d5802628c6542a91ce643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.14 Linux/6.5.0-1022-azure

Security for platipy 0.7.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page