Skip to main content

Some utilities to visualise medical images and masks

Project description

Tools to visualise medical images.

Installation

To install, run

pip install medvis

Example

The following example will plot a PET/CT image with alpha blended PET signal ontop of a grayscale CT image. The outline of two masks are shown with a legend that specifies what the different colours represent.

import matplotlib.pyplot as plt
import medvis


ct_image = ...
pet_image = ...
binary_true_mask = ...
binary_pred_mask = ...

true_colour = "tomato"
pred_colour = "skyblue"

blended_pet_image = medvis.apply_cmap_with_blend(pet_image, 'magma')
true_mask_outline = medvis.create_outline(binary_true_mask, width=2, colour=true_colour)
pred_mask_outline = medvis.create_outline(binary_pred_mask, width=2, colour=pred_colour)

fig, ax = plt.subplots()
ax.imshow(ct_image, cmap='gray')
ax.imshow(blended_pet_image)
ax.imshow(true_mask_outline)
ax.imshow(pred_mask_outline)
medvis.create_legend([true_colour, pred_colour], ["True mask", "Predicted mask"], ax=ax)

plt.show()

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

medvis-0.0.1.tar.gz (5.2 kB view hashes)

Uploaded source

Built Distribution

medvis-0.0.1-py2.py3-none-any.whl (8.3 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page