/** * @deprecated * replaced by getBounds() */ public Rectangle getBoundingRect() { return getBounds(); }
/** Returns the index of the range arrow at cursor position x,y, or -1 of none. * Index numbers start with 0 at the 'down' arrow of the lower side of the x axis * and end with the up arrow at the upper side of the y axis. */ int getRangeArrowIndex(int x, int y) { if (!rangeArrowsVisible) return -1; for (int i=0; i<rangeArrowRois.length; i++) if (rangeArrowRois[i].getBounds().contains(x,y)) return i; return -1; }
/** Returns the index of the range arrow at cursor position x,y, or -1 of none. * Index numbers start with 0 at the 'down' arrow of the lower side of the x axis * and end with the up arrow at the upper side of the y axis. */ int getRangeArrowIndex(int x, int y) { if (!rangeArrowsVisible) return -1; for (int i=0; i<rangeArrowRois.length; i++) if (rangeArrowRois[i].getBounds().contains(x,y)) return i; return -1; }
@Override public long max(final int d) { if (d != 0 && d != 1) throw new IllegalArgumentException( "Invalid dimension " + d); final Rectangle r = roi.getBounds(); return d == 0 ? r.x + r.width : r.y + r.height; }
protected String getROILabel(int slice, int sliceCount, Roi roi) { int digits = (int)Math.ceil(Math.log(Math.max(1, sliceCount)) / Math.log(10)) + 1; String format = "%0" + digits + "d"; Rectangle bounds = roi.getBounds(); return String.format(format + "-" + format + "-" + format, slice, bounds.x, bounds.y); }
void addToRoiManager(int sliceNumber, Roi roi) { int x = roi.getBounds().x, y = roi.getBounds().y; int max = Math.max(sliceNumber, Math.max(x, y)); int digits = (int)Math.ceil(Math.log10(max)); digits = Math.max(4, digits); String format = "%0" + digits + "d"; String label = String.format(format + "-" + format + "-" + format, sliceNumber, x, y); roiManager.getList().add(label); roiManager.getROIs().put(label, roi); }
private HashMap<String,Object> getImageInfo(ImagePlus img) { HashMap<String,Object> info = new HashMap<String,Object>(); info.put("title", img.getTitle()); info.put("roiBounds", img.getRoi() == null ? null : img.getRoi().getBounds()); return info; }
void drawLabel(ImageProcessor ip) { int count = Analyzer.getCounter(); if (count>0 && roi!=null) drawLabel(imp, ip, count, roi.getBounds()); }
public void saveRoi() { if (null != roi) { roi.endPaste(); Rectangle r = roi.getBounds(); if (r.width>0 && r.height>0) { Roi.previousRoi = (Roi)roi.clone(); } } }
public static void labelROI(Roi roi, ImageProcessor ip, int color){ Rectangle bounds = roi.getBounds(); for(int i=bounds.x;i<=bounds.x+bounds.width;i++){ for(int j=bounds.y;j<=bounds.y+bounds.height;j++){ if(roi.contains(i,j)) ip.set(i,j,color); } } }
void drawFilledParticle(ImageProcessor ip, Roi roi, ImageProcessor mask) { ip.setRoi(roi.getBounds()); ip.fill(mask); }
/** Checks whether two rectangles are equal. */ public boolean equals(Object obj) { if (obj instanceof Roi) { Roi roi2 = (Roi)obj; if (type!=roi2.getType()) return false; if (!getBounds().equals(roi2.getBounds())) return false; if (getLength()!=roi2.getLength()) return false; return true; } else return false; }
/** Checks whether two rectangles are equal. */ public boolean equals(Object obj) { if (obj instanceof Roi) { Roi roi2 = (Roi)obj; if (type!=roi2.getType()) return false; if (!getBounds().equals(roi2.getBounds())) return false; if (getLength()!=roi2.getLength()) return false; return true; } else return false; }
void drawLabel(ImageProcessor ip) { int count = Analyzer.getCounter(); if (count>0 && roi!=null) drawLabel(imp, ip, count, roi.getBounds()); }
public void saveRoi() { Roi roi2 = roi; if (roi2!=null) { roi2.endPaste(); Rectangle r = roi2.getBounds(); if ((r.width>0 || r.height>0)) { Roi.previousRoi = (Roi)roi2.clone(); if (IJ.debugMode) IJ.log("saveRoi: "+roi2); } } }
public RoiStatistics(Roi roi) { Rectangle bounds = roi.getBounds(); ImageProcessor mask = roi.getMask(); if (mask == null) accumulator = new RectangleAccumulator(bounds); else accumulator = new GenericAccumulator(bounds.x, bounds.y, (ByteProcessor)mask); }
void drawRoiFilledParticle(ImageProcessor ip, Roi roi, ImageProcessor mask, int count) { int grayLevel = (count < 65535) ? count : 65535; ip.setValue((double) grayLevel); ip.setRoi(roi.getBounds()); ip.fill(mask); }
public static void threshold(Roi roi, int min, int max, ImageProcessor imageData, ImageProcessor labelData, int label) { mem = new Mem(labelData); Rectangle bounds = roi.getBounds(); for (int x = bounds.x; x <= bounds.x + bounds.width; x++) { for (int y = bounds.y; y <= bounds.y + bounds.height; y++) { if (roi.contains(x,y) && imageData.get(x, y) >= min && imageData.get(x, y) <= max) { mem.rememberPixel(x,y); labelData.set(x, y, label); } } } }
private FloatProcessor getRoiProcessor(ImagePlus imp, Roi roi, int index) { ImageProcessor ip = imp.getStack().getProcessor(index); ip.setRoi(roi.getBounds()); FloatProcessor fp = subtract(ip.crop().convertToFloatProcessor(), (float) CameraSetupPlugIn.getOffset()); float minVal = VectorMath.min((float[]) fp.getPixels()); if(minVal < 0) { IJ.log("\\Update:Camera base level is set higher than values in the image!"); fp = add(-minVal, fp); } fp.setMask(roi.getMask()); return fp; }