forked from tommysprague/preproc_shFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreproc_QC.sh
More file actions
57 lines (39 loc) · 1.75 KB
/
preproc_QC.sh
File metadata and controls
57 lines (39 loc) · 1.75 KB
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
#!/bin/bash
# preproc_QC.sh
#
# performs VERY simple QC on mean activation across run (generates mean images & a timeseries concatenating theM)
#
# assumes all anatomical (recon-all, SUMA directory creation, symlink to fs_subjects) and functional (preproc_RF/task.sh) preprocessing finished
#
# DIRECTORY STRUCTURE ASSUMED:
# EXPTDIR
# --- SUBJ
# --- ---- SESS1
# --- ---- SESS2
# --- ---- ....
# --- ---- SUBJanat (@SUBJECTS_DIR/SUBJanat/)
#
# EXPTDIR/SUBJ/SESSn should contain files like run*.nii, blip_for/rev*.nii, and
# bias field scans (head_receive_field.nii.gz and body_receive_field.nii.gz)
#
# This script will:
# 1) compute mean across entire run for each functional run, using same SEtarget partition in _SEtargets.txt file
# --> these will go in EXPTDIR/SUBJ/align_QC/SUBJ_SESS_mu_r??.nii.gz
# 2) concatenate these mean volumes into one mean timeseries across all runs
# --> these will go in the same place - named _mu_all.nii.gz
#
#
# DATAROOT is 'global' variable set before running preproc scripts
EXPTDIR=$1
SUBJ=$2
SESS=$3
CORES=`cat $DATAROOT/$EXPTDIR/$SUBJ/$SESS/${SUBJ}_${SESS}_SEtargets.txt | wc -l`
cat $DATAROOT/$EXPTDIR/$SUBJ/$SESS/${SUBJ}_${SESS}_SEtargets.txt | parallel -P $CORES -C ',' \
$PREPROC/compute_mu.sh $EXPTDIR $SUBJ $SESS {1} {2} {3}
# reset to default value (TODO: another global var?)
export OMP_NUM_THREADS=24
# make QC movie
3dTcat -overwrite -prefix $DATAROOT/$EXPTDIR/$SUBJ/align_QC/${SUBJ}_${SESS}_mu_all.nii.gz $DATAROOT/$EXPTDIR/$SUBJ/align_QC/${SUBJ}_${SESS}_mu_r*.nii.gz
# QC: motion params, put in align_QC
cat $DATAROOT/$EXPTDIR/$SUBJ/$SESS/${SUBJ}_${SESS}*.results/motion*.1D > $DATAROOT/$EXPTDIR/$SUBJ/align_QC/${SUBJ}_${SESS}_motion_all.1D
# TODO: concatenate and save 6-param motion correction fits here too