-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflagellum_detection_3d.ijm
More file actions
90 lines (58 loc) · 2.56 KB
/
flagellum_detection_3d.ijm
File metadata and controls
90 lines (58 loc) · 2.56 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//===============================================
// runs ridge detection on all images in folder
// Lin Yangchen
// NUS Centre for Bioimaging Sciences
// 7 May 2023
//===============================================
//requires ridge detection plugin to be installed (Biomedgroup update site)
//all images must be in the same file format and placed in a folder with no other files
//file names should not have any spaces or special characters
//set Bio-Formats Plugins Configuration for your file format to windowless
//===============================================
// User settings
//===============================================
//change input and output to your own folder paths
//the folder paths should have the slash at the end
//Windows
//you have to use forward slash as shown below, not the usual backslash
//input = "C:/Users/yangchen/Desktop/5232/images/";
//output = "C:/Users/yangchen/Desktop/5232/results/";
//Mac
input = "/Users/yangchen/microscopy/CBIS/scripting/Fiji/5232/images/";
output = "/Users/yangchen/microscopy/CBIS/scripting/Fiji/5232/results/";
//channel for ridge detection
chn = 1;
//===============================================
setBatchMode(true); //do not display images during execution
filelist = getFileList(input);
for (i = 0; i < filelist.length; i++)
{
run("Clear Results");
print("processing " + filelist[i]);
open(input + filelist[i]);
run("Duplicate...", "title=ridges duplicate channels="+chn);
run("8-bit");
run("Ridge Detection", "line_width=12 high_contrast=125 low_contrast=75 estimate_width displayresults make_binary method_for_overlap_resolution=SLOPE sigma=2 lower_threshold=0.17 upper_threshold=0.51 minimum_line_length=75 maximum=0 stack");
//mean intensities of flagella
run("Set Measurements...", "mean redirect=ridges decimal=3");
run("Analyze Particles...", "display clear stack");
//save mean intensities of flagella
selectWindow("Results");
saveAs("Results", output + filelist[i] + "_intensity.csv");
//save outlines of flagella
selectWindow("ridges");
run("Flatten", "stack");
saveAs("Tiff", output + filelist[i] + "_trace.tif");
//save binary mask of flagella
selectWindow("ridges Detected segments");
saveAs("Tiff", output + filelist[i] + "_binary.tif");
//save lengths and widths of flagella
selectWindow("Summary");
writeto = filelist[i] + "_lengthwidth.csv";
saveAs("Results", output + writeto);
selectWindow(writeto); run("Close");
run("Collect Garbage");
}
selectWindow("Junctions"); run("Close");
selectWindow("Results"); run("Close");
print("job done");