Code for quick inspection of images with mrtrix/fsleyes

Hi everyone,

I need to visually inspect around 1000 images and am looking for a quick way of doing that so that I don’t need to type something in the command line 1000 times. I’m currently using

for img in /path/to/FLAIR_images/*.nii.gz; do
    mrview "$img"
done

but was wondering if anyone had a better way they can recommend? I vaguely remember seeing someone create gifs of images that could be inspected quickly but can’t remember how it was done. Thanks in advance!

Hi @LM99,

Command line interface — FSLeyes documentation for fsleyes. Or you can script the screen capture process for mrview to produce images that can be combined into GIFs: mrview — MRtrix3 3.0 documentation
Or you can consider something like nilearn to create slices of images that can be combined into GIFs 7. Plotting brain images - Nilearn.

Best,
Steven

Thank you, that’s what I was looking for!

1 Like

You might also want to take a look at the FSLeyes File-Tree integration, which was designed to allow QC of large structured data sets such as the UK Biobank. Briefly, it allows you to set up a scene in FSLeyes for one data set (colour maps, overlays etc), and then browse through all of your data sets without having to set up the scene each time:

3 Likes

If they are in standard space you could concatenate all subjects in the 4th dimension and create a .mif file, then use mrview to view them as a single 4D volume. The .mif and mrview are optimized to load the data quickly based on the data strides. If the volume is too big, you could use a single slice, as opposed to the entire volume.

1 Like

Thanks so much everyone! Sadly only one answer can be accepted but these are great suggestions and all of them did work for me.