Login  Register

Re: A couple/several of issues about the ROI Manager

Posted by Rasband, Wayne (NIH/NIMH) [E] on Feb 19, 2015; 6:30pm
URL: http://imagej.273.s1.nabble.com/A-couple-several-of-issues-about-the-ROI-Manager-tp5011456p5011699.html

On Feb 18, 2015, at 4:58 AM, Philippe CARL <[hidden email]> wrote:

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

These problems should be fixed in the latest daily build (1.49p17).

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

The following JavaScript code highlights selected ROIs in “Show All” mode. Selected ROIs are drawn in cyan with a stroke width of 2 and all others are drawn in the default ROI color and stroke width. This code requires the latest daily build, which adds the RoiManager.isSelected() method.

-wayne

   rm = RoiManager.getInstance();
   for (i=0; i<rm.getCount(); i++) {
     roi = rm.getRoi(i);
     if (rm.isSelected(i)) {
        roi.setStrokeWidth(2);
        roi.setStrokeColor(Color.cyan);
     } else {
        roi.setStrokeWidth(0);
        roi.setStrokeColor(Roi.getColor());
    }
  }
  rm.runCommand("Show All");




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