qx_utilities.hcp.process_hcp.hcp_post_freesurfer(sinfo, options, overwrite=False, thread=0)#

hcp_post_freesurfer [... processing options]

Runs the PostFS step of the HCP Pipeline (PostFreeSurferPipeline.sh).


The code expects the previous step (hcp_freesurfer) to have run successfully and checks for presence of the last file that should have been generated. Due to the number of files that it requires, it does not make a full check for all of them!


--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.

--overwrite (str, default 'no'):

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

--hcp_suffix (str, default ''):

Specifies a suffix to the session id if multiple variants are run, empty otherwise.

--logfolder (str, default ''):

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

--hcp_processing_mode (str, default 'HCPStyleData'):

Controls whether the HCP acquisition and processing guidelines should be treated as requirements ('HCPStyleData') or if additional processing functionality is allowed ('LegacyStyleData'). In this case running processing w/o a T2w image.

--hcp_folderstructure (str, default 'hcpls'):

If set to 'hcpya' the folder structure used in the initial HCP Young Adults study is used. Specifically, the source files are stored in individual folders within the main 'hcp' folder in parallel with the working folders and the 'MNINonLinear' folder with results. If set to 'hcpls' the folder structure used in the HCP Life Span study is used. Specifically, the source files are all stored within their individual subfolders located in the joint 'unprocessed' folder in the main 'hcp' folder, parallel to the working folders and the 'MNINonLinear' folder.

--hcp_filename (str, default 'automated'):

How to name the BOLD files once mapped intothe hcp input folder structure. The default ('automated') will automatically name each file by their number (e.g. BOLD_1). The alternative ('userdefined') is to use the file names, which can be defined by the user prior to mapping (e.g. rfMRI_REST1_AP).

--hcp_t2 (str, default 't2'):

'NONE' if no T2w image is available and the preprocessing should be run without them, anything else otherwise. 'NONE' is only valid if 'LegacyStyleData' processing mode was specified.

--hcp_grayordinatesres (int, default 2):

The resolution of the volume part of the grayordinate representation in mm.

--hcp_hiresmesh (int, default 164):

The number of vertices for the high resolution mesh of each hemisphere (in thousands).

--hcp_lowresmesh (int, default 32):

The number of vertices for the low resolution mesh of each hemisphere (in thousands).

--hcp_regname (str, default 'MSMSulc'):

The registration used, FS or MSMSulc.

--hcp_mcsigma (str, default 'sqrt(200)'):

Correction sigma used for metric smoothing.

--hcp_inflatescale (int, default 1):

Inflate extra scale parameter.

--hcp_fs_ind_mean (str, default 'YES'):

Whether to use the mean of the subject's myelin map as reference map's myelin map mean, YES or NO, defaults to YES.

Output files

The results of this step will be present in the MNINonLinear folder in the sessions's root hcp folder.


Runs the PostFreeSurfer step (PostFreeSurferPipeline.sh) of the HCP Pipelines. It creates Workbench compatible files based on the Freesurfer segmentation and surface registration. It uses the adjusted version of the HCP code that enables the preprocessing to run also if no T2w image is present.

hcp_post_freesurfer parameter mapping:

QuNex parameter

HCPpipelines parameter


















Example run from the base study folder with test flag:

qunex hcp_post_freesurfer \
    --batchfile="processing/batch.txt" \
    --sessionsfolder="sessions" \
    --parsessions="10" \
    --overwrite="no" \

Example run with absolute paths with scheduler:

qunex hcp_post_freesurfer \
    --batchfile="<path_to_study_folder>/processing/batch.txt" \
    --sessionsfolder="<path_to_study_folder>/sessions" \
    --parsessions="4" \
    --hcp_t2="NONE" \
    --overwrite="yes" \

Additional examples:

qunex hcp_post_freesurfer \
    --batchfile=fcMRI/sessions_hcp.txt \
    --sessionsfolder=sessions \
    --overwrite=no \
qunex hcp_post_freesurfer \
    --batchfile=fcMRI/sessions_hcp.txt \
    --sessionsfolder=sessions \
    --overwrite=no \
    --parsessions=10 \