MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / setBounds

Method setBounds

ij/src/main/java/ij/gui/Roi.java:543–552  ·  view source on GitHub ↗

Sets the bounds of rectangular, oval or text selections. Note that for these types, subpixel resolution is ignored, and the x,y values are rounded down, the width and height values rounded up. Do not use for other ROI types since their width and height are results of a calculation. For translat

(Rectangle2D.Double b)

Source from the content-addressed store, hash-verified

541 * a calculation.
542 * For translating ROIs, use setLocation. */
543 public void setBounds(Rectangle2D.Double b) {
544 if (!(type==RECTANGLE||type==OVAL||(this instanceof TextRoi)))
545 return;
546 this.x = (int)b.x;
547 this.y = (int)b.y;
548 this.width = (int)Math.ceil(b.width);
549 this.height = (int)Math.ceil(b.height);
550 bounds = new Rectangle2D.Double(b.x, b.y, b.width, b.height);
551 cachedMask = null;
552 }
553
554 /** Sets the integer boundaries x, y, width, height from given sub-pixel
555 * boundaries, such that all points are within the integer bounding rectangle.

Callers 4

TextRoiMethod · 0.45
updateBoundsMethod · 0.45
setLocationAndSizeMethod · 0.45
zoomMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected