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 Python 2 Python 3

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