Login  Register

Re: Small issue with the RoiManager

Posted by Yuekan Jiao-2 on Mar 18, 2016; 4:46pm
URL: http://imagej.273.s1.nabble.com/Small-issue-with-the-RoiManager-tp5015935p5015943.html

Hi,

After loading imp2, you can bring imp1 to the front by using:

IJ.SelectWindow(title1);

Hope it will work for you.

Yuekan


On Fri, Mar 18, 2016 at 6:17 AM, Philippe CARL <[hidden email]>
wrote:

> Dear all,
>
> Please consider the plugin below :
>
>
>
> import ij.*;
>
> import ij.process.*;
>
> import ij.gui.*;
>
> import java.awt.*;
>
> import ij.plugin.*;
>
> import ij.plugin.frame.RoiManager;
>
>
>
> public class My_Plugin implements PlugIn {
>
>                 public void run(String arg) {
>
>                                RoiManager rm = RoiManager.getInstance();
>
>                                if (rm==null) rm = new RoiManager();
>
>                                ImagePlus imp1 =
> IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
>
>                                imp1.show();
>
>                                imp1.setRoi(23,17,72,93);
>
>                                ImagePlus imp2 =
> IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
>
>                                imp2.show();
>
>                                rm.addRoi(imp1.getRoi());
>
>                                rm.select(rm.getCount() - 1);
>
>                                rm.runCommand("Rename"   , "roi");
>
>                 }
>
> }
>
>
>
> In this code, I use the line " rm.select(rm.getCount() - 1);" in order to
> be
> able to be able to rename the last added Roi within the RoiManager with the
> line " rm.runCommand("Rename"   , "roi");".
>
> But in the same time the line " rm.select(rm.getCount() - 1);" will add the
> given Roi to the imp2 picture (since imp2 is the selected window).
>
> Thus is there a way, having imp2 as selected window, to add a Roi from imp1
> to the RoiManager and rename it (and change its color,…) without adding
> this
> same Roi to imp2?
>
> I thank you very much in advance for your hints about this issue and wish
> you a nice week-end.
>
> My best regards,
>
> Philippe
>
>
>
> Philippe CARL
>
> Laboratoire de Biophotonique et Pharmacologie
>
> UMR 7213 CNRS - Université de Strasbourg
>
> Faculté de Pharmacie
>
> 74 route du Rhin
>
> 67401 ILLKIRCH
>
> Tel : +33(0)3 68 85 41 84
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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