forked from tommysprague/preproc_shFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_grayplots.sh
More file actions
49 lines (37 loc) · 1.24 KB
/
make_grayplots.sh
File metadata and controls
49 lines (37 loc) · 1.24 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
#!/bin/bash
# make_grayplots.sh
#
# Runs AFNI's 3dGrayplot function on all run??.nii.gz files within specified $PROJECT/$SUBJ/$SESS directory and saves pngs in specified $PROJECT/$SUBJ/align_QC/$SUBJ_$SESS_run??_grayplot.png
#
# Assumes typical (~2019-2021) Sprague lab directory structure - PROJECT/SUBJ/SESS/
#
# INPUTS:
# - PROJECT: project directory
# - SUBJ: subject ID
# - SESS: session name
#
# OUTPUTS:
# - saves a .png file as produced in AFNI's 3dGrayplot function as: $DATAROOT/$PROJECT/$SUBJ/align_QC/$SUBJ_$SESS_run??_grayplot.png
#
# assumes you have a DATAROOT environment variable that says where project directories live
#
# TC Sprague 11/7/2021
EXPTDIR=$1
SUBJ=$2
SESS=$3
# size of image to be saved
XDIM=2560
YDIM=1440
# where files are found
NIIFILES=$DATAROOT/$EXPTDIR/$SUBJ/$SESS/run??.nii.gz
# where to save files
OUTDIR=$DATAROOT/$EXPTDIR/$SUBJ/align_QC
OUTSUF=_grayplot.png
for thisfile in $NIIFILES
do
echo "Making grayplot of: $thisfile"
# do some bash stuff (based on stackoverflow answers...) to cut the path and extension from the filename
tmprun="${thisfile##*/}"
tmprunnum="${tmprun%%.*}"
3dGrayplot -prefix $OUTDIR/${SUBJ}_${SESS}_${tmprunnum}$OUTSUF -dimen $XDIM $YDIM -input $thisfile
done