public void setThreshold(double minThreshold, double maxThreshold, int lutUpdate) { super.setThreshold(minThreshold, maxThreshold, lutUpdate); if (this.minThreshold<0.0 && this.minThreshold!=NO_THRESHOLD) this.minThreshold = 0.0; if (this.maxThreshold>255.0) this.maxThreshold = 255.0; }
public void setThreshold(double minThreshold, double maxThreshold, int lutUpdate) { super.setThreshold(minThreshold, maxThreshold, lutUpdate); if (this.minThreshold<0.0 && this.minThreshold!=NO_THRESHOLD) this.minThreshold = 0.0; if (this.maxThreshold>255.0) this.maxThreshold = 255.0; }
void setThreshold(ImageProcessor ip) { if (!(ip instanceof ByteProcessor)) return; if (((ByteProcessor)ip).isInvertedLut()) ip.setThreshold(max, 255, ImageProcessor.NO_LUT_UPDATE); else ip.setThreshold(0, max, ImageProcessor.NO_LUT_UPDATE); }
void setThreshold(ImageProcessor ip) { if (!(ip instanceof ByteProcessor)) return; if (((ByteProcessor)ip).isInvertedLut()) ip.setThreshold(max, 255, ImageProcessor.NO_LUT_UPDATE); else ip.setThreshold(0, max, ImageProcessor.NO_LUT_UPDATE); }
public void setThreshold(double minThreshold, double maxThreshold, int lutUpdate) { record("setThreshold", new Object[] {new Double(minThreshold), new Double(maxThreshold), new Integer(lutUpdate)}, new Class[] {double.class, double.class, int.class}); proc.setThreshold(minThreshold, maxThreshold, lutUpdate); }
public void setBinaryThreshold() { //ij.IJ.log("setMaskThreshold1"); if (!(this instanceof ByteProcessor)) return; double t1=255.0, t2=255.0; boolean invertedLut = isInvertedLut(); if ((invertedLut&&ij.Prefs.blackBackground) || (!invertedLut&&!ij.Prefs.blackBackground)) { t1 = 0.0; t2 = 0.0; } //ij.IJ.log("setMaskThreshold2 "+t1+" "+t2); setThreshold(t1, t2, ImageProcessor.NO_LUT_UPDATE); }
public void setBinaryThreshold() { //ij.IJ.log("setMaskThreshold1"); if (!(this instanceof ByteProcessor)) return; double t1=255.0, t2=255.0; boolean invertedLut = isInvertedLut(); if ((invertedLut&&ij.Prefs.blackBackground) || (!invertedLut&&!ij.Prefs.blackBackground)) { t1 = 0.0; t2 = 0.0; } //ij.IJ.log("setMaskThreshold2 "+t1+" "+t2); setThreshold(t1, t2, ImageProcessor.NO_LUT_UPDATE); }
public void setThreshold(double minThreshold, double maxThreshold, int lutUpdate) { record("setThreshold", new Object[] {new Double(minThreshold), new Double(maxThreshold), new Integer(lutUpdate)}, new Class[] {double.class, double.class, int.class}); proc.setThreshold(minThreshold, maxThreshold, lutUpdate); }
boolean isSmaller(Roi r) { ImageProcessor mask = r.getMask(); if (mask==null) return false; mask.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); ImageStatistics stats = ImageStatistics.getStatistics(mask, MEAN+LIMIT, null); return stats.area<=width*height; }
boolean isSmaller(Roi r) { ImageProcessor mask = r.getMask(); if (mask==null) return false; mask.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); ImageStatistics stats = ImageStatistics.getStatistics(mask, MEAN+LIMIT, null); return stats.area<=width*height; }
private void updateImg(){ thr=((Scrollbar)sliders.elementAt(0)).getValue(); imp.setSlice(((Scrollbar)sliders.elementAt(1)).getValue()); imp.resetDisplayRange(); ip.setThreshold(thr, max, ImageProcessor.RED_LUT); } }
private void setThreshold(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); int threshold = ip.isInvertedLut()?255:0; if (Prefs.blackBackground) threshold = ip.isInvertedLut()?0:255; ip.setThreshold(threshold, threshold, ImageProcessor.NO_LUT_UPDATE); }
@Override public void run(ImageProcessor ip) { int[] histogram = getHistogram(ip); int split = triangleAlgorithm(histogram); ip.setThreshold(split, 256, ImageProcessor.RED_LUT); image.updateAndDraw(); }
private void setThreshold(ImagePlus imp) { ImageProcessor ip = imp.getProcessor(); int threshold = ip.isInvertedLut()?255:0; if (Prefs.blackBackground) threshold = ip.isInvertedLut()?0:255; ip.setThreshold(threshold, threshold, ImageProcessor.NO_LUT_UPDATE); }
private void setLegacyThreshold(ImageDisplay display, ImagePlus imp) { ImageProcessor proc = imp.getProcessor(); if (thresholdService.hasThreshold(display)) { ThresholdOverlay thresh = thresholdService.getThreshold(display); double min = thresh.getRangeMin(); double max = thresh.getRangeMax(); proc.setThreshold(min, max, ImageProcessor.NO_LUT_UPDATE); } else { proc.resetThreshold(); } }
@Override public Area call() throws Exception { final Image<BitType> imb = interpol.process(weight); final ImagePlus imp = ImageJFunctions.copyToImagePlus(imb, ImagePlus.GRAY8); // BitType gets copied to 0 and 255 in 8-bit ByteProcessor final ThresholdToSelection ts = new ThresholdToSelection(); ts.setup("", imp); final ImageProcessor ip = imp.getProcessor(); ip.setThreshold(1, 255, ImageProcessor.NO_LUT_UPDATE); ts.run(ip); final Roi roi = imp.getRoi(); return null == roi ? new Area() : M.getArea(roi).createTransformedArea(back); } }));
void createSelection() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null) return; int saveMode = mode; mode = BLACK_AND_WHITE; apply(imp); mode = saveMode; ImageProcessor ip = imp.getProcessor().convertToByte(false); int fg = Prefs.blackBackground?255:0; ip.setThreshold(fg, fg, ImageProcessor.NO_LUT_UPDATE); Roi roi = (new ThresholdToSelection()).convert(ip); reset(imp); imp.setRoi(roi); }
void createSelection() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null) return; int saveMode = mode; mode = BLACK_AND_WHITE; apply(imp); mode = saveMode; ImageProcessor ip = imp.getProcessor().convertToByte(false); int fg = Prefs.blackBackground?255:0; ip.setThreshold(fg, fg, ImageProcessor.NO_LUT_UPDATE); Roi roi = (new ThresholdToSelection()).convert(ip); reset(imp); imp.setRoi(roi); }
Roi convertLineToPolygon(Roi roi, ImageProcessor ip) { if (roi==null) return null; ip.resetRoi(); ip.setColor(0); ip.fill(); ip.setColor(255); if (roi.getType()==Roi.LINE && roi.getStrokeWidth()>1) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(ip); //new ImagePlus("ip", ip.duplicate()).show(); ip.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); ThresholdToSelection tts = new ThresholdToSelection(); return tts.convert(ip); }
Roi convertLineToPolygon(Roi roi, ImageProcessor ip) { if (roi==null) return null; ip.resetRoi(); ip.setColor(0); ip.fill(); ip.setColor(255); if (roi.getType()==Roi.LINE && roi.getStrokeWidth()>1) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(ip); //new ImagePlus("ip", ip.duplicate()).show(); ip.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); ThresholdToSelection tts = new ThresholdToSelection(); return tts.convert(ip); }