Login  Register

Re: I would like to draw two circles

Posted by Jerome Mutterer-3 on Nov 19, 2014; 10:06pm
URL: http://imagej.273.s1.nabble.com/I-would-like-to-draw-two-circles-tp5010553p5010560.html

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