@Override public void imageOpened(ImagePlus ip) { //when a new image is opened in the environement we need to listen to it gaining foces ip.getWindow().addWindowFocusListener(this); }
@Override public void imageOpened(ImagePlus ip) { //when a new image is opened in the environement we need to listen to it gaining foces ip.getWindow().addWindowFocusListener(this); }
protected void registerTool(ImagePlus image) { if (image == null) return; if (sliceListener != null) sliceObservers.add(new SliceObserver(image, new SliceListener() { public final void sliceChanged(ImagePlus image) { if (maybeUnregister()) return; if (isThisTool()) sliceListener.sliceChanged(image); } })); if (image.getCanvas() != null) registerTool(image.getCanvas()); ImageWindow window = image.getWindow(); if (window != null) { window.addWindowFocusListener(this); if (keyProxy != null) addKeyListener(window); addMouseWheelListener(window); } }
private void loadLabels(ImagePlus labelImage) { labelImage.hide();//don't want the extra one visible to the user new SegmentatorModel(currentImage).setLabelImagePlus(labelImage); AmiraParameters params = new AmiraParameters(labelImage); populateLabelList(params); SegmentationViewerCanvas canvas = new SegmentationViewerCanvas(currentImage, labelImage); new SegmentatorModel(currentImage).setLabelCanvas(canvas); if (currentImage.getStackSize() > 1) new StackWindow(currentImage, canvas); else new ImageWindow(currentImage, canvas); //after a new window is constructed. the old one is //cloased and the listener tidied up //so we need to make sure we add a new one //we do not need to do this for ROIs becuase //they work by polling new SliceWatcher(currentImage).addSliceListener(this); currentImage.getWindow().addWindowFocusListener(this); //new RoiWatcher(currentImage).addRoiListener(this); }
currentImage.getWindow().addWindowFocusListener(this);