Skip to content

Script Reference

This section provides detailed technical documentation for each script in the BRC Structural Pipeline.


Script Inventory

Script Location Role
struc_preproc.sh Root Entry point — argument parsing, directory setup, dispatching
struc_preproc_part_1.sh scripts/ Stage 1 dispatcher — T1 and T2 preprocessing
struc_preproc_part_2.sh scripts/ Stage 2 — FreeSurfer recon-all
struc_preproc_part_3.sh scripts/ Stage 3 — FastSurfer + output organisation
run_T1_preprocessing.sh scripts/ Core T1 processing (BET, registration, bias, FAST, FIRST)
run_T2_preprocessing.sh scripts/ Core T2 processing (co-registration, bias, BIANCA)
run_T1_sienax.sh scripts/ Brain volume estimation (SIENAX approach)
run_T2_bianca.sh scripts/ White matter lesion detection (BIANCA)
output_organization.sh scripts/ Moves outputs to canonical BRC folder hierarchy
FSL_anat.sh scripts/ Full FSL anatomical preprocessing (fsl_anat-style)
run_preprocessing.sh scripts/ FreeSurfer-based intensity normalisation
move_rename.sh scripts/ Legacy output organisation for fsl_anat-based path

Argument Parsing Convention

All sub-scripts use a shared getopt1 function for parsing --key=value style arguments:

getopt1()
{
    sopt="$1"
    shift 1
    for fn in $@ ; do
        if [ `echo $fn | grep -- "^${sopt}=" | wc -w` -gt 0 ] ; then
            echo $fn | sed "s/^${sopt}=//"
            return 0
        fi
    done
}

Arguments are passed positionally as --key=value pairs and extracted by name. An unmatched key returns an empty string.