-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpearson-colocalization
More file actions
99 lines (76 loc) · 2.33 KB
/
pearson-colocalization
File metadata and controls
99 lines (76 loc) · 2.33 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
91
92
93
94
95
96
97
98
99
path = getDirectory("Choose input directory");
_RootFolder = getDirectory("Choose output directory");
outputfolder = _RootFolder + "/coloc2_output";
File.makeDirectory(outputfolder);
outputfolderROIs = _RootFolder + "/coloc2_output ROIs";
File.makeDirectory(outputfolderROIs);
filelist = getFileList(path);
for (i=0; i< filelist.length; i++) {
if (endsWith(filelist[i], ".czi")) {
run("Bio-Formats Importer", "open=[" + path + filelist[i] + "] autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_1");
title=getTitle();
run("Arrange Channels...", "new=12");
Stack.setChannel(1);
run("Red");
run("Enhance Contrast", "saturated=0.35");
Stack.setChannel(2);
run("Green");
run("Enhance Contrast", "saturated=0.35");
Stack.setDisplayMode("composite");
run("ROI Manager...");
waitForUser("Draw ROI, hit OK");
if (roiManager("Count") == 0){
waitForUser("Really draw ROI, hit OK");
}
for (j = 0; j < roiManager("count"); j++){
roiManager("Deselect");
roiManager("Select", j);
roiManager("Save selected", _RootFolder + "/coloc2_output ROIs/" + title + "_" + j + ".roi");
run("Duplicate...", "duplicate");
run("Clear Outside", "stack");
run("Split Channels");
selectImage(2);
run("8-bit");
rename("C1");
selectImage(3);
rename("C2");
run("8-bit");
run("Coloc 2", "channel_1=C1 channel_2=C2 roi_or_mask=<None> threshold_regression=Costes psf=3 costes_randomisations=10");
selectWindow("Log");
saveAs("Text", outputfolder + "/" + title + "_" + j + ".txt");
selectWindow("Log");
print("\\Clear");
close("C1");
close("C2");
}
roiManager("Deselect");
run("Select None");
selectWindow(title);
Stack.setChannel(1);
run("Translate...", "x=75 y=0 interpolation=None slice");
for (j = 0; j < roiManager("count"); j++){
roiManager("Deselect");
roiManager("Select", j);
run("Duplicate...", "duplicate");
run("Clear Outside", "stack");
run("Split Channels");
selectImage(2);
run("8-bit");
rename("C1");
selectImage(3);
rename("C2");
run("8-bit");
run("Coloc 2", "channel_1=C1 channel_2=C2 roi_or_mask=<None> threshold_regression=Costes psf=3 costes_randomisations=10");
selectWindow("Log");
saveAs("Text", outputfolder + "/" + title + "_" + j + "_random.txt");
selectWindow("Log");
print("\\Clear");
close("C1");
close("C2");
}
if (roiManager("Count") > 0){
roiManager("Delete");
}
run("Close All");
}
}