@Override public void addOverlays(final ImageDisplay display, final List<? extends Overlay> overlays) { for (final Overlay overlay : overlays) { display.display(overlay); } }
@Override public ThresholdOverlay getThreshold(final ImageDisplay display) { ThresholdOverlay overlay = thresholdMap().get(display); if (overlay == null) { final Dataset dataset = displayService.getActiveDataset(display); if (dataset == null) { throw new IllegalArgumentException( "expected ImageDisplay to have active dataset"); } overlay = new ThresholdOverlay(getContext(), dataset); thresholdMap().put(display, overlay); display.display(overlay); // NOTE - the call on prev line did a rebuild() but not necessarily an // update(). So graphics might not be up to date! This may be a bug in // display code. Anyhow this next line makes sure that the display is // updated. This fixes the problem where you adjust threshold and in // dialog you delete the thresh and then go into min or max field and make // a change. Correct behavior is for new thresh to immediately appear. // Without this update() call the thresh overlay exists but doesn't get // displayed. display.update(); // TEMP HACK } return overlay; }
private void makeCompositeOverlay(CompositeOverlay.Operation op) { ImageDisplay imageDisplay = imageDisplayService.getActiveImageDisplay(); if (imageDisplay == null) return; List<Overlay> overlays = overlayService.getOverlayInfo().selectedOverlays(); if (overlays.size() == 0) overlays = overlayService.getOverlays(imageDisplay); if (overlays.size() < 2) { JOptionPane.showMessageDialog(this, "This command only works with 2 or more overlays"); return; } // else overlays.size() >= 2 CompositeOverlay newOverlay = new CompositeOverlay(context); for (Overlay o : overlays) newOverlay.doOperation(op, o); imageDisplay.display(newOverlay); imageDisplay.update(); }
@Override public void divideCompositeOverlay(final CompositeOverlay overlay) { final List<Overlay> subcomponents = overlay.getSubcomponents(); // to each display that owns the composite // reference the original overlays (if not already) final List<ImageDisplay> owners = getDisplays(overlay); for (final ImageDisplay owner : owners) { boolean changes = false; final List<Overlay> displayOverlays = getOverlays(owner); for (final Overlay subcomponent : subcomponents) { if (!displayOverlays.contains(subcomponent)) { owner.display(subcomponent); changes = true; } } if (changes) owner.update(); } // delete the composite overlay removeOverlay(overlay); }
imageDisplay.display(d);