This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runAROMA_hcp.sh
executable file
·60 lines (46 loc) · 1.62 KB
/
runAROMA_hcp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
basedir=`pwd`
MAINDATADIR=${basedir}/data
MAINOUTPUTDIR=${basedir}/fsl
#testing
task=$1
run=$2
subj=$3
datadir=${MAINDATADIR}/${subj}/MNINonLinear/Results/tfMRI_${task}_${run}
OUTPUTDIR=${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_${task}_${run}
mkdir -p $OUTPUTDIR
OUTPUT=${OUTPUTDIR}/smoothing
#check output
aromaoutput=${OUTPUT}.feat/ICA_AROMA/denoised_func_data_nonaggr.nii.gz
if [ -e $aromaoutput ]; then
#echo "data exists: $subj on $task and run $run"
exit
else
echo "re-running $subj on $task and run $run" >> re-runAROMA.log
#echo "re-running $subj on $task and run $run"
rm -rf ${OUTPUT}.feat
fi
DATA=${datadir}/tfMRI_${task}_${run}.nii.gz
NVOLUMES=`fslnvols ${DATA}`
#find and replace: run feat for smoothing
TEMPLATE=${basedir}/templates/prep_aroma.fsf
sed -e 's@OUTPUT@'$OUTPUT'@g' \
-e 's@DATA@'$DATA'@g' \
-e 's@NVOLUMES@'$NVOLUMES'@g' \
<$TEMPLATE> ${OUTPUTDIR}/prep_aroma.fsf
#Runs smoothing for WM tasks only since they were not smoothed in first batch
feat ${OUTPUTDIR}/prep_aroma.fsf
#create variables for ICA AROMA and run it
myinput=${OUTPUT}.feat/filtered_func_data.nii.gz
myoutput=${OUTPUT}.feat/ICA_AROMA
mcfile=${OUTPUTDIR}/motion_6col.txt
rawmotion=${datadir}/Movement_Regressors.txt
#deleting any preexisting files
rm -rf $myoutput
python splitmotion.py $rawmotion $mcfile
#run bet to create mask instead of using default feat output
inputmask=${OUTPUT}.feat/mean_func.nii.gz
aromamask=${OUTPUT}.feat/betmask
bet $inputmask $aromamask -f 0.3 -n -m -R
#running AROMA
python ${basedir}/ICA-AROMA-master/ICA_AROMA_Nonormalizing.py -in $myinput -out $myoutput -mc $mcfile -m ${aromamask}_mask.nii.gz