-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocessing.ijm
More file actions
54 lines (47 loc) · 1.25 KB
/
preprocessing.ijm
File metadata and controls
54 lines (47 loc) · 1.25 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
inputDir = getArgument();
print("Starting ImageJ Preprocessing");
processFolder(inputDir);
print("Finished ImageJ Preprocessing");
function processAlexaFile(input){
print("ImageJ Processing an unknwon Alexa File");
open(input);
subStr = split(input, ".");
run("8-bit");
run("Auto Local Threshold", "method=Phansalkar radius=35 parameter_1=0 parameter_2=0 white");
print("ImageJ Finished Processing an unknwon Alexa File. Saving.");
saveAs("PNG", ".."+ subStr[0]);
close();
}
function processDapiFile(input){
print("ImageJ Processing an unknwon Dapi File");
open(input);
subStr = split(input, ".");
getMinAndMax(min, max);
setMinAndMax(min, (max/2));
run("Apply LUT");
getMinAndMax(min, max);
setMinAndMax(min, (max/2));
run("Apply LUT");
run("8-bit");
print("ImageJ Finished Processing an unknwon Dapi File. Saving.");
saveAs("PNG", ".."+ subStr[0]);
close();
}
function processFolder(input){
list = getFileList(input);
for(i = 0; i < list.length; i++){
if(File.isDirectory(input + list[i]))
{
processFolder(input + list[i]);
}
if (endsWith(list[i], ".tif"))
{
if (matches(list[i], ".*Alexa.*")){
processAlexaFile(input + list[i]);
}
if (matches(list[i], ".*DAPI.*")){
processDapiFile(input + list[i]);
}
}
}
}