Three stacks (HSB) to one RGB z-stack

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Three stacks (HSB) to one RGB z-stack

Colin Rickman
Hi,

I have been using ImageJ to merge three images (Hue, Saturation,
Brightness) into a three slice HSB stack and then converted to an RGB
image. Is it possible to do a similar process but instead taking three
seperate 200 slice Z-stacks (again corresponding to Hue, Saturation and
Brightness) and merge them via the HSB colour space into an RGB colour
stack.

Thanks

Colin

--

Dr Colin Rickman
Centre for Integrative Physiology
School of Biomedical Sciences
University of Edinburgh
Hugh Robson Building
George Square
Edinburgh
EH8 9XD

Tel: 0131 (6)511512
Fax: 0131 (6)503128
Reply | Threaded
Open this post in threaded view
|

Re: Three stacks (HSB) to one RGB z-stack

Michael Schmid
Hi Colin,

you could try the following macro:

//convert 3 stacks H, S, B to RGB stack
selectWindow("S"); //see whether we have the required input
selectWindow("B");
selectWindow("H");
slices = nSlices();
setSlice(1);
run("Duplicate...", "title=[RGB stack-out]");
idOut= getImageID(); //this will become the output
run("RGB Color");
setBatchMode(true);

for (i=1; i<=slices; i++) {

   selectWindow("B");
   setSlice(i);
   run("Duplicate...", "title=HSB-temp");
   idHSB = getImageID();
   run("RGB Color");
   run("HSB Stack");

   selectWindow("S");
   setSlice(i);
   run("Copy");
   selectImage(idHSB);
   setSlice(2);
   run("Paste");

   selectWindow("H");
   setSlice(i);
   run("Copy");
   selectImage(idHSB);
   setSlice(1);
   run("Paste");

   run("RGB Color");
   run("Copy");
   close();

   selectImage(idOut);
   if (i>1) run("Add Slice");
   run("Paste");
}
setBatchMode("exit and display");


________________________________________________________________

Michael
________________________________________________________________

On 5 Oct 2007, at 10:05, Colin Rickman wrote:


> Hi,
>
> I have been using ImageJ to merge three images (Hue, Saturation,  
> Brightness) into a three slice HSB stack and then converted to an  
> RGB image. Is it possible to do a similar process but instead  
> taking three seperate 200 slice Z-stacks (again corresponding to  
> Hue, Saturation and Brightness) and merge them via the HSB colour  
> space into an RGB colour stack.
>
> Thanks
>
> Colin
>
> --
>
> Dr Colin Rickman
> Centre for Integrative Physiology
> School of Biomedical Sciences
> University of Edinburgh
> Hugh Robson Building
> George Square
> Edinburgh
> EH8 9XD
>
> Tel: 0131 (6)511512
> Fax: 0131 (6)503128
>