/** Calculates and returns uncalibrated statistics for this image or ROI, * including histogram, area, mean, min and max, standard deviation, * and mode. Use the setRoi(Roi) method to limit statistics to * a non-rectangular area. * @see #setRoi * @see #getStatistics * @see ImageStatistics */ public ImageStatistics getStats() { return ImageStatistics.getStatistics(this); }
/** This method calculates and returns complete uncalibrated statistics for * this image or ROI but it is up to 70 times slower than getStats(). * @see #setRoi * @see #getStats * @see ImageStatistics */ public ImageStatistics getStatistics() { return ImageStatistics.getStatistics(this, Measurements.ALL_STATS, null); }
public static ImageStatistics getStatistics(ImageProcessor ip) { return getStatistics(ip, AREA+MEAN+STD_DEV+MODE+MIN_MAX+RECT, null); }
/** This method calculates and returns complete uncalibrated statistics for * this image or ROI but it is up to 70 times slower than getStats(). * @see #setRoi * @see #getStats * @see ImageStatistics */ public ImageStatistics getStatistics() { return ImageStatistics.getStatistics(this, Measurements.ALL_STATS, null); }
/** Returns the mean value of a rectangular ROI */ private double meanRoiValue(final ImageProcessor ip, final int x, final int y, final int width, final int height) { ip.setRoi(x, y, width, height); return ImageStatistics.getStatistics(ip, Measurements.MEAN, null).mean; }
private MinMaxContainer getMinMax(ImageProcessor ip) { ImageStatistics stats = ImageStatistics.getStatistics(ip, ij.measure.Measurements.MIN_MAX, null); return new MinMaxContainer(stats.min, stats.max); }
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; }
@Override public ImageProcessor process(ImageProcessor ip) { // Will not alter ip, no need to duplicate new ContrastEnhancer().stretchHistogram(ip, s, ImageStatistics.getStatistics(ip, Measurements.MIN_MAX, null)); return ip; }
public ImageStatistics getRawStatistics() { if (roi!=null && roi.isArea()) ip.setRoi(roi); else ip.resetRoi(); return ImageStatistics.getStatistics(ip, AREA+MEAN+MODE+MIN_MAX, null); }
public ImageStatistics getRawStatistics() { if (roi!=null && roi.isArea()) ip.setRoi(roi); else ip.resetRoi(); return ImageStatistics.getStatistics(ip, AREA+MEAN+MODE+MIN_MAX, null); }
public ContrastEnhancerWrapper(final Patch reference) { this.reference = reference; if (null != reference) { ImageProcessor ip = reference.getImageProcessor(); reference_stats = ImageStatistics.getStatistics(ip, Measurements.MIN_MAX, reference.getLayer().getParent().getCalibrationCopy()); } }
/** Returns the histogram of the image or ROI, using the specified number of bins. */ public int[] getHistogram(int nBins) { ImageProcessor ip; if (((this instanceof ByteProcessor)||(this instanceof ColorProcessor)) && nBins!=256) ip = convertToShort(false); else ip = this; ip.setHistogramSize(nBins); ip.setHistogramRange(0.0, 0.0); ImageStatistics stats = ImageStatistics.getStatistics(ip); ip.setHistogramSize(256); return stats.histogram; }
/** Returns the histogram of the image or ROI, using the specified number of bins. */ public int[] getHistogram(int nBins) { ImageProcessor ip; if (((this instanceof ByteProcessor)||(this instanceof ColorProcessor)) && nBins!=256) ip = convertToShort(false); else ip = this; ip.setHistogramSize(nBins); ip.setHistogramRange(0.0, 0.0); ImageStatistics stats = ImageStatistics.getStatistics(ip); ip.setHistogramSize(256); return stats.histogram; }
private ImageStatistics getLineStatistics(Roi roi, ImageProcessor ip, int measurements, Calibration cal) { ImagePlus imp = new ImagePlus("", ip); imp.setRoi(roi); ProfilePlot profile = new ProfilePlot(imp); double[] values = profile.getProfile(); ImageProcessor ip2 = new FloatProcessor(values.length, 1, values); return ImageStatistics.getStatistics(ip2, measurements, cal); }
private ImageStatistics getLineStatistics(Roi roi, ImageProcessor ip, int measurements, Calibration cal) { ImagePlus imp = new ImagePlus("", ip); imp.setRoi(roi); ProfilePlot profile = new ProfilePlot(imp); double[] values = profile.getProfile(); ImageProcessor ip2 = new FloatProcessor(values.length, 1, values); return ImageStatistics.getStatistics(ip2, measurements, cal); }
/** * bag class for getting the result of the loaded classifier */ private static class LoadedClassifier { private AbstractClassifier newClassifier = null; private Instances newHeader = null; }
/** * bag class for getting the result of the loaded classifier */ private static class LoadedClassifier { private AbstractClassifier newClassifier = null; private Instances newHeader = null; }
ImageStatistics getRedirectStats(int measurements, Roi roi) { ImagePlus redirectImp = getRedirectImageOrStack(imp); if (redirectImp==null) return null; ImageProcessor ip = redirectImp.getProcessor(); if (imp.getTitle().equals("mask") && imp.getBitDepth()==8) { ip.setMask(imp.getProcessor()); ip.setRoi(0, 0, imp.getWidth(), imp.getHeight()); } else ip.setRoi(roi); return ImageStatistics.getStatistics(ip, measurements, redirectImp.getCalibration()); }
ImageStatistics getRedirectStats(int measurements, Roi roi) { ImagePlus redirectImp = getRedirectImageOrStack(imp); if (redirectImp==null) return null; ImageProcessor ip = redirectImp.getProcessor(); if (imp.getTitle().equals("mask") && imp.getBitDepth()==8) { ip.setMask(imp.getProcessor()); ip.setRoi(0, 0, imp.getWidth(), imp.getHeight()); } else ip.setRoi(roi); return ImageStatistics.getStatistics(ip, measurements, redirectImp.getCalibration()); }