Login  Register

Re: Stack Combiner?

Posted by Tiago Ferreira-2 on Oct 05, 2012; 4:58pm
URL: http://imagej.273.s1.nabble.com/Stack-Combiner-tp5000307p5000328.html

On 2012.10.04, at 09:43, Suraja wrote:
> We have many time lapse Z stacks images (three channels in each of them) and
> want to combine them into one ("grid" with horizontally aligned channels from
> one cell and vertically aligned coressponding channels from each cell). We know
> that it is possible to combine it with plugin Stack combiner. Is it possible to
> combine all these combinations in one step, not just by two. Or is there any
> possibility how to do it more automatically?

Suraja,

For such a specific usage, just use the macro language to automate what you
would normaly do by hand. Something like:

//---
setBatchMode(true);

// Gather information about the hyperstack.
title = getTitle;
id = getImageID;
Stack.getDimensions(width, height, channels, slices, frames);

// Reduce depth of hyperstack to a single MIP for each frame
run("Z Project...", "start=1 stop="+ slices +" projection=[Max Intensity] all");

// Close original hyperstack
selectImage(id); close;

// Split all channels and convert them to RGB stacks, preserving their LUTs
run("Split Channels");
for (i=1; i<=channels; i++) {
    selectImage(i);
    run("RGB Color");
}

// Combine the first two channels
img1 = "C1-MAX_"+ title;
img2 = "C2-MAX_"+ title;
run("Combine...", "stack1=["+ img1 +"] stack2=["+ img2 +"]");

// Keep appending any remaining channels that may still exist
for (i=3; i<=channels; i++) {
    img = "C"+ i +"-MAX_"+ title;
    run("Combine...", "stack1=[Combined Stacks] stack2=["+ img +"]");
}

setBatchMode("exit & display");
//---

Note that no other images rather than the hyperstack to be processed can be open
when the macro starts

HTH,
-tiago
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html