Discussion:
Selecting a specific color on RGB spectrum split
Ryan Johnson
2006-10-03 19:13:11 UTC
Permalink
Hey all ImageJers,

I'm using ImageJ to split full-color photographs of cell stains and am
splitting them into RGB photographs (gives 3 B/W pictures based on the
intensity of the various colors). However, I really want to be able to use
a specific color (red) and have a macro automatically select this window to
threshold it and analyze the particles. When I attempt this, my macro
always just selects the topmost window (blue) and analyzes that. Obviously,
I end up with erroneous results. Does anyone know how to script a macro in
order for it to select a specific window? Or will I have to do it manually?
Thanks in advance for any help!

Ryan Johnson
University of Colorado at Colorado Springs
Justin McGrath
2006-10-03 22:52:09 UTC
Permalink
I assume you're doing something like this in your macro
---run("RGB Stack");
---run("Convert Stack to Images");

After that, use
---selectWindow("Red");
to select the window with the red channel.

This will work as long as you're working with only one image at a
time. If you break several images into color channels, there will be
multiple windows named "Red" and you'll have a chance of selecting the
wrong one. If that's the case, run this after you break up each image
---selectWindow("Red");
---someWindowID = getImageID();
Store different IDs in different variables, and use this to pick the
one you want.
---selectImage(someWindowID);

There's probabaly a better way to do it, but this way works for me.

Justin
Post by Ryan Johnson
Hey all ImageJers,
I'm using ImageJ to split full-color photographs of cell stains and am
splitting them into RGB photographs (gives 3 B/W pictures based on the
intensity of the various colors). However, I really want to be able to use
a specific color (red) and have a macro automatically select this window to
threshold it and analyze the particles. When I attempt this, my macro
always just selects the topmost window (blue) and analyzes that. Obviously,
I end up with erroneous results. Does anyone know how to script a macro in
order for it to select a specific window? Or will I have to do it manually?
Thanks in advance for any help!
Ryan Johnson
University of Colorado at Colorado Springs
Andrew Kligerman
2006-10-03 19:56:56 UTC
Permalink
Hi,

I had the same problem and solved it by going to Window and selecting
the one you want or closing the ones you don't want using the Window
pull down menu.

Andy KLigerman
US EPA



Ryan Johnson
<***@UCCS.E
DU> To
Sent by: ImageJ ***@LIST.NIH.GOV
Interest Group cc
<***@LIST.NIH
.GOV> Subject
Selecting a specific color on RGB
spectrum split
10/03/2006 03:13
PM


Please respond
to
ImageJ Interest
Group
<***@LIST.NIH
.GOV>






Hey all ImageJers,

I'm using ImageJ to split full-color photographs of cell stains and am
splitting them into RGB photographs (gives 3 B/W pictures based on the
intensity of the various colors). However, I really want to be able to
use
a specific color (red) and have a macro automatically select this window
to
threshold it and analyze the particles. When I attempt this, my macro
always just selects the topmost window (blue) and analyzes that.
Obviously,
I end up with erroneous results. Does anyone know how to script a macro
in
order for it to select a specific window? Or will I have to do it
manually?
Thanks in advance for any help!

Ryan Johnson
University of Colorado at Colorado Springs

Loading...