-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMacro_to_Batch_onOmero_3D_IJ1_Arguments
54 lines (50 loc) · 2.07 KB
/
Macro_to_Batch_onOmero_3D_IJ1_Arguments
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
/* Test macro for analysis on a dataset Omero
* Input : 3D TIF image
* Thresholding and 3D object detection and labeling
* Transformation of labels into ROI groups : 3D ROIs
* Output : Image of labels (depending on choice), Results tab, Log window and ROIs
* F. Brau for Fiji/ImageJ 1.53f November 2021
*/
// Initialisation----------------------------------------------------------------------
run("Set Measurements...", "area limit redirect=None decimal=2");
run("Colors...", "foreground=white background=black selection=yellow");
run("Options...", "iterations=1 count=1 edm=Overwrite");
run("Clear Results");
print("\\Clear");
if (roiManager("count")>0) {
roiManager("deselect");
roiManager("delete");
}
// Dialog Box=Get variables ----------------------------------------------------------
/* The dialog box is executed only if the macro is called for the first time by the macro
In this case values are stored in a temporary file "Parameters_Macro_toBatch.txt" (which is previously deleted)
in the Fiji\macros directory. The values are read in the file during the following executions.
*/
macro_path = File.directory();
execution = getArgument();
if (execution == '0') {
Dialog.create("3D segmentation Batch Macro on Omero");
Dialog.addNumber("2D Minimal size :", 20);
Dialog.addNumber("3D Minimal size :", 20);
Dialog.addCheckbox("Close all the images at the end", false);
Dialog.show();
size_min2D = Dialog.getNumber();
size_min3D = Dialog.getNumber();
if(Dialog.getCheckbox()) {
close_all = "true";
} else {
close_all = "false";
}
File.delete(macro_path + "Parameters_Macro_toBatch.txt");
file_temp = File.open(macro_path + "Parameters_Macro_toBatch.txt");
print(file_temp, size_min2D + "\t" + size_min3D+ "\t" + close_all);
File.close(file_temp);
} else {
str=File.openAsString(macro_path + "Parameters_Macro_toBatch.txt");
lines=split(str, "\t");
size_min2D=(lines[0]);
size_min3D=(lines[1]);
close_all=(lines[2]);
}
arguments = "size_min2D="+size_min2D+",size_min3D="+size_min3D+",close_all="+close_all;
runMacro(macro_path + "Macro_to_Batch_onOmero_3D.ijm", arguments);