-
Notifications
You must be signed in to change notification settings - Fork 0
/
inspect_explore_cluster.sh
executable file
·126 lines (95 loc) · 3.03 KB
/
inspect_explore_cluster.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
# inspect_explore_all.sh
#
# inspect_explore_all.sh [ options ] img mask
#
# Created by Paddy Slator on 01/01/2020.
# Author: Paddy Slator, p.slator@ucl.ac.uk
#
#
# LICENSE
# <inspect toolbox for qMRI analysis>
# Copyright (C) <2020> <Paddy J. Slator, p.slator@ucl.ac.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
inspect_explore_cluster(){
#make sure inspect is on the path and matlab path
#cluster version
inspectpath='~/inspect:~/inspect/utilities:~/inspect/examples:~/inspect/subfunctions:~/inspect/plotting:~/inspect/kernels'
export PATH=$inspectpath:$PATH
export MATLABPATH=$inspectpath
#make sure matlab scripts are on the path
scriptspath='/home/pslator/matlab_scripts/'
export PATH=$scriptspath:$PATH
imgs=()
gradechoinv=()
masks=()
kernel=()
for n in "$@" ; do
arg=false
case "$n" in
-img) flag='i' ;;
-grad) flag='g' ;;
-mask) flag='m' ;;
-kernel) flag='k' ;;
*) arg=true ;;
esac
#if this is an argument, use the flag that we are on to assign stuff
if [ $arg = true ] ; then
case "$flag" in
i) imgs+=($n) ;;
g) gradechoinv+=($n) ;;
m) masks+=($n) ;;
k) kernel+=($n) ;;
esac
fi
done
for img in ${imgs[@]}
do
echo $img
done
for mask in ${masks[@]}
do
echo $mask
done
nimg="${#imgs[@]}"
nmask="${#masks[@]}"
if [nimg ~= nmask]
then
echo "Number of images and masks must be the same!" 1>&2
exit 1
fi
echo $PATH
#cluster version
#fit to individual scans
# for ((n=0; n<nimg; n++));
# do
# echo ${imgs[n]}
# echo $gradechoinv
# echo ${masks[n]}
# echo $kernel
# echo inspect_explore
#
# qsub /home/pslator/matlab_scripts/matlab.multicpufun inspect_explore ${imgs[n]} $gradechoinv ${masks[n]} $kernel
# done
#fit to all scans at once
#modify file list into the correct input format for inspect_explore.m
#allimgs=$(echo "${imgs[@]}")
#allmasks=$(echo "${masks[@]}")
#put {" "} around the outside
#allimgs="{\""$allimgs"\"}"
#allmasks="{\""$allmasks"\"}"
#replace all spaces with ","
#allimgs=$(echo ${allimgs// /\",\"})
#allmasks=$(echo ${allmasks// /\",\"})
qsub /home/pslator/matlab_scripts/matlab.multicpufun inspect_explore $allimgs $gradechoinv $allmasks $kernel
}
inspect_explore_cluster $*