Skip to content

A script to generate a session summary from a fmriprep* (fmriprep-babies, nibabies, fmriprep, etc.) analysis

License

Notifications You must be signed in to change notification settings

ReproNim/SumarizeFmriprep

Repository files navigation

SumarizeFmriprep

A script to generate a session summary from a fmriprep (or fmriprep-babies) analysis

Background

Canonical form of a fmriprep output

Documentation for nibabies output can be found here

A functional run's derived variables

Each functional run generates a file called: sub-XXXX_ses-Y_task-{rest, other_task_name}_run-ZZ_desc-confounds_timeseries.tsv

(or specifically, for example: sub-BB06601_ses-1_task-rest_run-02_desc-confounds_timeseries.tsv)

While this confound file contains a large number of metrics, we have specific interest in summarising the following metrics:

  • Estimated head-motion parameters - the 6 rigid-body motion parameters (3 translations and 3 rotation), estimated relative to a reference image:

    • trans_x
    • trans_y
    • trans_z
    • rot_x
    • rot_y
    • rot_z
  • bulk-head motion calculated using formula proposed by [Power2012]

    • framewise_displacement (FD)
  • Global signals:

    • csf - the average signal within anatomically-derived eroded CSF mask;

    • white_matter - the average signal within the anatomically-derived eroded WM masks;

    • global_signal - the average signal within the brain mask.

  • Count of motion outliers - Scans occurring at times of particularly high motion are flagged by the motion_outlierXX column. For summary, we want the count of 'motion_outliers' (or equally, the largest XX).

The Summariser Tool

Given a pointer to a nibabies result directory, find each functional run, and create a table that aggregates the following content:

Subj Session Task Run FD_AVG FD_STD trans_x_AVG trans_x_STD trans_y_AVG trans_y_STD trans_z_AVG trans_z_STD rot_x_AVG rot_x_STD rot_y_AVG rot_y_STD rot_z_AVG rot_z_STD CSF WM Global Outliers
BB06601 1 rest 02
BB06601 1 rest 03

Note: We can debate if the STD values are useful or not...

Example Script call (on DNK's system locally):

> ./SumarizeNibabies.sh ~/Data/Sohye/Infants/CHBabies/BB066_01/nibabies/ ExampleOutput/OutputFile.csv

Usage

./summarize_confounds -h

usage: summarize_confounds [-h] source_directory output_file

Summarize nibabies-reported confounds.

positional arguments: source_directory output_file

options: -h, --help show this help message and exit

Version 0.1

See the example real output here.

About

A script to generate a session summary from a fmriprep* (fmriprep-babies, nibabies, fmriprep, etc.) analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •