MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / updateTableOverlay

Method updateTableOverlay

ij/src/main/java/ij/gui/Overlay.java:503–532  ·  view source on GitHub ↗

Updates overlays created by the particle analyzer after rows are deleted from the Results table.

(ImagePlus imp, int first, int last, int tableSize)

Source from the content-addressed store, hash-verified

501 /** Updates overlays created by the particle analyzer
502 after rows are deleted from the Results table. */
503 public static void updateTableOverlay(ImagePlus imp, int first, int last, int tableSize) {
504 if (imp==null)
505 return;
506 Overlay overlay = imp.getOverlay();
507 if (overlay==null)
508 return;
509 if (overlay.size()!=tableSize)
510 return;
511 if (first<0)
512 first = 0;
513 if (last>tableSize-1)
514 last = tableSize-1;
515 if (first>last)
516 return;
517 String name1 = overlay.get(0).getName();
518 String name2 = overlay.get(overlay.size()-1).getName();
519 if (!"1".equals(name1) || !(""+tableSize).equals(name2))
520 return;
521 int count = last-first+1;
522 if (overlay.size()==count && !IJ.isMacro()) {
523 if (count==1 || IJ.showMessageWithCancel("ImageJ", "Delete "+overlay.size()+" element overlay? "))
524 imp.setOverlay(null);
525 return;
526 }
527 for (int i=0; i<count; i++)
528 overlay.remove(first);
529 for (int i=first; i<overlay.size(); i++)
530 overlay.get(i).setName(""+(i+1));
531 imp.draw();
532 }
533
534 public static Overlay createStackOverlay(Roi[] rois) {
535 Overlay overlay = new Overlay();

Callers 3

deleteRowsMethod · 0.95
deleteRowsMethod · 0.95
clearSelectionMethod · 0.95

Calls 11

sizeMethod · 0.95
getMethod · 0.95
isMacroMethod · 0.95
showMessageWithCancelMethod · 0.95
removeMethod · 0.95
getNameMethod · 0.65
getOverlayMethod · 0.45
equalsMethod · 0.45
setOverlayMethod · 0.45
setNameMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected