-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0_gen_WD.sh
executable file
·52 lines (46 loc) · 1.36 KB
/
0_gen_WD.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
#! /bin/bash
# generate working directory for ATPP
#
# Directory structure:
# Working_dir
# |-- sub1
# | |-- T1_sub1.nii
# | `-- b0_sub1.nii
# |-- ...
# |-- subN
# | |-- T1_subN.nii
# | `-- b0_subN.nii
# |-- ROI
# | |-- ROI_L.nii
# | `-- ROI_R.nii
# `-- log
#
# !! Please modify the following codes to organzie these files according to the above structure
# ROI directory in which ROIs locate, please *EDIT* this directory to import ROIs to working directory
ROI_DIR=/DATA/233/hli/test/ROI
# the following variables are configured in GUI, * DO NOT * modify!
WD=$1
shift
DATA_DIR=$1
shift
ROI=$1
shift
SUB_LIST=$1
# generate ROI directory
mkdir -p ${WD}/ROI
mkdir -p ${WD}/log
# unzip ROIs if they are in gz format
gunzip ${ROI_DIR}/${ROI}_L.nii.gz
gunzip ${ROI_DIR}/${ROI}_R.nii.gz
# copy ROIs from ROI_DIR to ROI directory in working directory
cp -vrt ${WD}/ROI ${ROI_DIR}/${ROI}_L.nii ${ROI_DIR}/${ROI}_R.nii
# copy T1 and b0 files from DATA_DIR for each subject
for sub in `cat ${SUB_LIST}`
do
mkdir -p ${WD}/${sub}
cp -vrt ${WD}/${sub} ${DATA_DIR}/${sub}/T1_brain.nii.gz ${DATA_DIR}/${sub}/DTI/nodif_brain.nii.gz
gunzip ${WD}/${sub}/nodif_brain.nii.gz
gunzip ${WD}/${sub}/T1_brain.nii.gz
mv -v ${WD}/${sub}/T1_brain.nii ${WD}/${sub}/T1_${sub}.nii
mv -v ${WD}/${sub}/nodif_brain.nii ${WD}/${sub}/b0_${sub}.nii
done