#!/bin/bash

INFANTFS_IMG="path/to/infantFS/image"
FS_LICENSE="path/to/freesurfer/license"
export SUBJECTS_DIR="path/to/data/parent/folder"

if [[ $2 -ge 0 && $2 -lt 6 ]]; then
    FLAG="--newborn"
elif [[ $2 -ge 6 && $2 -lt 14 ]]; then
    FLAG="--oneyear"
else
    FLAG=""
fi

singularity exec \
    -B $FS_LICENSE:/opt/freesurfer/.license \
    -B $SUBJECTS_DIR:/outgoing/ \
    $INFANTFS_IMG infant_recon_all --s $1 --age $2 $FLAG
