-
Notifications
You must be signed in to change notification settings - Fork 0
/
PEMP_MethMolBiol_2020
78 lines (63 loc) · 2.5 KB
/
PEMP_MethMolBiol_2020
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
//This macro is customized from the original PEMP algorithm published at Siegerist et al. Scientific Reports 2017
//Additionally to the original macro, this also includes background subtraction and maximum intensity projections
//Further versions will be updated over www.github.org/Siegerist
open();
//Sets the channel to the filtration slit channel (podocin)
Stack.setChannel(1);
//Defines a global scaling
run("Set Scale...", "distance=31.0154 known=1 pixel=1 unit=micron global");
//Get the source directory and time string
dir = getDirectory("Image");
name=getTitle;
path=dir+name;
getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec);
TimeString ="";
if (hour<10) {TimeString = TimeString+"0";} TimeString = TimeString+hour+"_";
if (minute<10) {TimeString = TimeString+"0";} TimeString = TimeString+minute+"_";
if (second<10) {TimeString = TimeString+"0";} TimeString = TimeString+second; measurementID = TimeString;
name = getTitle;
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
//Background subtration, MIP
run("Grays");
run("Subtract Background...", "rolling=10 stack");
run("Z Project...", "projection=[Max Intensity]");
run("Enhance Contrast", "saturated=0.35");
//Select plan areas
roiManager("Show All");
Stack.setActiveChannels("10");
setMinAndMax(0, 13000);
waitForUser("Select plan filtration slit areas with the polygon or free selection tool, hit OK to continue");
//Copies and pastes the ROIs in a new window
nROIs = roiManager("count");
if (nROIs > 1) {
roiManager("combine");
}
run("Copy");
roiManager("Add");
newImage("Segmentation", "8-bit black", 2430, 2430, 1);
//pastes the selection to the same position as in the source image
roiManager("Select",0);
run("Paste");
roiManager("Deselect");
roiManager("Delete");
//Measures the plan areas and runs the filtration slit segmentation
run("Measure");
run("Ridge Detection", "line_width=3.5 high_contrast=230 low_contrast=87 correct_position add_to_manager method_for_overlap_resolution=NONE sigma=1.51 lower_threshold=3.06 upper_threshold=7.99");
//Check for correct Ridge Detection
roiManager("Show None");
Dialog.create("Segmentation OK?");
Dialog.show();
//Saves the results to source directory as JPG and XLS
selectWindow("Segmentation");
saveAs("Jpeg", title + measurementID);
roiManager("Measure");
name = title + measurementID + ".xls";
saveAs("Measurements", dir+name);
String.copyResults();
IJ.deleteRows(0, 3000000);
roiManager("Delete");
run("Close");
run("Close");
run("Close");
close("Results");