-
Notifications
You must be signed in to change notification settings - Fork 0
/
9_ExportFrameInterval.ijm
executable file
·57 lines (44 loc) · 1.48 KB
/
9_ExportFrameInterval.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
54
55
56
s=File.separator;
Dialog.create("Recursive Batch Processing Template");
Dialog.addCheckbox("Input Directory = Output Directory", true);
Dialog.addMessage("Recursive Batch Processing of files that end with:");
Dialog.addString("Specify input Identifier:", "_Stack_Extr.tif");
Dialog.addMessage("Label outputfiles with:");
Dialog.addString("Specify output Identifier:", "_FrameInterval.csv");
Dialog.show();
inDisOutD=Dialog.getCheckbox();
InIdentifier=Dialog.getString();
OutIdentifier=Dialog.getString();
inDir=getDirectory("Choose the Raw Data Containing Folder");
if (inDisOutD==true) {
outDir=inDir;
}
else {
outDir=getDirectory("Choose Output Folder");
if ((inDir==outDir) || (startsWith(outDir, inDir))) {
exit("Input folder must be different from and not within output folder!");
}
}
setBatchMode(true);
RecursiveBatchProcessing(inDir, outDir);
print("Done");
setBatchMode(false);
function RecursiveBatchProcessing(inDir, outDir) {
list = getFileList(inDir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/")) {
RecursiveBatchProcessing(inDir+list[i], outDir+list[i]);
}
else if ((endsWith(list[i], InIdentifier))&&(!File.exists(replace(outDir+s+list[i], InIdentifier, OutIdentifier)))) {
open(inDir+list[i]);
name=File.getName(inDir+list[i]);
selectWindow(name);
FrameInterval=Stack.getFrameInterval();
print(FrameInterval);
selectWindow("Log");
saveAs("Text", replace(outDir+s+list[i], InIdentifier, OutIdentifier));
close("Log");
close(name);
}
}
}