change channel color then merge macro
Posted by etodem on Jun 02, 2011; 3:42am
URL: http://imagej.273.s1.nabble.com/change-channel-color-then-merge-macro-tp3684400.html
Hi,
I am converting some multi-channel fluoview z-stacks to interleaved tiffs in imagej using a short macro. I also wanted to include in this macro the psuedocoloring of channel 1 as green and channel 2 as red before merging. The issue I am having is that the macro works without providing me with an error message, but it will not convert channel 1 to green and channel 2 to red. What instead does is renames channel 2 as channel 1 but keeps it green. I hope that makes sense...
Any help would be much appreciated. What am I doing wrong?
This is the macro:
slicenumber = nSlices / 4;
run("Properties...", "channels=4 slices=slicenumber frames=1 unit=um pixel_width=0.621 pixel_height=0.621 voxel_depth=10000.0000 frame=[0 sec] origin=0,0 global");
run("Stack to Hyperstack...", "order=xyzct channels=4 slices=slicenumber frames=1 display=Composite");
run("Split Channels");
close();
close();
for (i=1; i<=nImages; i++) {
selectImage(i);
title = getTitle();
if (startsWith(title, "C1"))
green=title;
else if (startsWith(title, "C2"))
red=title;
}
run("Merge Channels...", "red=["+red+"] green=["+green+"] create");