int getHandleSize() { double mag = ic!=null?ic.getMagnification():1.0; double size = HANDLE_SIZE/mag; return (int)(size*mag); }
int getHandleSize() { double mag = ic!=null?ic.getMagnification():1.0; double size = HANDLE_SIZE/mag; return (int)(size*mag); }
/** Store srcRect and Magnification of the currently active ImageCanvas ic */ private void storeCanvasState(ImageCanvas ic) { currentMag = ic.getMagnification(); currentSrcRect = new Rectangle(ic.getSrcRect()); }
/** Store srcRect and Magnification of the currently active ImageCanvas ic */ private void storeCanvasState(ImageCanvas ic) { currentMag = ic.getMagnification(); currentSrcRect = new Rectangle(ic.getSrcRect()); }
public void fitSpline() { double length = getUncalibratedLength(); int evaluationPoints = (int)(length/2.0); if (ic!=null) { double mag = ic.getMagnification(); if (mag<1.0) evaluationPoints *= mag;; } if (evaluationPoints<100) evaluationPoints = 100; fitSpline(evaluationPoints); }
public void fitSpline() { double length = getUncalibratedLength(); int evaluationPoints = (int)(length/2.0); if (ic!=null) { double mag = ic.getMagnification(); if (mag<1.0) evaluationPoints *= mag;; } if (evaluationPoints<100) evaluationPoints = 100; fitSpline(evaluationPoints); }
public void draw( Graphics g ) { g.setColor( Color.MAGENTA ); int real_side = (int)( side * c.getMagnification() ); g.fillRect( c.screenX(top_left_x), c.screenY(top_left_y), real_side, real_side ); g.setColor( Color.BLUE ); g.fillRect( c.screenX(top_left_x)+1, c.screenY(top_left_y)+1, real_side-2, real_side-2 ); }
/** Override Container getInsets() to make room for some text above the image. */ public Insets getInsets() { Insets insets = super.getInsets(); if (imp==null) return insets; double mag = ic.getMagnification(); int extraWidth = (int)((MIN_WIDTH - imp.getWidth()*mag)/2.0); if (extraWidth<0) extraWidth = 0; int extraHeight = (int)((MIN_HEIGHT - imp.getHeight()*mag)/2.0); if (extraHeight<0) extraHeight = 0; insets = new Insets(insets.top+textGap+extraHeight, insets.left+extraWidth, insets.bottom+extraHeight, insets.right+extraWidth); return insets; }
/** Override Container getInsets() to make room for some text above the image. */ public Insets getInsets() { Insets insets = super.getInsets(); if (imp==null) return insets; double mag = ic.getMagnification(); int extraWidth = (int)((MIN_WIDTH - imp.getWidth()*mag)/2.0); if (extraWidth<0) extraWidth = 0; int extraHeight = (int)((MIN_HEIGHT - imp.getHeight()*mag)/2.0); if (extraHeight<0) extraHeight = 0; insets = new Insets(insets.top+textGap+extraHeight, insets.left+extraWidth, insets.bottom+extraHeight, insets.right+extraWidth); return insets; }
double getZoom() { interp.getParens(); ImagePlus imp = getImage(); ImageCanvas ic = imp.getCanvas(); if (ic==null) {interp.error("Image not displayed"); return 0.0;} else return ic.getMagnification(); }
public void draw(Graphics g) { super.draw(g); if (!overlay && ic!=null) { double mag = ic.getMagnification(); int size2 = HANDLE_SIZE/2; for (int i=0; i<4; i++) { if (i==3) //mark starting point handleColor = strokeColor!=null?strokeColor:ROIColor; else handleColor=Color.white; drawHandle(g, hxs(i)-size2, hys(i)-size2); } } }
double getZoom() { interp.getParens(); ImagePlus imp = getImage(); ImageCanvas ic = imp.getCanvas(); if (ic==null) {interp.error("Image not displayed"); return 0.0;} else return ic.getMagnification(); }
protected BasicStroke getScaledStroke() { if (ic==null) return stroke; double mag = ic.getMagnification(); if (mag!=1.0) { float width = (float)(stroke.getLineWidth()*mag); //return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); return new BasicStroke(width, stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()); } else return stroke; }
protected BasicStroke getScaledStroke() { if (ic==null) return stroke; double mag = ic.getMagnification(); if (mag!=1.0) { float width = (float)(stroke.getLineWidth()*mag); //return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); return new BasicStroke(width, stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()); } else return stroke; }
/** 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); } }
/** 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); } }
/** Nudge end point of line by one pixel. */ public void nudgeCorner(int key) { if (ic==null) return; double inc = 1.0/ic.getMagnification(); switch(key) { case KeyEvent.VK_UP: y2R-=inc; break; case KeyEvent.VK_DOWN: y2R+=inc; break; case KeyEvent.VK_LEFT: x2R-=inc; break; case KeyEvent.VK_RIGHT: x2R+=inc; break; } grow(ic.screenXD(x+x2R), ic.screenYD(y+y2R)); notifyListeners(RoiListener.MOVED); showStatus(); }
/** Nudge end point of line by one pixel. */ public void nudgeCorner(int key) { if (ic==null) return; double inc = 1.0/ic.getMagnification(); switch(key) { case KeyEvent.VK_UP: y2R-=inc; break; case KeyEvent.VK_DOWN: y2R+=inc; break; case KeyEvent.VK_LEFT: x2R-=inc; break; case KeyEvent.VK_RIGHT: x2R+=inc; break; } grow(ic.screenXD(x+x2R), ic.screenYD(y+y2R)); notifyListeners(RoiListener.MOVED); showStatus(); }
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; }