Repository navigation
Expand file tree
/
Copy pathdownsample_label.bash
More file actions
executable file
·43 lines (35 loc) · 1.68 KB
/
Copy pathdownsample_label.bash
File metadata and controls
executable file
·43 lines (35 loc) · 1.68 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
#!/bin/bash
# downsample a label, e.g., downsample lh.cortex.label (ico7) to lh.cortex6.label (ico6) for a subject.
# The downsampled label can be used to find the cortical vertices (as opposed to the medial wall) for a subject on its ico6 surface.
#
# Usage: bash downsample_label.bash <subject> [<label> [<ico_order>]]
#
# IMPORTANT: Run this in your recon-all output dir, the SUBJECTS_DIR.
APPTAG="[DS_LABEL]"
SUBJECT=$1
LABEL="cortex"
ICO_ORDER=6
if [ -z "$SUBJECT" ]; then
echo "${APPTAG} ERROR: No subject specified. Usage: bash downsample_label.bash <subject> [<label> [<ico_order>]]"
echo "${APPTAG} ERROR: Example: bash downsample_label.bash bert cortex 6"
exit 1
fi
if [ -n "$2" ]; then
LABEL=$2
fi
if [ -n "$3" ]; then
ICO_ORDER=$3
fi
export SUBJECTS_DIR="${SUBJECTS_DIR:-$(pwd)}"
if [ ! -d "${SUBJECT}" ]; then
echo "${APPTAG} ERROR: Directory '${SUBJECT}' not found. Please run this script from the directory it is stored in."
exit 1
fi
lh_output_label="./${SUBJECT}/label/lh.${LABEL}${ICO_ORDER}.label"
rh_output_label="./${SUBJECT}/label/rh.${LABEL}${ICO_ORDER}.label"
mri_label2label --srclabel ./${SUBJECT}/label/lh.${LABEL}.label --srcsubject "${SUBJECT}" --trglabel "${lh_output_label}" --trgsubject ico --regmethod surface --hemi lh --trgicoorder ${ICO_ORDER}
mri_label2label --srclabel ./${SUBJECT}/label/rh.${LABEL}.label --srcsubject "${SUBJECT}" --trglabel "${rh_output_label}" --trgsubject ico --regmethod surface --hemi rh --trgicoorder ${ICO_ORDER}
echo "${APPTAG} Done. Check for error messages above."
echo "${APPTAG} If everything went fine, labels were written to:"
echo "${APPTAG} * lh: ${lh_output_label}"
echo "${APPTAG} * rh: ${rh_output_label}"