Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

brainprep.interfaces.mask_overlap

brainprep.interfaces.mask_overlap(maskdiff_files_regex, output_dir, overlap_threshold=0.05, dryrun=False)[source]

Compute overlap ratios between mask pairs from maskdiff summary files.

This function loads TSV files produced by the maskdiff tool, extracts voxel counts for mask 2 and masks intersection, and computes the overlap ratio defined as:

overlap = intersection_size / mask2_size

Parameters:
maskdiff_files_regexstr

A regular expression matching TSV files generated by maskdiff. These files must contain voxel counts and physical volumes (mm³) for each mask and their intersection.

output_dirDirectory

Directory where a TSV file containing the mean correlation values is created.

overlap_thresholdfloat

Quality control threshold applied on the overalp score. Default 0.05.

dryrunbool

If True, skip actual computation and file writing. Default False.

Returns:
overlap_fileFile

A TSV file containing the overlap ratio between the intersection and the second mask for each subject/session/run. The table includes the columns participant_id, session, run, and mask_size, intersection_size, overlap, as well as a binary qc column indicating the quality control result.

Notes

A qc column is added to the output table. It contains a binary flag indicating whether the overlap score do not exceeds the threshold: qc = 1 if overlap < overlap_threshold, otherwise qc = 0.