Select window

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

Select window

jpdustin
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.

Thank you,

JP

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Herbie
JP,

this two-liner should do what you like to perform:

setRGBWeights(0, 1, 0);
run("8-bit");

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::
Am 24.11.15 um 19:45 schrieb JP Dustin:

> 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.
>
> Thank you,
>
> JP
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Jerome Mutterer-3
In reply to this post by jpdustin
Hi John,
Use imageIDs. After running RGB Split, get the blue imageID. The green and
red imageIDs can then be computed.

run("Clown (14K)");
run("Split Channels");
blue = getImageID();
close(); // blue channel
selectImage(blue+2);
close(); // red channel

Sincerely,

Jerome.



On 24 November 2015 at 19:45, JP Dustin <[hidden email]> 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.
>
> Thank you,
>
> JP
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
www.ibmp.cnrs.fr

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by jpdustin
> On Nov 24, 2015, at 1:45 PM, JP Dustin <[hidden email]> 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.

The best way to extract the green channel of an RGB image is to set the RGB weights and convert to 8-bits:

   setRGBWeights(0, 1, 0);
   run("8-bit”);

To extract the green (2nd) channel of a composite color image, use the Duplicate command:

   run("Duplicate...","duplicate channels=2”);

-wayne



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Gabriel Landini
In reply to this post by Jerome Mutterer-3
Another way, using the titles, which are predictable:
run("Clown (14K)");
a=getTitle();
run("Split Channels");
selectWindow(a + " (red)");
close();
selectWindow(a + " (blue)");
close();

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Aryeh Weiss
In reply to this post by jpdustin
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
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Cammer, Michael
In reply to this post by jpdustin
There are a few ways to do this.

Here is one we use.

  originalTitle = getTitle();
  run("Split Channels");

  selectWindow(originalTitle + " (green)");
  close();

  selectWindow(originalTitle + " (red)");       // this is used to select green pixels
  setThreshold(0, 127);
  run("Measure");

  selectWindow(originalTitle + " (blue)");     // this is area of entire tissue
  setThreshold(0, 147);
  run("Measure");


=========================================================================
 Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
                      Cell:  914-309-3270     ** Office: Skirball 2nd Floor main office, back right **
          http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of JP Dustin
Sent: Tuesday, November 24, 2015 1:45 PM
To: [hidden email]
Subject: Select window

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.

Thank you,

JP

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

------------------------------------------------------------
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
=================================


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Select window

Kenneth Sloan-2
Oh dear - I hope the comments contain a typo!

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




> On Nov 25, 2015, at 11:18 , Cammer, Michael <[hidden email]> wrote:
>
> There are a few ways to do this.
>
> Here is one we use.
>
>  originalTitle = getTitle();
>  run("Split Channels");
>
>  selectWindow(originalTitle + " (green)");
>  close();
>
>  selectWindow(originalTitle + " (red)");       // this is used to select green pixels
>  setThreshold(0, 127);
>  run("Measure");
>
>  selectWindow(originalTitle + " (blue)");     // this is area of entire tissue
>  setThreshold(0, 147);
>  run("Measure");
>
>
> =========================================================================
> Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
>                      Cell:  914-309-3270     ** Office: Skirball 2nd Floor main office, back right **
>          http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of JP Dustin
> Sent: Tuesday, November 24, 2015 1:45 PM
> To: [hidden email]
> Subject: Select window
>
> 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.
>
> Thank you,
>
> JP
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> ------------------------------------------------------------
> This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
> =================================
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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