Updates overlays created by the particle analyzer after rows are deleted from the Results table.
(ImagePlus imp, int first, int last, int tableSize)
| 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(); |
no test coverage detected