-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path151203_create_projection_channel.ijm
50 lines (41 loc) · 1.32 KB
/
151203_create_projection_channel.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
// Artur Yakimovich (c) copyright 2015. University of Zurich
print ("start");
// user defined variables begin
setBatchMode(true);
filePattern = "^.*[A-H][0-9]*_w1.*.TIF";
wavelengthToProject1 = "w2";
wavelengthToProject2 = "w3";
newWavelength = "w5";
projectionType = "Min Intensity"; //Max Intensity, Average Intensity, Sum Slices
// user defined variables end
//get the path from user input
ReadPath = getDirectory("Choose a Directory");
list = getFileList(ReadPath);
dirList = newArray();
fileList = newArray();
for(i=0; i<=list.length-1; i++){
if (endsWith(list[i], "/"))
dirList = Array.concat(dirList, list[i]);
else if (matches(list[i], filePattern))
fileList = Array.concat(fileList, list[i]);
}
//main for-loop
print(fileList.length);
print ("start");
for(i=0; i<=fileList.length-1; i++){
print (fileList[i]);
fileName = replace(fileList[i], "w1", wavelengthToProject1);
print(ReadPath+fileName);
open(ReadPath+fileName);
print (fileList[i]);
fileName = replace(fileList[i], "w1", wavelengthToProject2);
print(ReadPath+fileName);
open(ReadPath+fileName);
run("Images to Stack", "name=Stack title=[] use");
//projection here
run("Z Project...", "projection=["+projectionType+"]");
newFileName = replace(fileList[i], "w1", newWavelength);
print(newFileName);
saveAs("Tiff", ReadPath+newFileName);
run("Close All");
}