-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path130220_merge_colors.ijm
58 lines (51 loc) · 1.69 KB
/
130220_merge_colors.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
// Generic Batch Processing Macro
// Processing here: Swap z stack to t dimensions in a stack
// hint: use the native ImageJ Macro Recorder to change the processing command
// Artur Yakimovich (c) copyright 2013. University of Zurich
//get the path from user input
ReadPath = getDirectory("Choose a Directory");
//create a new directory for the processed images
processedDir=ReadPath+"rgb";
File.makeDirectory(processedDir);
list = getFileList(ReadPath);
//clean up the file list
dirList = newArray();
tritcList = newArray();
gfpList = newArray();
tlList = newArray();
for(i=0; i<=list.length-1; i++){
if (endsWith(list[i], "/"))
dirList = Array.concat(dirList, list[i]);
else if (endsWith(list[i], "TRITC.stk.tif"))
tritcList = Array.concat(tritcList, list[i]);
else if (endsWith(list[i], "GFP.stk.tif"))
gfpList = Array.concat(gfpList, list[i]);
else if (endsWith(list[i], "FFT_BP.tif"))
tlList = Array.concat(tlList, list[i]);
}
//main for-loop
print ("start color merge");
for(i=0; i<=tritcList.length-1; i++){
print (tritcList[i]);
//open an image from the list
open(tritcList[i]);
titleTRITC = getTitle();
print("tritc title: "+titleTRITC);
open(gfpList[i]);
titleGFP = getTitle();
print("tritc gfp: "+titleGFP);
open(tlList[i]);
titleTL = getTitle();
print("tl title: "+titleTL);
// the actuall processing here
run("RGB Gray Merge", "gray="+titleTL+" red="+titleTRITC+" green="+titleGFP+" blue=*None*");
// end of processing
// get the title and save the image
title = getTitle();
iname = i+1;
print("Saving: "+processedDir+File.separator+iname+"rgb.tif");
saveAs("Tiff", processedDir+File.separator+iname+"rgb.tif");
//close the window
close();
}
print ("end color merge");