-
Notifications
You must be signed in to change notification settings - Fork 6
/
dorf_mb_tst.sh
executable file
·103 lines (61 loc) · 2.58 KB
/
dorf_mb_tst.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# RUN RFs w/ multiband data, testing!
# (dorf_mb_tst.sh)
# this will launch a quiet matlab window and do all operations necessary to generate RF maps in nii's
# aligned to the freesurfer/SUMA anat at native resolution
#
# will compute a 'raw' version (no smoothing), smooth those maps, then also compute using the surface-smoothed data
#
# for surf-smoothed data, need to use matlab function niftiSqueeze before/after; and need to convert all
# niis to RAI for vista
#
#
# TODO: input args? $1, $2 ,etc
ROOT="/deathstar/data/PrismaPilotScans"
SUBJ="CC"
SESS="CMRR_S4"
TR=1.2
subjID_vista=${SUBJ}_${SESS}_vista
sessPath=$ROOT/$SUBJ/$SESS/$subjID_vista/
EPIinput="" # the 'raw' EPIs we start with (after lots of processing, etc)
EPIext_vista="_RAI" # the ones that go into vista (after some processing, saved w/ this ext)
# for CC RF_eLife
#stimExt="_sameOrder"
stimExt=""
IP="../../surfanat_brainmask_hires.nii.gz" # needs to be wrt vista directory
N_STIM=1 # 3 bar widths
# go to the vista session directory
cd $sessPath
# (1) convert barwidth nii's to RAI
# (1a) if they're "ss", or if 3dinfo gives 5-d size, run matlab niftiSqueeze
for ((i=1;i<=N_STIM;i++)); do
echo stim $i:
#if [ "$(3dinfo -orient bar_width_${i}_${EPIinput}.nii.gz)" != "RAI" ]
#then
# echo converting to RAI...#
# 3dresample -orient RAI -prefix bar_width_${i}_${EPIinput}_RAI.nii.gz -inset bar_width_${i}_${EPIinput}.nii.gz
#fi
#done
# FLIP THE ORDER OF THESE!!!! nifit-squeeze first, then resmample to RAI. this will fix problems in nii induced by niftiWrite!!!!!!
#if [[ $EPIinput==*"ss"* ]] || [[ $EPIinput==*"surf"* ]]; then
# echo nifti-squeezing
# matlab -nosplash -nojvm -nodesktop -r "setup_paths_RFs; nii=niftiRead('bar_width_${i}_${EPIinput}.nii.gz'); nii=niftiSqueeze(nii,${TR}); niftiWrite(nii,'bar_width_${i}_${EPIinput}_squeeze.nii.gz'); exit;"
#fi
3dresample -orient rai -prefix bar_width_${i}${EPIext_vista}.nii.gz -inset bar_width_${i}.nii.gz
#3dresample -orient rai -prefix bar_width_${i}_${EPIext_vista}.nii.gz -inset bar_width_${i}_${EPIinput}_squeeze.nii.gz
done
# testing stuff::::
#idx=1
#var=$(3dinfo -orient bar_width_1_bp.nii.gz)
#if [ "$var" != "RAI" ]
#if [ "$(3dinfo -orient bar_width_${idx}_bp.nii.gz)" != "RAI" ]
#then#
# echo tommy
#fi
# (2) run do_RFs.m
#
#
# go to the vista session directory
cd $sessPath
matlab -nosplash -nojvm -nodesktop -r "do_RFs('${subjID_vista}', '${sessPath}', '${EPIext_vista}',[],'${stimExt}', ${TR}) ; exit;"
# (3) smooth maps, unless they started smooth; run niiSqueeze
# (4) label all maps? (need to assume param names...)