gnome-nifti-preview

GNOME NIfTI Preview: press Space on a brain MRI in GNOME Files to see three views, its metadata and its labels

Press Space on a brain MRI in GNOME Files.
Three views, the metadata and the labels of a segmentation, in a fraction of a second.

Install

Open a terminal (Ctrl Alt T) and paste:

wget -qO- https://raw.githubusercontent.com/EloiNavet/gnome-nifti-preview/main/get.sh | bash

That’s all: nothing to compile, everything stays in your home folder (except, if you accept, the program GNOME needs for thumbnails, in /usr/local/bin). If GNOME’s previewer (GNOME Sushi) is missing, the installer offers to add it.

Use

Select a medical image in Files and press Space: NIfTI (.nii, .nii.gz), FreeSurfer (.mgh, .mgz), MRtrix (.mif, .mif.gz), NRRD (.nrrd, .nhdr), MetaImage (.mha, .mhd) or DICOM (.dcm, files without extension, DICOMDIR).

   
Scroll Move through the slices
Shift + Scroll, , ., Home End 4D: move through the volumes (or drag the slider)
[ ] DICOM: previous / next series of the same exam (or pick it in the menu)
Hover The value under the pointer; on a segmentation, the label and its volume
Click Navigate: the other views follow
← → Previous / next file
Right-drag, double right-click Adjust the brightness and contrast, back to automatic
O Neurological, radiological or stored orientation
L Colours (segmentations, RGB images) or grayscale
Space Close

Pressing Space in Files, hovering to read values, scrolling, clicking, then switching to the lobe, mask and structure maps with the arrow keys

What you get

T1 image: three views, the value under the pointer and the metadata panel Brain mask: pointing at it shows label 1 and its volume, 1870 cm³

Works with GNOME Files on Ubuntu 24.04, 26.04 and 26.10 (GNOME Sushi 46 to 51) and other GNOME distributions, for NIfTI-1 and NIfTI-2, FreeSurfer MGH/MGZ, MRtrix, NRRD, MetaImage and DICOM files. Prefer other defaults (radiological view, a colour palette, other panel rows, less memory…)? Open NIfTI Preview in the applications menu, or the gear button of a preview: see settings.

To remove it: ~/.local/share/gnome-nifti-preview/uninstall.sh

In a terminal

The same images over SSH, on a cluster or in a container, without GNOME: nitty.

wget -qO- https://raw.githubusercontent.com/EloiNavet/gnome-nifti-preview/main/get.sh | bash -s -- --terminal

It installs one static program in ~/.local/bin (or /usr/local/bin as root), and nothing else; with Rust and a C compiler (build-essential: two of the image decoders are in C), cargo install --locked --git https://github.com/EloiNavet/gnome-nifti-preview nitty builds it instead. Every format of the preview is read, DICOM series included.

nitty T1w.nii.gz            # the viewer (q quits, ? lists the keys)
nitty -p T1w.nii.gz         # a quick look: the three views, printed, and back to the prompt
nitty -p --info --legend aparc+aseg.mgz    # with the metadata and the labels' names and volumes

Terminals that draw images (Kitty, Ghostty, WezTerm, iTerm2, Konsole, foot, xterm with Sixel…) get real pictures, through whichever protocol they say they have (Kitty’s, iTerm2’s or Sixel); the others (GNOME Terminal, Ptyxis, the Linux console) get coloured half-blocks, and so does tmux unless it was built to draw Sixel. A dumb terminal (TERM=dumb) gets characters by brightness; a pipe or a file gets the half-blocks in colour, and --protocol ascii plain text. See compatibility.

   
← → ↑ ↓, click Move the cursor in the active view (Shift: 10 voxels)
PgUp PgDn, Z X, wheel Slices of the active view
V, 1 2 3 0 Next view; one view alone, all three
O, L, P Orientation; labels or grayscale; palette
W B R Window narrower and darker (Shift: wider, brighter); automatic again
, ., [ ], N (Shift) 4D volumes, DICOM series, next (previous) file
Tab Metadata, labels and their volumes, time course of the voxel

nitty --help lists the options (--protocol, --colors, --view, --at, --window…). Ideas were taken from niicat (the quick look) and headjack (the viewer in half blocks).

More

Troubleshooting · Build from source · How it works · Display conventions · Compatibility · Benchmarks · Security

On macOS or Windows? Have a look at MIQ and MIQ-Win by Marco Düring, which bring the same Space-bar preview of medical images to Finder and File Explorer and inspired this project.

GPL-2.0-or-later; the screenshots and videos (docs/images, site/assets) are CC BY 4.0. A convenience tool for research, not a medical device.