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

Method getInverse

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

Returns the inverted roi, or null if this is not an area roi or cannot be converted to a ShapeRoi. If imp is not given, assumes a rectangle of size 2e9 2e9 for the boundary.

(ImagePlus imp)

Source from the content-addressed store, hash-verified

1578 /** Returns the inverted roi, or null if this is not an area roi or cannot be converted to a ShapeRoi.
1579 * If imp is not given, assumes a rectangle of size 2e9*2e9 for the boundary. */
1580 public Roi getInverse(ImagePlus imp) {
1581 if (!isArea()) return null;
1582 Roi fullImage = (imp == null) ? new Roi(0,0, 2000000000, 2000000000) : new Roi(0,0, imp.getWidth(), imp.getHeight());
1583 ShapeRoi s = (this instanceof ShapeRoi) ? (ShapeRoi)(this.clone()) : new ShapeRoi(this);
1584 if (s == null) return null;
1585 ShapeRoi inverse = s.xor(new ShapeRoi(fullImage));
1586 return inverse.trySimplify();
1587 }
1588
1589 /** Returns a handle number if the specified screen coordinates are
1590 inside or near a handle, otherwise returns -1. */

Callers 1

invertMethod · 0.95

Calls 6

isAreaMethod · 0.95
cloneMethod · 0.95
xorMethod · 0.95
trySimplifyMethod · 0.95
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected