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

Method crop

ij/src/main/java/ij/gui/Overlay.java:229–246  ·  view source on GitHub ↗
(Rectangle bounds)

Source from the content-addressed store, hash-verified

227 * Author: Marcel Boeglin
228 */
229 public Overlay crop(Rectangle bounds) {
230 if (bounds==null)
231 return duplicate();
232 Overlay overlay2 = create();
233 Roi[] allRois = toArray();
234 for (Roi roi: allRois) {
235 Rectangle roiBounds = roi.getBounds();
236 if (roiBounds.width==0) roiBounds.width=1;
237 if (roiBounds.height==0) roiBounds.height=1;
238 if (bounds.intersects(roiBounds))
239 overlay2.add((Roi)roi.clone());
240 }
241 int dx = bounds.x>0?bounds.x:0;
242 int dy = bounds.y>0?bounds.y:0;
243 if (dx>0 || dy>0)
244 overlay2.translate(-dx, -dy);
245 return overlay2;
246 }
247
248 /** Removes ROIs having positions outside of the
249 * interval defined by firstSlice and lastSlice.

Callers 10

reduceMethod · 0.95
runMethod · 0.95
runMethod · 0.95
cropMethod · 0.95
runMethod · 0.95
convertHyperstackMethod · 0.95
compositeImageToRGBMethod · 0.95
createNewStackMethod · 0.95
scaleMethod · 0.95
runMethod · 0.95

Calls 15

duplicateMethod · 0.95
createMethod · 0.95
toArrayMethod · 0.95
addMethod · 0.95
translateMethod · 0.95
sizeMethod · 0.95
getMethod · 0.95
getPositionMethod · 0.95
removeMethod · 0.95
setPositionMethod · 0.95
getCPositionMethod · 0.95
getZPositionMethod · 0.95

Tested by

no test coverage detected