-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidationDeconvolution.ijm
88 lines (72 loc) · 2.69 KB
/
validationDeconvolution.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// compare the results for the initial and deconvolved images
// left initital image, right -- deconvolved
// only middle slice is taken
// Close all open tif's
close("*.tif");
/*
// Define Input Folders
iniInput = getDirectory("Select a Directory for import");
decInput = getDirectory("Select a Directory for import");
// Define Output Folder
output = getDirectory("Select a Directory for output");
*/
// folder name
experimentName = "N2_dpy23_wdr52_mdh1_002";
// Define Input Folders
iniInput = "/home/milkyklim/Documents/data/2017-05-28_smFISH-rex1-deletion/" + experimentName + "/dapi/";
decInput = "/home/milkyklim/Documents/data/2017-05-28_smFISH-rex1-deletion/" + experimentName + "/output/";
// Define Output Folder
output = "/home/milkyklim/Documents/data/2017-05-28_smFISH-rex1-deletion/" + experimentName + "/validation/";
//Get list of initial file-names
filenames = getFileList(iniInput);
Array.sort(filenames);
setBatchMode(true);
// SEA12_dpy23_wdr52_mdh1_006.nd2 - SEA12_dpy23_wdr52_mdh1_006.nd2 (series 01) - C=3
// SEA12_dpy23_wdr52_mdh1_006.nd2 - SEA12_dpy23_wdr52_mdh1_006.nd2 (series 02) - C=3
for (i = 0; i < filenames.length; i++){
filename = filenames[i];
// wqork only with tif files in the folder
if (endsWith(filename, ".tif") && !startsWith(filename, "psf")){
// show which file we are processing
print(filename);
// progress bar
showProgress(i + 1, filenames.length);
iniFile = iniInput + filename;
decFile = decInput + filename; // imagej behavior for the same file names
// open initial image
open(iniFile);
iniTitle = filename;
selectWindow(iniTitle);
sliceIdx = floor(nSlices/2);
setSlice(sliceIdx);
newIniTitle = "left.tif";
run("Duplicate...", "title=" + newIniTitle + " range=" + sliceIdx);
run("32-bit");
run("Grays");
// adjust the intensity of the initial image
getStatistics(area, mean, min, max, std, histogram);
run("Subtract...", "value=" + min);
run("Divide...", "value=" + (max - min));
close(iniTitle);
// open deconvolved image
open(decFile);
decTitle = substring(filename, 0, lengthOf(filename) - 4) + ".tif" ;
selectWindow(decTitle);
sliceIdx = floor(nSlices/2);
setSlice(sliceIdx);
newDecTitle = "right.tif";
run("Duplicate...", "title=" + newDecTitle + " range=" + sliceIdx);
// adjust the intensity of the deconvolved image
getStatistics(area, mean, min, max, std, histogram);
run("Subtract...", "value=" + min);
run("Divide...", "value=" + (max - min));
close(decTitle);
run("Combine...", "stack1=" + newIniTitle + " stack2=" + newDecTitle);
saveAs("Tiff", output + filename);
// closed anyways
// close(newIniTitle);
// close(newDecTitle);
close(filename);
}
}
print("DOGE!");