Assuming you've already converted your data into nifti, and flipped to LAS, the following code will run all of the available segmentations with FIRST.
run_first_all INPUT_T1 BOUNDARY_CORRECTION_THRESH OUT_PREFIX ex: /code/run_first_all T1_flip 3 12345 ##the run_first_all script in the /code/ directory has been changed to use a brainmask
The boundary correction threshold is a zscore of how strict your want FIRST to be concerning the borders of your ROIs.
the boundary corrected ROIs need to be regenerated from the remaining first VTK meshes.
#!/bin/bash SUBJ=$1 FIRSTDIR=/path/to/first/segmentations/$SUBJ/firstSeg OUTDIR=~/path/to/put/regenerated/segmentations/$SUBJ ######for first volumes for region in R_Amyg L_Amyg R_Accu L_Accu R_Hipp L_Hipp R_Caud L_Caud; do ##recreate the individual first volumes from remaining VTK first_utils --meshToVol -i $FIRSTDIR/T1_flip -m $FIRSTDIR/${SUBJ:9}-${region}_first.vtk -o ${OUTDIR}/tmp_${region} ##boundary correct the volumes using the same correction originally used while running FIRST first_utils --singleBoundaryCorr -i ${OUTDIR}/tmp_${region} -r $FIRSTDIR/T1_flip -p 4 -o ${OUTDIR}/tmp_${region}_corr4 done ##create ROIs, by adding the L and R together (optional) ##here the R will always equal 2 because the mask has been multiplied by 2 before adding the the L side fslmaths ${OUTDIR}/tmp_R_Amyg_corr4 -mul 2 -add ${OUTDIR}/tmp_L_Amyg_corr4 $OUTDIR/amyg_first fslmaths ${OUTDIR}/tmp_R_Accu_corr4 -mul 2 -add ${OUTDIR}/tmp_L_Accu_corr4 $OUTDIR/accu_first fslmaths ${OUTDIR}/tmp_R_Caud_corr4 -mul 2 -add ${OUTDIR}/tmp_L_Caud_corr4 $OUTDIR/caud_first fslmaths ${OUTDIR}/tmp_R_Hipp_corr4 -mul 2 -add ${OUTDIR}/tmp_L_Hipp_corr4 $OUTDIR/hipp_first ##remove the temporary files written above rm ${OUTDIR}/tmp_*
##creates and empty txt file touch $OUTDIR/first_vols.txt for input in amyg_first hipp_first accu_first caud_first; do echo "$OUTDIR/$input L" >> $OUTDIR/first_vols.txt fslstats $OUTDIR/$input -u 1.1 -V >> $OUTDIR/first_vols.txt echo "$OUTDIR/$input R" >> $OUTDIR/first_vols.txt fslstats $OUTDIR/$input -l 1.1 -V >> $OUTDIR/first_vols.txt done