This is a pure Python module for taking slices through MR Images and displaying them in beautiful ways. It is friendly to both clinical and pre-clinical data, and includes dual-coding overlays.

Here is a Jupyter Notebook demonstrating the functionality.

This is an example of an image you can make with it:

_images/dualcode.png

And here is an example of the viewer application:

_images/viewer.png

Along with the nanslice module that can be used in your Python scripts, there are several utitlity functions for use in jupyter notebooks, including a three-plane viewer. There are also three command line tools that will installed to your $PATH:

  • nanslicer Produces different kind of slice-plots including color bars
  • nanviewer A three-plane viewer. Requires PyQt.
  • nanvideo Converts time-series images to a movie file for easy viewing.

Why does nanslice exist when there are plenty of other great MR viewing tools, e.g. FSLEyes or MRIcroGL? There are three reasons:

  • Compatibility with pre-clinical data. Small animals (rodents) are scanned in a different orientation to humans, and hence have different definitions of superior-inferior and posterior-anterior. This makes using such images with clinically focussed tools tedious.
  • Support for dual-coding overlays
  • Inner-Platform Effect. Seen as you have to learn scripting languages if you want to have repeatable plots in other tools, you might as well build your plots with a common language straight away.

(Note: I love both MRIcroGL and FSLEyes, I use them all the time)

Okay, there’s a fourth reason. I am fussy about plots. I spend a lot of time on then. Having immediate access to all of matplotlib is a brilliant way to make beautiful plots (and also to waste hours obessessing about your choice of fonts. Avenir Next is a hell of a drug).

Indices and tables