-
Notifications
You must be signed in to change notification settings - Fork 0
/
BatchCountChromosomes_YUW.ijm
48 lines (48 loc) · 1.17 KB
/
BatchCountChromosomes_YUW.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
name=getArgument;
if (name=="")
{
source_dir = getDirectory("Source Directory");
}
else
{
source_dir=name;
}
run("Options...", "iterations=1 count=1 black edm=Overwrite do=Nothing");
setBatchMode(true);
source_list = getFileList(source_dir);
//analysis_file=source_dir+"Analysis.csv";
//f = File.open(analysis_file); // display file open dialog
for (n=0; n<source_list.length; n++)
{
starting_up=true;
if (File.isDirectory(source_dir+source_list[n])==1)
{
my_dir=source_dir+source_list[n]+File.separator;
my_name=source_list[n];
my_name=substring(my_name, 0, lengthOf(my_name)-1);
list=getFileList(my_dir);
IJ.log(my_dir);
for (m=0; m<list.length; m++)
{
setBatchMode(false);
if (endsWith(list[m],"mask.tif")==0&&endsWith(list[m],".tif")==1)
{
IJ.log(my_dir+list[m]);
logs=runMacro("ChromosomeCountingv2_YUW.ijm", my_dir+list[m]);
if (starting_up)
{
rename(source_list[n]);
starting_up=false;
}
else
{
run("Concatenate...", " title=["+source_list[n]+"] image1=["+source_list[n]+"] image2=Final image3=[-- None --]");
}
IJ.log("Done!");
}
}
saveAs("Tiff", source_dir+my_name+".tif");
close();
}
}
//File.close(f)