Skip to main content

Processing Library and Analysis Toolkit for Medical Imaging in Python

Project description

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

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.7.0.tar.gz (893.1 kB view details)

Uploaded Source

Built Distribution

platipy-0.7.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: platipy-0.7.0.tar.gz
  • Upload date:
  • Size: 893.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.13 Linux/5.15.0-1041-azure

File hashes

Hashes for platipy-0.7.0.tar.gz
Algorithm Hash digest
SHA256 769db19de447501b8a5bd04e503bd18ff83750bbf97227c33d930fd80b98e428
MD5 b2668c7f92d35bd204d7e58e31792138
BLAKE2b-256 cdc1deec2821c4a1d423289c8d9f8b1c4563432cf15385545ed95bf643de0b11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: platipy-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.13 Linux/5.15.0-1041-azure

File hashes

Hashes for platipy-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57ab2c8297dccfa32a77a6be6e43ecb15b9e852f018cfee190e295cae1ba469b
MD5 68cc24292e5148dcc34691b1157d47cc
BLAKE2b-256 4598e7d9d8381bfa23794cbf88d6f32d0dc289aa43689dd0777332e04d9f732c

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