protected void hideRois() { if (currentImage == null) return; currentImage.killRoi(); if (currentImage.isVisible()) { currentImage.updateAndDraw(); ImageUtils.removeScrollListener(currentImage, this, this); } currentImage = null; }
public void mergeSelectedObjects() { this.populatingObjects = true; HashMap<Integer, ArrayList<Object3DGui>> allObjects = getSplitSelection(); for (int channelIdx : allObjects.keySet()) { ArrayList<Object3DGui> objects = allObjects.get(channelIdx); if (objects != null && objects.size() >= 2) { Collections.sort(objects); Object3DGui o1 = objects.get(0); for (int i = objects.size() - 1; i > 0; i--) { Object3DGui o2 = objects.get(i); o1.merge(o2); listModel.removeElement(o2); // IJ.log("merge:"+o1.getName()+ "::"+objects.get(i).getName()+ " channel:"+channelIdx); } o1.getChannel().createObjects(); if (autoSave) o1.getChannel().saveOutput(); ImagePlus img = o1.getChannel().getSegmented().getImagePlus(); if (img.isVisible()) { img.updateAndDraw(); } } } this.populatingObjects = false; }
public void deleteSelectedObjects() { populatingObjects = true; try { boolean[] modif = new boolean[currentChannels.length]; for (Object o : this.list.getSelectedValues()) { listModel.removeElement(o); modif[getChannelRank(((Object3DGui) o).getChannel())] = true; ((Object3DGui) o).delete(true); } for (int i = 0; i < currentChannels.length; i++) { if (modif[i]) { ImagePlus img = currentChannels[i].getSegmented().getImagePlus(); if (img.isVisible()) { img.updateAndDraw(); } currentChannels[i].createObjects(); if (autoSave) currentChannels[i].saveOutput(); } } } catch (Exception e) { exceptionPrinter.print(e, "", Core.GUIMode); } populatingObjects = false; }