Re: Select window
Posted by
Aryeh Weiss on
Nov 24, 2015; 7:41pm
URL: http://imagej.273.s1.nabble.com/Select-window-tp5015022p5015027.html
On 24/11/2015 8:45 PM, JP Dustin wrote:
> I have been trying to find a solution to this, but have been having little success.
>
> I am running an RGB split and need to keep the green channel from the resulting split. How can I get my macro to select the green channel image, and close the red and blue? I would like to do this for all subsequent images with differing image names.
>
>
When you split an RGB image, it will name the green channel
imageTitle (green)
so you can do something like:
selectImage(imageTitle); // assume your image name is stored in the
variable called imageTitle
run("Split Channels");
if (isOpen(imageTitle+" (red)" ) ) {
close(imageTitle+" (red)" );
}
if (isOpen(imageTitle+" (blue)" ) ) {
close(imageTitle+" (blue)");
}
if (isOpen(imageTitle+" (green)" ) ) {
code to process your green image
}
The if statements are "defensive" -- if they fail then something is
wrong (you can add an else clause to catch that and print something
appropriate.
--aryeh
--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel
Ph: 972-3-5317638
FAX: 972-3-7384051
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html