-
Notifications
You must be signed in to change notification settings - Fork 0
/
validationBottomTop.ijm
81 lines (67 loc) · 2.26 KB
/
validationBottomTop.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
// 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_001";
// Define Input Folders
iniInput = "/home/milkyklim/Documents/data/2017-05-28_smFISH-rex1-deletion/" + experimentName + "/dapi/";
// Define Output Folder
output = "/home/milkyklim/Documents/data/2017-05-28_smFISH-rex1-deletion/" + experimentName + "/bottom-top/";
//Get list of initial file-names
filenames = getFileList(iniInput);
Array.sort(filenames);
setBatchMode(true);
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;
// open initial image
open(iniFile);
iniTitle = filename;
selectWindow(iniTitle);
sliceIdx = 1;
setSlice(sliceIdx);
newLeftTitle = "left.tif";
run("Duplicate...", "title=" + newLeftTitle + " 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));
// open deconvolved image
selectWindow(iniTitle);
sliceIdx = floor(nSlices);
setSlice(sliceIdx);
newRightTitle = "right.tif";
run("Duplicate...", "title=" + newRightTitle + " range=" + sliceIdx);
run("32-bit");
run("Grays");
// adjust the intensity of the deconvolved image
getStatistics(area, mean, min, max, std, histogram);
run("Subtract...", "value=" + min);
run("Divide...", "value=" + (max - min));
close(iniTitle);
run("Combine...", "stack1=" + newLeftTitle + " stack2=" + newRightTitle);
saveAs("Tiff", output + filename);
// closed anyways
// close(newIniTitle);
// close(newDecTitle);
close(filename);
}
}
print("DOGE!");