Skip to content

Python recipe for transparent label-map overlays in medical imaging

License

Notifications You must be signed in to change notification settings

PurpleOcta/label-overlay-isotropic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Label-map overlap for isotropic medical images

This Python example overlays a medical-image slice with a transparent label map derived from tissue probability maps in NIfTI files. The example assumes isotropic voxel spacing and extracts slices from the ICBM 152 2009a Nonlinear Symmetric template.

Label-map overlay

Scope of the example

This repository demonstrates how to:

  • load 3D medical images in NIfTI format
  • extract and orient corresponding 2D subarrays
  • convert tissue probabilities into a discrete label map
  • explicitly define an RGBA color overlay
  • save a PNG image overlaid with a transparent label map

The goal is to export square images as an intermediate data representation for more complex example figures.

Quick start

Install dependencies:

pip install matplotlib nibabel numpy

Run the example:

python recipe.py

This downloads the template and generates a square image overlaid with gray- and white-matter labels (overlay.png).

About

Python recipe for transparent label-map overlays in medical imaging

Topics

Resources

License

Stars

Watchers

Forks

Languages