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

Method setIntBounds

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

Sets the integer boundaries x, y, width, height from given sub-pixel boundaries, such that all points are within the integer bounding rectangle. For open line selections and (multi)Point Rois, note that integer Roi coordinates correspond to the center of the 1x1 rectangle enclosing a pixel. Poin

(Rectangle2D.Double bounds)

Source from the content-addressed store, hash-verified

560 * screen at high zoom levels. (For lines and points, it should include all
561 * pixels affected by 'draw' */
562 void setIntBounds(Rectangle2D.Double bounds) {
563 if (useLineSubpixelConvention()) { //for PointRois & open lines, ensure the 'draw' area is enclosed
564 x = (int)Math.floor(bounds.x + 0.5);
565 y = (int)Math.floor(bounds.y + 0.5);
566 width = (int)Math.floor(bounds.x + bounds.width + 1.5) - x;
567 height = (int)Math.floor(bounds.y + bounds.height + 1.5) - y;
568 } else { //for area Rois, the subpixel bounds must be enclosed in the int bounds
569 x = (int)Math.floor(bounds.x);
570 y = (int)Math.floor(bounds.y);
571 width = (int)Math.ceil(bounds.x + bounds.width) - x;
572 height = (int)Math.ceil(bounds.y + bounds.height) - y;
573 }
574 }
575
576 /**
577 * @deprecated

Callers 5

setLocationMethod · 0.95
finishPolygonMethod · 0.80
updateCoordinatesMethod · 0.80

Calls 1

Tested by

no test coverage detected