I would like to draw two circles

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

I would like to draw two circles

Avital Steinberg
Hi,
I am trying to draw two circles - they are supposed to be one ROI. My
problem is that the following code draws only one circle:

IJ.makeOval(50, 50, 50, 50);
IJ.setKeyDown(16);
IJ.makeOval(50, 100, 50, 50);
RoiManager rm = new RoiManager();
rm.addRoi(img.getRoi());

Is there a bug or am I doing something wrong?

Thanks,
Avital

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

Re: I would like to draw two circles

Cammer, Michael
This works based on http://rsbweb.nih.gov/ij/macros/CompositeSelections.txt


makeOval(52, 35, 105, 108);
setKeyDown("shift");
makeOval(126, 117, 129, 129);
roiManager("Add");

=========================================================================
 Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
                          Cell:  914-309-3270     Temporary location:  SK2-7
          http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Avital Steinberg
Sent: Wednesday, November 19, 2014 2:53 PM
To: [hidden email]
Subject: I would like to draw two circles

Hi,
I am trying to draw two circles - they are supposed to be one ROI. My problem is that the following code draws only one circle:

IJ.makeOval(50, 50, 50, 50);
IJ.setKeyDown(16);
IJ.makeOval(50, 100, 50, 50);
RoiManager rm = new RoiManager();
rm.addRoi(img.getRoi());

Is there a bug or am I doing something wrong?

Thanks,
Avital

--
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: I would like to draw two circles

John Minter
In reply to this post by Avital Steinberg
Avital,

