Grid view of FreeSurfer screenshots in fMRIPrep

Dear fMRIPREP users,

Using screenshots of FreeSurfer (v6), I would like to create a similar grid as have been done in the visual reports of fMRIPrep.

However, I was not able to find the script or piece of code on the Github of this part. Perhaps, I missed it but could anyone indicate the script or a way to achieve this visual representation? It would really help me out!

Thank you in advance!

We use a modified ReconAll nipype interface that constructs the image after the fact:

Just to follow the breadcrumbs a bit, this depends on functionality in the SurfaceSegmentationRC interface:

This requires visualization functions to (1) determine the slices:

(2) Generate the tiles

(3) Compose the tiles into a grid

1 Like

Thank you for your very fast and detailed answer!
I will delve myself into the code you’ve provided and see how I could use it myself :slight_smile:

Cheers!

The easy way is to point it at a pre-run FreeSurfer directory (you need FreeSurfer and nipype installed):

from niworkflows.interfaces.segmentation import ReconAllRPT

ReconAllRPT(subjects_dir="/path/to/subjects",
            subject_id="sub-XX",
            out_report="/path/to/output.svg").run()

Assuming that the subject is fully run, this should take very little time, and will save the result in /path/to/output.svg.

2 Likes