-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassify_cilia.ijm
64 lines (44 loc) · 2 KB
/
classify_cilia.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
57
58
59
60
61
62
63
64
#@ File (label = "Input folder", style = "directory") input_dir
#@ File (label = "Output directory for segmentation", style = "directory") output_dir
#@ File (label = "Cilia classifier", style = "file") cilia_classifier
#@ Integer (label = "Channel for nuclei", min=1, max=8, value = 1) nuc_channel
#@ Integer (label = "Channel for kif", min=1, max=8, value = 2) kif_channel
#@ Integer (label = "Channel for membrane", min=1, max=8, value = 3) membrane_channel
#@ Integer (label = "Channel for arl13b", min=1, max=8, value = 4) arl13b_channel
File.makeDirectory(output_dir);
file_list = getFileList(input_dir)
number_of_files = file_list.length;
for (i=0; i<number_of_files; i++) {
close("*");
open(input_dir + File.separator + file_list[i]);
name = getTitle();
rename("input");
setSlice(nuc_channel);
run("Duplicate...", "title=nuclei");
selectImage("input");
setSlice(kif_channel);
run("Duplicate...", "title=cell_intensity");
selectImage("input");
setSlice(membrane_channel);
run("Duplicate...", "title=cilia_membrane");
selectImage("input");
setSlice(arl13b_channel);
run("Duplicate...", "title=arl13b");
selectImage("input");
run("Close");
run("Merge Channels...", "c1=arl13b c2=cilia_membrane create keep");
//Semantically Segment Cilia
run("Segment Image With Labkit", "input=Composite segmenter_file=" + cilia_classifier + " use_gpu=true");
rename("cilia_segmentation");
selectImage("cilia_segmentation");
save(output_dir + File.separator + "classified_" + name);
}
close("*");
getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec);
f = File.open(output_dir + File.separator + "script_params.txt");
print(f, "Script run on: " + year + " " + month+1 + " " + dayOfMonth + " at " + hour + ":" + minute + ":" + second);
print(f, "Input Data: " + input_dir);
print(f, "Output Data: " + output_dir);
print(f, "Cilia Classifier Used: " + cilia_classifier);
File.close(f);
print("pipeline complete!")