Commit fdaf8799 authored by Shaun Warrington's avatar Shaun Warrington
Browse files

Added species flag

parent a548a3d3
#!/bin/bash
# Copyright (C) 2019 University of Oxford
......@@ -14,11 +12,20 @@ Usage() {
cat << EOF
Usage:
xtract_viewer -dir <xtractDir> [options]
xtract_viewer -dir <xtractDir> -species HUMAN [options]
xtract_viewer -dir <xtractDir> -species MACAQUE [options]
xtract_viewer -dir <xtractDir> -brain <PATH> [options]
Compulsory arguments:
-dir FOLDER Path to XTRACT output folder
-dir <FOLDER> Path to XTRACT output folder
And EITHER:
-species <SPECIES> One of HUMAN or MACAQUE
OR:
-brain <PATH> The brain image to use for the background overlay - must be in the same space as tracts.
Default is the FSL_HCP065_FA map for HUMAN and F99 T1 brain for MACAQUE
Optional arguments:
......@@ -27,8 +34,6 @@ Usage:
-thr NUMBER NUMBER The lower and upper thresholds applied to the tracts for viewing
Default = 0.001 0.1
-brain The brain image to use for the background overlay - must be in the same space as tracts.
Default is the FSL_HCP065_FA map
EOF
exit 1
}
......@@ -37,12 +42,12 @@ Splash (){
cat <<EOF
__ _______ ____ _ ____ _____ _
\ \/ /_ _| _ \ / \ / ___|_ _| __ _(_) _____ _____ _ __
__ _______ ____ _ ____ _____ _
\ \/ /_ _| _ \ / \ / ___|_ _| __ _(_) _____ _____ _ __
\ / | | | |_) | / _ \| | | | \ \ / / |/ _ \ \ /\ / / _ \ '__|
/ \ | | | _ < / ___ \ |___ | | \ V /| | __/\ V V / __/ |
/_/\_\ |_| |_| \_\/_/ \_\____| |_| \_/ |_|\___| \_/\_/ \___|_|
/ \ | | | _ < / ___ \ |___ | | \ V /| | __/\ V V / __/ |
/_/\_\ |_| |_| \_\/_/ \_\____| |_| \_/ |_|\___| \_/\_/ \___|_|
EOF
}
......@@ -59,11 +64,12 @@ cL="${#cmaps[@]}" # length of array for colourmap loop control
# Set defaults
thr=0.001
uthr=0.1
brain=${FSLDIR}/data/standard/FSL_HCP1065_FA_1mm.nii.gz
str=ALL
spec=""
while [ ! -z "$1" ];do
case "$1" in
-dir) dir=$2;shift;;
-species) spec=$2;shift;;
-str) IFS=', ' read -r -a str <<< "$2";shift;;
-thr) thr=$2;uthr=$3;shift;shift;;
-brain) brain=$2;shift;;
......@@ -81,12 +87,26 @@ elif [ ! -d $dir ];then
echo "Xtract folder $dir not found"
errflag=1
fi
if [ "$uthr" == "" ];then
echo "You have set a lower threshold but not an upper threshold. Must set '-thr' using <number> <number>"
if [ "$spec" == "" ];then
if [ "$brain" == "" ];then
echo "Must set compulsory argument '-brain' OR specify '-species <SPECIES>'"
errflag=1
elif [ `$FSLDIR/bin/imtest $brain` -eq 0 ];then
echo "Brain overlay file $brain not found"
errflag=1
fi
elif [ $spec == HUMAN ];then
brain=${FSLDIR}/data/standard/FSL_HCP1065_FA_1mm.nii.gz
elif [ $spec == MACAQUE ];then
brain=${FSLDIR}/etc/xtract_data/standard/F99/mri/struct_brain.nii.gz
elif [ ! "$spec" == "HUMAN" ] && [ ! "$spec" == "MACAQUE" ];then
echo "Unrecognised option '$spec'. Must set '-species' using HUMAN or MACAQUE"
errflag=1
fi
if [ `$FSLDIR/bin/imtest $brain` -eq 0 ];then
echo "Brain overlay file $brain not found"
if [ "$uthr" == "" ];then
echo "You have set a lower threshold but not an upper threshold. Must set '-thr' using <number> <number>"
errflag=1
fi
if [ "$errflag" -eq 1 ];then
......@@ -130,9 +150,9 @@ for tract in "${str[@]}";do
else
# if you find a left tract, then find the corresponding right tract
# and colour in the same way
if [[ $tract == *"_l"* ]];then
if [[ $tract == *"_l"* ]];then
tt=`echo ${tract} | sed s/_l/_r/`
if [[ "${str[@]}" =~ "$tt" ]];then
if [[ "${str[@]}" =~ "$tt" ]];then
# append _l and _r to fsleyes command with viewing options
cmd="$cmd ${dir}/${preT}/${tract}${postT} $opts -cm ${cmaps[i]} -n ${tract} ${dir}/${preT}/${tt}${postT} $opts -cm ${cmaps[i]} -n ${tt}"
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment