Skip to main content

View volumetric images in Python 🧠

Project description

niftiview_logo_transparent_small

The easiest way to view volumetric images in Python 👩‍💻 Install it via pip install niftiview!

niftiview stands behind

  • NiftiView, the viewer app with the cutest desktop icon 🧠 Download it here!
  • NiftiWidget, a widget for interactive viewing in Jupyter 👩‍💻🧠 Install it via pip install niftiwidget!

Usage 💡

Single images can be shown via NiftiImage

from niftiview import TEMPLATES, NiftiImage

nii = NiftiImage(TEMPLATES['ch2'])
# nii = NiftiImage('/path/to/your/nifti.nii.gz')
im = nii.get_image()
im.show()

niftiimage

NiftiImageGrid can display multiple images in a nice grid layout

from niftiview import TEMPLATES, NiftiImageGrid

niigrid = NiftiImageGrid([TEMPLATES['ch2'], TEMPLATES['T1']])
# niigrid = NiftiImageGrid(['/path/to/your/nifti1.nii.gz', 
#                           '/path/to/your/nifti2.nii.gz'])
im = niigrid.get_image(layout='sagittal++', nrows=1)
im.show()

niftigrid

Behind the scenes, niftiview uses three main classes that build on each other

  • NiftiCore: Puts image slices of the 3D image in a 2D numpy.ndarray...
  • NiftiImage: ...applies a colormap to the array, converts it to a PIL.Image and adds overlays...
  • NiftiImageGrid: ...puts the images in a grid

Study the examples 🧑‍🏫 to fully understand niftiview and create an image like this

sci_gray

as a vector graphic─PDF, SVG, EPS or PS format─with high image quality (e.g. for scientific publication 👨‍🔬)

niftiview-cli 🖥️

pip install niftiview also installs the command line utility that given filepath(s) or a filepattern...

niftiview-cli -i /path/to/niftis/*.nii.gz -o /path/to/output/folder --gif

...saves PNGs or GIFs. To showcase its versatility, here is a compilation of created GIFs

niceviews

Explore all the available options by running niftiview-cli --help

P.S. If you're interested in creating 🧠 tissue maps like the ones shown at the end of the GIF, check out deepmriprep!

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

niftiview-1.1.1.tar.gz (16.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

niftiview-1.1.1-py3-none-any.whl (16.3 MB view details)

Uploaded Python 3

File details

Details for the file niftiview-1.1.1.tar.gz.

File metadata

  • Download URL: niftiview-1.1.1.tar.gz
  • Upload date:
  • Size: 16.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-29-generic

File hashes

Hashes for niftiview-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2e7255cbe96efa42d9d1c302faa2d37428e371755092a7cfdf4886041b84df2c
MD5 7140a9196f5704ddcbd6588b9ee31c46
BLAKE2b-256 961b3587ec9b613f083a5bfd90386ba29f0d4601e83a4bbc5066ac2a009a8abf

See more details on using hashes here.

File details

Details for the file niftiview-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: niftiview-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-29-generic

File hashes

Hashes for niftiview-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd734309ea7a3532b13339890ee135ffc8e722d009798c01f2070a62193b5395
MD5 82c159de9b121c27f17f5a253c9d12ae
BLAKE2b-256 3779625058ff7be0cc7fd850378dbcca5a7047f44a2f9672531f53943bcce85f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page