qx_utilities.processing.workflow.create_bold_brain_masks(sinfo, options, overwrite=False, thread=0)#

create_bold_brain_masks [... processing options]

Extracts the brain and creates a brain mask for each BOLD image.


--batchfile (str, default ''):

The batch.txt file with all the sessions' information.

--sessionsfolder (str, default '.'):

The path to the study/sessions folder, where the imaging data is supposed to go.

--parsessions (int, default 1):

How many sessions to run in parallel.

--parelements (int, default 1):

How many elements (e.g. bolds) to run in parallel.

--overwrite (str, 'no'):

Whether to overwrite existing data (yes) or not (no).

--bolds (str, default 'rest'):

Which bold images (as they are specified in the batch.txt file) to copy over. It can be a single type (e.g. 'task'), a pipe separated list (e.g. 'WM|Control|rest') or 'all' to copy all.

--boldname (str, default 'bold'):

The default name of the bold files in the images folder.

--nifti_tail (str, default detailed below):

The tail of NIfTI volume images to use. Default to the value of qx_nifti_tail.

--bold_variant (str, default ''):

Optional variant of bold preprocessing. If specified, the BOLD images in images/functional<bold_variant> will be processed.

--img_suffix (str, default ''):

Specifies a suffix for 'images' folder to enable support for multiple parallel workflows. Empty if not used.

--logfolder (str, default ''):

The path to the folder where runlogs and comlogs are to be stored, if other than default.

--log (str, default 'keep'):

Whether to keep ('keep') or remove ('remove') the temporary logs once jobs are completed. When a comma or pipe ('|') separated list is given, the log will be created at the first provided location and then linked or copied to other locations. The valid locations are:

  • 'study' (for the default: <study>/processing/logs/comlogs location)

  • 'session' (for <sessionid>/logs/comlogs)

  • 'hcp' (for <hcp_folder>/logs/comlogs)

  • '<path>' (for an arbitrary directory).


The parameters can be specified in command call or session.txt file.

create_bold_brain_masks takes the first image of each bold file, and runs FSL bet to extract the brain and create a brain mask. The resulting files are saved into images/segmentation/boldmasks in the source image format:

  • bold[N]<nifti_tail>_frame1.*

  • bold[N]<nifti_tail>_frame1_brain.*

  • bold[N]<nifti_tail>_frame1_brain_mask.*


qunex create_bold_brain_masks \
    --batchfile=fcMRI/sessions_hcp.txt \
    --sessionsfolder=sessions \
    --overwrite=no \
    --nifti_tail=_hp2000_clean \
    --bolds=all \