This page (
http://cmci.embl.de/documents/120206pyip_cooking/python_imagej_cookbook#associating_multiple_rois)
by Kota Miura might help you. It is the Jython version, but you can see an
"or" operator and the ShapeRoi class...

Regards,
John

On Wed, Nov 19, 2014 at 2:52 PM, Avital Steinberg <[hidden email]
> wrote:

> Hi,
> I am trying to draw two circles - they are supposed to be one ROI. My
> problem is that the following code draws only one circle:
>
> IJ.makeOval(50, 50, 50, 50);
> IJ.setKeyDown(16);
> IJ.makeOval(50, 100, 50, 50);
> RoiManager rm = new RoiManager();
> rm.addRoi(img.getRoi());
>
> Is there a bug or am I doing something wrong?
>
> Thanks,
> Avital
>
> --
> 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: I would like to draw two circles

Avital Steinberg
In reply to this post by Cammer, Michael
Hi Michael,
Thanks - I know that this works. In macros, I have no problems doing this.
My problem is doing a very similar thing in a Java plugin,

Avital

On Wed, Nov 19, 2014 at 10:48 PM, Cammer, Michael <
[hidden email]> wrote:

> This works based on
> http://rsbweb.nih.gov/ij/macros/CompositeSelections.txt
>
>
> makeOval(52, 35, 105, 108);
> setKeyDown("shift");
> makeOval(126, 117, 129, 129);
> roiManager("Add");
>
> =========================================================================
>  Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical
> Center
>                           Cell:  914-309-3270     Temporary location:
> SK2-7
>           http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Avital Steinberg
> Sent: Wednesday, November 19, 2014 2:53 PM
> To: [hidden email]
> Subject: I would like to draw two circles
>
> Hi,
> I am trying to draw two circles - they are supposed to be one ROI. My
> problem is that the following code draws only one circle:
>
> IJ.makeOval(50, 50, 50, 50);
> IJ.setKeyDown(16);
> IJ.makeOval(50, 100, 50, 50);
> RoiManager rm = new RoiManager();
> rm.addRoi(img.getRoi());
>
> Is there a bug or am I doing something wrong?
>
> Thanks,
> Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> 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: I would like to draw two circles

Jerome Mutterer-3
Hi Avital,
With the help of the command recorder in Java mode, I found that the
following works, using the RoiManager class.

RoiManager rm = new RoiManager(false);
rm.addRoi(new OvalRoi(50, 50, 50, 50));
rm.addRoi(new OvalRoi(50, 100, 50, 50));
rm.setSelectedIndexes(new int[]{0,1});
rm.runCommand("Combine");

Jerome.

On 19 November 2014 22:47, Avital Steinberg <[hidden email]>
wrote:

> Hi Michael,
> Thanks - I know that this works. In macros, I have no problems doing this.
> My problem is doing a very similar thing in a Java plugin,
>
> Avital
>
> On Wed, Nov 19, 2014 at 10:48 PM, Cammer, Michael <
> [hidden email]> wrote:
>
> > This works based on
> > http://rsbweb.nih.gov/ij/macros/CompositeSelections.txt
> >
> >
> > makeOval(52, 35, 105, 108);
> > setKeyDown("shift");
> > makeOval(126, 117, 129, 129);
> > roiManager("Add");
> >
> > =========================================================================
> >  Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone
> Medical
> > Center
> >                           Cell:  914-309-3270     Temporary location:
> > SK2-7
> >           http://ocs.med.nyu.edu/microscopy &
> http://microscopynotes.com/
> >
> > -----Original Message-----
> > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> > Avital Steinberg
> > Sent: Wednesday, November 19, 2014 2:53 PM
> > To: [hidden email]
> > Subject: I would like to draw two circles
> >
> > Hi,
> > I am trying to draw two circles - they are supposed to be one ROI. My
> > problem is that the following code draws only one circle:
> >
> > IJ.makeOval(50, 50, 50, 50);
> > IJ.setKeyDown(16);
> > IJ.makeOval(50, 100, 50, 50);
> > RoiManager rm = new RoiManager();
> > rm.addRoi(img.getRoi());
> >
> > Is there a bug or am I doing something wrong?
> >
> > Thanks,
> > Avital
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> 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
T 0367155339
www.ibmp.cnrs.fr

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

Re: I would like to draw two circles

Avital Steinberg
Hi Jerome,
Thanks a lot - you solved my problem!

Avital

On Thu, Nov 20, 2014 at 12:06 AM, Jerome Mutterer <
[hidden email]> wrote:

> Hi Avital,
> With the help of the command recorder in Java mode, I found that the
> following works, using the RoiManager class.
>
> RoiManager rm = new RoiManager(false);
> rm.addRoi(new OvalRoi(50, 50, 50, 50));
> rm.addRoi(new OvalRoi(50, 100, 50, 50));
> rm.setSelectedIndexes(new int[]{0,1});
> rm.runCommand("Combine");
>
> Jerome.
>
> On 19 November 2014 22:47, Avital Steinberg <[hidden email]>
> wrote:
>
> > Hi Michael,
> > Thanks - I know that this works. In macros, I have no problems doing
> this.
> > My problem is doing a very similar thing in a Java plugin,
> >
> > Avital
> >
> > On Wed, Nov 19, 2014 at 10:48 PM, Cammer, Michael <
> > [hidden email]> wrote:
> >
> > > This works based on
> > > http://rsbweb.nih.gov/ij/macros/CompositeSelections.txt
> > >
> > >
> > > makeOval(52, 35, 105, 108);
> > > setKeyDown("shift");
> > > makeOval(126, 117, 129, 129);
> > > roiManager("Add");
> > >
> > >
> =========================================================================
> > >  Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone
> > Medical
> > > Center
> > >                           Cell:  914-309-3270     Temporary location:
> > > SK2-7
> > >           http://ocs.med.nyu.edu/microscopy &
> > http://microscopynotes.com/
> > >
> > > -----Original Message-----
> > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> > > Avital Steinberg
> > > Sent: Wednesday, November 19, 2014 2:53 PM
> > > To: [hidden email]
> > > Subject: I would like to draw two circles
> > >
> > > Hi,
> > > I am trying to draw two circles - they are supposed to be one ROI. My
> > > problem is that the following code draws only one circle:
> > >
> > > IJ.makeOval(50, 50, 50, 50);
> > > IJ.setKeyDown(16);
> > > IJ.makeOval(50, 100, 50, 50);
> > > RoiManager rm = new RoiManager();
> > > rm.addRoi(img.getRoi());
> > >
> > > Is there a bug or am I doing something wrong?
> > >
> > > Thanks,
> > > Avital
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> > --
> > 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
> T 0367155339
> www.ibmp.cnrs.fr
>
> --
> 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: I would like to draw two circles

Avital Steinberg
In reply to this post by John Minter
Hi John,
This is very useful to know, because it can be done also in Java:

http://rsb.info.nih.gov/ij/developer/api/ij/gui/ShapeRoi.html#or%28ij.gui.ShapeRoi%29

Thank you,

Avital

On Wed, Nov 19, 2014 at 10:48 PM, John Minter <[hidden email]> wrote:

> Avital,
>
> This page (
>
> http://cmci.embl.de/documents/120206pyip_cooking/python_imagej_cookbook#associating_multiple_rois
> )
> by Kota Miura might help you. It is the Jython version, but you can see an
> "or" operator and the ShapeRoi class...
>
> Regards,
> John
>
> On Wed, Nov 19, 2014 at 2:52 PM, Avital Steinberg <
> [hidden email]
> > wrote:
>
> > Hi,
> > I am trying to draw two circles - they are supposed to be one ROI. My
> > problem is that the following code draws only one circle:
> >
> > IJ.makeOval(50, 50, 50, 50);
> > IJ.setKeyDown(16);
> > IJ.makeOval(50, 100, 50, 50);
> > RoiManager rm = new RoiManager();
> > rm.addRoi(img.getRoi());
> >
> > Is there a bug or am I doing something wrong?
> >
> > Thanks,
> > Avital
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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