Hi Fred,

the newest sources of ImageJ are on github; this is where I usually look up things.

https://github.com/imagej/ImageJ/commits/master/ij/plugin/frame/RoiManager.java

The history says:
  2024.09.10 (1.54k21; RoiManager.delete)

Michael
________________________________________________________________

On 22.01.26 21:25, Fred Damen wrote:
Greetings Michael,

Has this delete method been recently added? As of this posting I do not
find it:
google: imagej java RoiManager
...
https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html

google: imagej java RoiManager java2html
...
https://imagej.net/ij/developer/source/ij/plugin/frame/RoiManager.java.html
shows method deleteOnEDT, albeit private.

Is this a possible implementation of the solution to my previous problem
of having to wait for the ImagePlus.show to complete?

      // Delete ROI on event dispatch thread
      private void deleteOnEDT(final int i) {
         try {
             EventQueue.invokeAndWait(new Runnable() {
                 public void run() {
                     rois.remove(i);
                     listModel.remove(i);
                 }
             });
         } catch (
             Exception e) {
         }
     }

Thanks again,

Fred

On Thu, January 22, 2026 2:49 am, Michael Schmid wrote:
On 22.01.26 01:58, Fred Damen wrote:
...

Question: from Java, how can an Roi be deleted from the RoiManager
without
the Roi being attached to an ImagePlus? A delete method would be nice,
as
select(ing) the Roi in this case is a side-effect headache and is
superfluous.

Hi Fred,

RoiManager has a method
    public void delete(int index)
    /** Deletes the ROI at 'index' and updates the display. */

Michael

--
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 via email to