- qx_mri.general.general_compute_bold_stats(img, mask, target, store, scrub, verbose)#
general_compute_bold_stats(img, mask, target, store, scrub, verbose)
Computes BOLD run per frame statistics and scrubbing information.
- --img (str | matrix | cell | nimage):
An nimage object or a path to a BOLD file to process.
- --mask (str | matrix | cell | nimage):
An nimage object or a path to a mask file to use.
- --target (str, default ''):
A folder to save results into:
: where bold image is,
'none': do not save results in an external file.
- --store (str, default ''):
Whether to store the data in the image file:
'same': in the same file,
'<ext>': in a new file with extension <ext>,
: do not save information in an image file.
- --scrub (str, default 'none'):
A string describing whether and how to compute scrubbing information, e.g. 'pre:1|post:1|fd:4|ignore:udvarsme' or 'none' for no scrubbing (see img_compute_scrub_nimage method for more information).
- --verbose (bool, default false):
To report the progress or not.
The function is used to compute and save per frame statistics to be used for bad frames scrubbing. It also initiates computation of scrubbing information if a scrubbing string is present.
The function identifies relevant brain voxels in two manners. First, it identifies voxels with intensity higher than 300 on the first BOLD frame. If there are more than 20000 valid voxels, it then select those for which the intensity is always above the specified threshold and selects those for computation of image statistics.
Second, if the first method fails (e.g. in the case when images were demeaned), it identifies all the voxels for which the variance across the frames is more than 0.
After the voxels were identified, the image is additionally masked if a mask was specified, and the statistics are computed using img_stats_time nimage method.
If scrub is not set to 'none', scrubbing information is also computed by calling img_compute_scrub nimage method.
The results can then be saved either by embedding them into the volume image (specified in the store parameter) or by saving them in separate files in the specified target folder using .bstats extension for bold statistics, .scrub extension for scrubbing information and .use extension for information, which frame to use.
Saving data by embedding in a volume file is currently disabled.
general_compute_bold_stats \ --img='bold1.nii.gz' \ --mask='' \ --target='movement' \ --store='' \ --scrub='' \ --verbose='true'