-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAIN__CLASP_coro.ijm
54 lines (36 loc) · 1.22 KB
/
MAIN__CLASP_coro.ijm
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
File.setDefaultDir ("C:\\Users\\dani\\Documents\\MyCodes\\CLASP_coro"+File.separator);
home = File.getDefaultDir
src = home+"src"+File.separator;
data = home+"data//raw"+File.separator;
output = home+"results"+File.separator;
cropsize = 250;
include_folder = "test";
exclude_folder = "";
conditions = getFileList(data);
// run macro on files
function openFiles(){
for (cond = 0; cond < conditions.length; cond++) {
if (cond == include_folder && cond != exclude_folder && endsWith(cond, File.separator)){
curr_cond = data+cond+File.separator;
flist = getFileList(curr_cond);
for (f = 0; f < flist.length; f++) {
file_path = curr_cond+flist[f];
open(file_path)
}
}
}
}
// select files to run macro on
makeRectangle((getWidth()-cropsize)/2,(getHeight()-cropsize)/2,cropsize,cropsize);
function multiArgument(arg1="",arg2="",arg3="",arg4="",arg5="",arg6="",arg7="",arg8="",arg9="",arg10=""){
// generate single delimited argument from up to 10 separate arguments
args = newArray(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
separator="\t";
newarg = ""
for (i = 0; i < args.length; i++){
if (args[i] != ""){
newarg = newarg + args[i] + separator;
}
newarg = newarg + separator + "@@@";
}
}