Last active
August 29, 2015 14:26
-
-
Save mattsouth/ecca873ad8be62aa8f65 to your computer and use it in GitHub Desktop.
For testing scan type mappings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# works through the current directory (assumed of sessions with subdirectories of scans) for unmapped scan types | |
function mapType { | |
if [[ "$1" == DTI_* ]]; then | |
type='DTI' | |
elif [[ "$1" == ep-moco-nav-set* ]]; then | |
type='Navigator' | |
elif [[ "$1" == fieldmap_* ]]; then | |
type='FieldMap' | |
elif [[ "$1" == gre_0.8inplane_5mm_* ]]; then | |
type='T2*' | |
elif [[ "$1" == localizer_* ]]; then | |
type='Localizer' | |
elif [[ "$1" == mb6_hcp_2mmiso_TR1300_* ]]; then | |
type='Resting-state' | |
elif [[ "$1" == t2_tirm_tra_dark-fluid_3mm_9_1 ]]; then | |
type='FLAIR' | |
elif [[ "$1" == tfl-multiecho-epinav-711_NoMoCo_* ]]; then | |
type='T1' | |
elif [[ "$1" == to_PCASL_perf_ep2d_bold_BGS_inc_PLD* ]]; then | |
type='ASL' | |
else | |
# default to directory name without the trailing slash | |
type="${1%/}" | |
fi | |
} | |
for session in */; do | |
if [ -d $session ]; then | |
cd $session | |
for scan in */; do | |
if [ -d $scan ]; then | |
mapType $scan | |
if [[ "$type" != "${scan%/}" ]]; then | |
echo "$session$scan = $type" | |
else | |
echo "$(tput setaf 1)$session$scan$(tput setaf 0)" | |
fi | |
fi | |
done | |
cd .. | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment