/** Returns the ImageCanvas being used to display this image, or null. */ public ImageCanvas getCanvas() { return win!=null?win.getCanvas():flatteningCanvas; }
/** Returns the ImageCanvas being used to display this image, or null. */ public ImageCanvas getCanvas() { return win!=null?win.getCanvas():flatteningCanvas; }
/** Draws the image. If there is an ROI, its outline is also displayed. Does nothing if there is no window associated with this image (i.e. show() has not been called).*/ public void draw(){ if (win!=null) win.getCanvas().repaint(); }
public ImageCanvas getImageCanvas(ComponentEvent e) { Component component = e.getComponent(); return component instanceof ImageCanvas ? (ImageCanvas)component : (component instanceof ImageWindow ? ((ImageWindow)component).getCanvas() : null); }
/** Draws the image. If there is an ROI, its outline is also displayed. Does nothing if there is no window associated with this image (i.e. show() has not been called).*/ public void draw(){ if (win!=null) win.getCanvas().repaint(); }
/** * Method mouse moved, show the coordinates of the mouse pointer. * * @param e mouse event */ public void mouseMoved (final MouseEvent e) { setControl(); final int x = mainImp.getWindow().getCanvas().offScreenX(e.getX()); final int y = mainImp.getWindow().getCanvas().offScreenY(e.getY()); IJ.showStatus(mainImp.getLocationAsString(x, y) + getValueAsString(x, y)); } /* end mouseMoved */
/** Moves and resizes this window. Changes the magnification so the image fills the window. */ public void setLocationAndSize(int x, int y, int width, int height) { setBounds(x, y, width, height); getCanvas().fitToWindow(); pack(); }
/** Moves and resizes this window. Changes the magnification so the image fills the window. */ public void setLocationAndSize(int x, int y, int width, int height) { setBounds(x, y, width, height); getCanvas().fitToWindow(); pack(); }
private void addImageListeners() { imp.addImageListener(this); ImageWindow win = imp.getWindow(); if (win == null) close(); canvas = win.getCanvas(); canvas.addKeyListener(this); }
private void addImageListeners() { imp.addImageListener(this); ImageWindow win = imp.getWindow(); if (win == null) close(); canvas = win.getCanvas(); canvas.addKeyListener(this); }
/** Draws image and roi outline using a clip rect. */ public void draw(int x, int y, int width, int height){ if (win!=null) { ImageCanvas ic = win.getCanvas(); double mag = ic.getMagnification(); x = ic.screenX(x); y = ic.screenY(y); width = (int)(width*mag); height = (int)(height*mag); ic.repaint(x, y, width, height); if (listeners.size()>0 && roi!=null && roi.getPasteMode()!=Roi.NOT_PASTING) notifyListeners(UPDATED); } }
public void setImage(ImagePlus imp2) { ImageCanvas ic = getCanvas(); if (ic==null || imp2==null) return; imp = imp2; imp.setWindow(this); ic.updateImage(imp); ic.setImageUpdated(); ic.repaint(); repaint(); }
/** Draws image and roi outline using a clip rect. */ public void draw(int x, int y, int width, int height){ if (win!=null) { ImageCanvas ic = win.getCanvas(); double mag = ic.getMagnification(); x = ic.screenX(x); y = ic.screenY(y); width = (int)(width*mag); height = (int)(height*mag); ic.repaint(x, y, width, height); if (listeners.size()>0 && roi!=null && roi.getPasteMode()!=Roi.NOT_PASTING) notifyListeners(UPDATED); } }
@Override public void mouseMoved(MouseEvent e) { ImageWindow window = getImageWindow(e); if (window == null) return; ImagePlus image = getImagePlus(e); if (image == null) return; ImageCanvas canvas = window.getCanvas(); if (getHandle(image.getRoi(), e.getX(), e.getY()) < 0) canvas.setCursor(originalCursor); else canvas.setCursor(handCursor); window.mouseMoved(getOffscreenX(e), getOffscreenY(e)); e.consume(); }
public void setImage(ImagePlus imp2) { ImageCanvas ic = getCanvas(); if (ic==null || imp2==null) return; imp = imp2; imp.setWindow(this); ic.updateImage(imp); ic.setImageUpdated(); ic.repaint(); repaint(); }
public static void setKeyUp(int key) { if (debugMode) IJ.log("setKeyUp: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1,-1); break; case ALL_KEYS: shiftDown=controlDown=altDown=spaceDown=false; break; } }
public static void setKeyUp(int key) { if (debugMode) IJ.log("setKeyUp: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1,-1); break; case ALL_KEYS: shiftDown=controlDown=altDown=spaceDown=false; break; } }
public RotatedRectRoi(int sx, int sy, ImagePlus imp) { super(sx, sy, imp); type = FREEROI; xstart = ic.offScreenXD(sx); ystart = ic.offScreenYD(sy); ImageWindow win = imp.getWindow(); int pixels = win!=null?(int)(win.getSize().height/win.getCanvas().getMagnification()):imp.getHeight(); if (IJ.debugMode) IJ.log("RotatedRectRoi: "+(int)rectWidth+" "+pixels); if (rectWidth>pixels) rectWidth = pixels/3; setDrawOffset(false); bounds = null; }
public RotatedRectRoi(int sx, int sy, ImagePlus imp) { super(sx, sy, imp); type = FREEROI; xstart = ic.offScreenXD(sx); ystart = ic.offScreenYD(sy); ImageWindow win = imp.getWindow(); int pixels = win!=null?(int)(win.getSize().height/win.getCanvas().getMagnification()):imp.getHeight(); if (IJ.debugMode) IJ.log("RotatedRectRoi: "+(int)rectWidth+" "+pixels); if (rectWidth>pixels) rectWidth = pixels/3; setDrawOffset(false); bounds = null; }
private void doRotation() { ImageStack stack = imp.getStack(); flow = new FlowJFlow(stack.getWidth(), stack.getHeight()); xError = getIntField(xField); yError = getIntField(yField); flow.createRotation(xError, yError, -5 * (float) Math.PI / 180, getRoi()); ((FlowJCanvas) win.getCanvas()).setDisplayed(flow); description = "rotation field"; fastDisplay(); } private void doCentralImage()