private ShapeRoi combineRois(final ShapeRoi base, final ShapeRoi sr, final MaskOperator op) { if (op == Operators.AND) return base.and(sr); else if (op == Operators.OR) return base.or(sr); else if (op == Operators.MINUS) return base.not(sr); else if (op == Operators.XOR) return base.xor(sr); else throw new IllegalArgumentException("Unsupported Operation"); }
void invert(ImagePlus imp) { Roi roi = imp.getRoi(); if (roi==null || !roi.isArea()) {IJ.error("Inverse", "Area selection required"); return;} ShapeRoi s1, s2; if (roi instanceof ShapeRoi) s1 = (ShapeRoi)roi; else s1 = new ShapeRoi(roi); s2 = new ShapeRoi(new Roi(0,0, imp.getWidth(), imp.getHeight())); Undo.setup(Undo.ROI, imp); imp.setRoi(s1.xor(s2)); }
void invert(ImagePlus imp) { Roi roi = imp.getRoi(); if (roi==null || !roi.isArea()) {IJ.error("Inverse", "Area selection required"); return;} ShapeRoi s1, s2; if (roi instanceof ShapeRoi) s1 = (ShapeRoi)roi; else s1 = new ShapeRoi(roi); s2 = new ShapeRoi(new Roi(0,0, imp.getWidth(), imp.getHeight())); Undo.setup(Undo.ROI, imp); imp.setRoi(s1.xor(s2)); }
/** Fills outside an Roi. */ public void fillOutside(Roi roi) { if (roi==null || !roi.isArea()) return; ImageProcessor m = getMask(); Rectangle r = getRoi(); ShapeRoi s1, s2; if (roi instanceof ShapeRoi) s1 = (ShapeRoi)roi; else s1 = new ShapeRoi(roi); s2 = new ShapeRoi(new Roi(0,0, width, height)); setRoi(s1.xor(s2)); fill(getMask()); setMask(m); setRoi(r); }
s2 = new ShapeRoi(roi); if (s2==null) continue; s1.xor(s2);
/** Fills outside an Roi. */ public void fillOutside(Roi roi) { if (roi==null || !roi.isArea()) return; ImageProcessor m = getMask(); Rectangle r = getRoi(); ShapeRoi s1, s2; if (roi instanceof ShapeRoi) s1 = (ShapeRoi)roi; else s1 = new ShapeRoi(roi); s2 = new ShapeRoi(new Roi(0,0, width, height)); setRoi(s1.xor(s2)); fill(getMask()); setMask(m); setRoi(r); }
s2 = new ShapeRoi(roi); if (s2==null) continue; s1.xor(s2);