Posted by
CARL Philippe (LBP) on
Feb 19, 2015; 9:30am
URL: http://imagej.273.s1.nabble.com/A-couple-several-of-issues-about-the-ROI-Manager-tp5011456p5011676.html
Salut Jérôme,
How are you doing?
What's new?
I thank you very much for your code which is indeed giving an excellent
solution for the discussed issue, especially when associated to an hotkey to
easily launch it.
For the users of the list who would as well be interested by using your code
within Fiji (sorry about that) I had to slightly modify your code (so that
it is working) in the following way:
importClass(Packages.ij.IJ);
importClass(Packages.ij.plugin.frame.RoiManager);
importClass(Packages.ij.gui.Overlay);
importClass(Packages.java.awt.Color);
imp = IJ.getImage();
rm = RoiManager.getInstance();
rm.runCommand("Show None");
si = rm.getSelectedIndexes();
overlay = new Overlay();
for(i in si)
{
roi = rm.getRoi(si[i]);
// roi.setStrokeWidth(0.1);
// roi.setStrokeColor(Color.green);
overlay.add(roi);
}
imp.setOverlay(overlay);
IJ.wait(2000);
overlay.clear();
imp.setOverlay(overlay);
rm.runCommand("Show All");
Also and especially, from your code I discovered the instruction "for(i in
si)" which I didn't know (since then I looked of course for all the
alternative options available for using the "for" instruction) and able me
now to modify (= simplify) other code I have (and that was written by using
the traditional way of the "for" instruction).
Thanks a lot and have a nice day,
Philippe
-----Message d'origine-----
De : ImageJ Interest Group [mailto:
[hidden email]] De la part de Jerome
Mutterer
Envoyé : mercredi 18 février 2015 15:29
À :
[hidden email]
Objet : Re: A couple/several of issues about the ROI Manager
Salut Philippe.
The following javascript transiently displays rois that are selected in the
Roi manager.
Maybe you could use something like this.
Sincerely,
Jerome
imp = IJ.getImage();
rm=RoiManager.getInstance();
rm.runCommand("Show None");
si=rm.getSelectedIndexes();
overlay = new Overlay();
for (i in si) {
roi = rm.getRoi(si[i]);
roi.setStrokeWidth(0.1);
roi.setStrokeColor(Color.cyan);
overlay.add(roi);
}
imp.setOverlay(overlay);
IJ.wait(2000);
overlay.clear();
imp.setOverlay(overlay);
rm.runCommand("Show All");
On 18 February 2015 at 14:58, Philippe CARL <
[hidden email]>
wrote:
>
> Dear Romain,
> As you pointed it correctly out, The macro instruction
"roiManager("select",
> indexes)" with "indexes" being an array of integers between 0 and
> "roiManager("count")" is indeed doing the required job...
> The "only" problem is to know WHAT you are putting within this "indexes"
> array...
> So I want (or rather need) to manually build up this array given
> certain conditions (intensity [or evolution of the intensity on a time
> lapse] of
the
> pixels within a given ROI ; x, y position of a given ROI ; ...)...
> And up to now it is not possible to see the newly added ROI in a
> selection within the ROI Manager but only the first selected ROI.
> What would actually be perfect is to have all the selected ROIs within
> the ROI Manager displayed in the same way than in the "Show All"
> feature and
the
> last selected or added ROI within the selection as being highlighted.
> But even without the last added ROI within the selection being
highlighted,
> I would already be extremely happy...
> Bonne fin de journée,
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:
[hidden email]] De la part de
Guiet
> Romain
> Envoyé : mercredi 18 février 2015 11:31 À :
[hidden email] Objet
> : Re: A couple/several of issues about the ROI Manager
>
> Hi Philippe,
>
> I don't know if I understood correctly what you're looking for but did
> you try the function :
>
> roiManager("select", indexes)
> Selects multiple items in the ROI Manager list, where indexes is an
> array
of
> integers, each of which must be greater than or equal to 0 and less
> than
the
> value returned by roiManager("count").
> The selected ROIs are not highlighted in the ROI Manager list and are
> no longer selected after the next ROI Manager command is executed.
>
>
>
> Cheers,
>
> Romain
>
> ---------------------------------------------------------------
> Dr. Romain Guiet
> Bioimaging and Optics Platform (PT-BIOP) Ecole Polytechnique Fédérale
> de Lausanne (EPFL) Faculty of Life Sciences Station 19, AI 0140
> CH-1015 Lausanne
>
> Phone: [+4121 69] 39629
>
http://biop.epfl.ch/> ---------------------------------------------------------------
>
> ________________________________________
> De : ImageJ Interest Group [
[hidden email]] de la part de
> Philippe
CARL
> [
[hidden email]] Envoyé : mercredi 18 février 2015 10:58 À :
>
[hidden email] Objet : Re: A couple/several of issues about the
> ROI Manager
>
> Dear Wayne,
> I thank you very much for your updates which are already improving a
> lot
the
> ROI Manager tool.
> I would just have two comments on these updates:
>
> >> - Macro recorder: the recorder isn't anymore saving the
show_all
> >> and label fonctions of the ROI Manager
> > This regression is fixed in the latest ImageJ daily build (1.49p13).
>
> "roiManager("Show All");" is recorded the first time you press the
> "Show All" CheckBox, but after that it is not recorded anymore, as
> "roiManager("Show None");" is correctly recorded each time you
> deselect
the
> "Show All" CheckBox.
> In the same way "roiManager("Show All with labels");" is correctly
recorded
> as "roiManager("Show All without labels");" isn't recorded each time
> you press the "Labels" CheckBox.
>
> >> - Multiple selections in the ROI Manager: By selecting several
> ROIs
> >> within the ROI Manager, I would expect that all the selected ROIs
> >> are shown up in the picture, but only the first selected one can be
seen.
> > Only the first ROI is shown because, except in an overlay, ImageJ
> > can only
> display one ROI at a time.
>
> Up to now in ImageJ it is possible to simultaneously display all the
> ROIs
in
> the ROI Manager with the "Show All" feature together (=
> simultaneously)
with
> a selection and a ROI.
> Now let's say you have a couple hundred of ROIs within the ROI
> Manager,
and
> you want then select several tens of them is order to apply a logical
> combination (OR, XOR, AND)...
> Today this is a quite difficult task unless of course there is an easy
> solution that I may be missing.
> What I'm thinking about is a code similar to what is running behind
> the "Show All" feature as soon as you select more than a ROI within
> the ROI Manager.
> Only the first ROI is drawn as up selection, but behind you see all
> the other selected ones and this selection is of course as well
> ignored in the case the "Show All" CheckBox is set to "true".
>
> I thank you very much in advance for your answer and work on this.
> Have a nice day,
> Philippe
>
> --
> 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
www.ibmp.cnrs.fr
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html