ij.plugin.filter.Analyzer.getMeasurements()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中ij.plugin.filter.Analyzer.getMeasurements()方法的一些代码示例,展示了Analyzer.getMeasurements()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.getMeasurements()方法的具体详情如下:
包路径:ij.plugin.filter.Analyzer
类名称:Analyzer
方法名:getMeasurements

Analyzer.getMeasurements介绍

暂无

代码示例

代码示例来源:origin: net.imagej/ij

/** Converts a y-coordinate in pixels to physical units (e.g. mm),
   taking into account the invertY and global "Invert Y Coordinates" flags. */
 public double getY(double y, int imageHeight) {
   if (invertY || (Analyzer.getMeasurements()&Measurements.INVERT_Y)!=0) {
    if (yOrigin!=0.0)
      return (yOrigin-y)*pixelHeight;
    else
      return (imageHeight-y-1)*pixelHeight;
  } else
      return (y-yOrigin)*pixelHeight;
}

代码示例来源:origin: net.imagej/ij

/** Converts a y-coodinate in physical units to pixels,
   taking into account the 'invertY' flag. */
 public double getRawY(double y, int imageHeight) {
   if (invertY || (Analyzer.getMeasurements()&Measurements.INVERT_Y)!=0) {
    if (yOrigin!=0.0)
      return yOrigin-y/pixelHeight;
    else
      return imageHeight -y/pixelHeight - 1;
  } else
      return y/pixelHeight + yOrigin;
}

代码示例来源:origin: imagej/ImageJA

/** Converts a y-coordinate in pixels to physical units (e.g. mm),
   taking into account the invertY and global "Invert Y Coordinates" flags. */
 public double getY(double y, int imageHeight) {
   if (invertY || (Analyzer.getMeasurements()&Measurements.INVERT_Y)!=0) {
    if (yOrigin!=0.0)
      return (yOrigin-y)*pixelHeight;
    else
      return (imageHeight-y-1)*pixelHeight;
  } else
      return (y-yOrigin)*pixelHeight;
}

代码示例来源:origin: imagej/ImageJA

/** Converts a y-coodinate in physical units to pixels,
   taking into account the 'invertY' flag. */
 public double getRawY(double y, int imageHeight) {
   if (invertY || (Analyzer.getMeasurements()&Measurements.INVERT_Y)!=0) {
    if (yOrigin!=0.0)
      return yOrigin-y/pixelHeight;
    else
      return imageHeight -y/pixelHeight - 1;
  } else
      return y/pixelHeight + yOrigin;
}

代码示例来源:origin: net.imagej/ij

/** Construct a new Analyzer using an ImagePlus object and a ResultsTable. */
public Analyzer(ImagePlus imp, ResultsTable rt) {
  this(imp, Analyzer.getMeasurements(), rt);
}

代码示例来源:origin: imagej/ImageJA

public static boolean addToOverlay() {
  return ((getMeasurements()&ADD_TO_OVERLAY)!=0);
}

代码示例来源:origin: net.imagej/ij

public static boolean addToOverlay() {
  return ((getMeasurements()&ADD_TO_OVERLAY)!=0);
}

代码示例来源:origin: imagej/ImageJA

/** Construct a new Analyzer using an ImagePlus object and a ResultsTable. */
public Analyzer(ImagePlus imp, ResultsTable rt) {
  this(imp, Analyzer.getMeasurements(), rt);
}

代码示例来源:origin: ca.mcgill/Sholl_Analysis

/**
 * Retrieves precision according to {@code Analyze>Set Measurements...}
 *
 * @return the number of decimal digits to be used in tables
 */
protected int getScientificNotationAwarePrecision() {
  final boolean sNotation = (Analyzer.getMeasurements() & Measurements.SCIENTIFIC_NOTATION) != 0;
  int precision = Analyzer.getPrecision();
  if (sNotation)
    precision = -precision;
  return precision;
}

代码示例来源:origin: net.imagej/ij

/** Save the image as tab-delimited text using the specified path. */
public boolean saveAsText(String path) {
  DataOutputStream out = null;
  try {
    Calibration cal = imp.getCalibration();
    int precision = Analyzer.getPrecision();
    int measurements = Analyzer.getMeasurements();
    boolean scientificNotation = (measurements&Measurements.SCIENTIFIC_NOTATION)!=0;
    if (scientificNotation)
      precision = -precision;
    TextEncoder file = new TextEncoder(imp.getProcessor(), cal, precision);
    out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path)));
    file.write(out);
    out.close();
  } catch (IOException e) {
    showErrorMessage("saveAsText", path, e);
    return false;
  } finally {
    if (out!=null)
      try {out.close();} catch (IOException e) {}
  }
  return true;
}

代码示例来源:origin: net.imagej/ij

/** get the number of digits for writing a column to the results table or the clipboard */
static int getPrecision(float[] values) {
  int setDigits = Analyzer.getPrecision();
  int measurements = Analyzer.getMeasurements();
  boolean scientificNotation = (measurements&Measurements.SCIENTIFIC_NOTATION)!=0;
  if (scientificNotation) {
    if (setDigits<MIN_SCIENTIFIC_DIGITS)
      setDigits = MIN_SCIENTIFIC_DIGITS;
    return -setDigits;
  }
  boolean allInteger = true;
  float min = Float.MAX_VALUE, max = -Float.MAX_VALUE;
  for (int i=0; i<values.length; i++) {
    if ((int)values[i]!=values[i] && !Float.isNaN(values[i])) {
      allInteger = false;
    if (values[i] < min) min = values[i];
    if (values[i] > max) max = values[i];
    }
  }
  if (allInteger)
    return 0;
  int digits = (max - min) > 0 ? getDigits(min, max, MIN_FLOAT_PRECISION*(max-min), 15) :
      getDigits(max, MIN_FLOAT_PRECISION*Math.abs(max), 15);
  if (setDigits>Math.abs(digits))
    digits = setDigits * (digits < 0 ? -1 : 1);		//use scientific notation if needed
  return digits;
}

代码示例来源:origin: imagej/ImageJA

/** Save the image as tab-delimited text using the specified path. */
public boolean saveAsText(String path) {
  DataOutputStream out = null;
  try {
    Calibration cal = imp.getCalibration();
    int precision = Analyzer.getPrecision();
    int measurements = Analyzer.getMeasurements();
    boolean scientificNotation = (measurements&Measurements.SCIENTIFIC_NOTATION)!=0;
    if (scientificNotation)
      precision = -precision;
    TextEncoder file = new TextEncoder(imp.getProcessor(), cal, precision);
    out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path)));
    file.write(out);
    out.close();
  } catch (IOException e) {
    showErrorMessage("saveAsText", path, e);
    return false;
  } finally {
    if (out!=null)
      try {out.close();} catch (IOException e) {}
  }
  return true;
}

代码示例来源:origin: zitmen/thunderstorm

/**
 * Draws the histogram using the specified title, number of bins and
 * histogram range. Currently, the number of bins must be 256 and the
 * histogram range range must be the same as the image range expect for 32
 * bit images.
 */
public void showHistogram(ImagePlus imp, int bins, double histMin, double histMax) {
  boolean limitToThreshold = (Analyzer.getMeasurements() & LIMIT) != 0;
  if(channel != INTENSITY && imp.getType() == ImagePlus.COLOR_RGB) {
    ColorProcessor cp = (ColorProcessor) imp.getProcessor();
    ImageProcessor ip = cp.toFloat(channel, null);
    ImagePlus imp2 = new ImagePlus("", ip);
    imp2.setRoi(imp.getRoi());
    stats = imp2.getStatistics(AREA + MEAN + MODE + MIN_MAX, bins, histMin, histMax);
  } else {
    stats = imp.getStatistics(AREA + MEAN + MODE + MIN_MAX + (limitToThreshold ? LIMIT : 0), bins, histMin, histMax);
  }
  showHistogram(imp, stats);
}

代码示例来源:origin: net.imagej/ij

private static void setStackThreshold(ImagePlus imp, ImageProcessor ip, String method) {
  boolean darkBackground = method.indexOf("dark")!=-1;
  int measurements = Analyzer.getMeasurements();
  Analyzer.setMeasurements(Measurements.AREA+Measurements.MIN_MAX);
  ImageStatistics stats = new StackStatistics(imp);

代码示例来源:origin: imagej/ImageJA

allSliceOne=false;
int measurements = Analyzer.getMeasurements();
if (imp.getStackSize()>1)
  Analyzer.setMeasurements(measurements|Measurements.SLICE);

代码示例来源:origin: net.imagej/ij

/** Draws the histogram using the specified title, number of bins and histogram range.
  Currently, the number of bins must be 256 and the histogram range range must be 
  the same as the image range expect for 32 bit images. */
public void showHistogram(ImagePlus imp, int bins, double histMin, double histMax) {
  boolean limitToThreshold = (Analyzer.getMeasurements()&LIMIT)!=0;
  ImageProcessor ip = imp.getProcessor();
  if (ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD
  && ip.getLutUpdateMode()==ImageProcessor.NO_LUT_UPDATE)
    limitToThreshold = false;  // ignore invisible thresholds
  if (imp.getBitDepth()==24 && rgbMode<INTENSITY1)
    rgbMode=INTENSITY1;
  if (rgbMode==RED||rgbMode==GREEN||rgbMode==BLUE) {
    int channel = rgbMode - 2;
    ColorProcessor cp = (ColorProcessor)imp.getProcessor();
    ip = cp.getChannel(channel, null);
    ImagePlus imp2 = new ImagePlus("", ip);
    imp2.setRoi(imp.getRoi());
    stats = imp2.getStatistics(AREA+MEAN+MODE+MIN_MAX, bins, histMin, histMax);
  } else if (rgbMode==RGB)
    stats = RGBHistogram(imp, bins, histMin, histMax);
  else
    stats = imp.getStatistics(AREA+MEAN+MODE+MIN_MAX+(limitToThreshold?LIMIT:0), bins, histMin, histMax);
  showHistogram(imp, stats);
}

代码示例来源:origin: imagej/ImageJA

/** Draws the histogram using the specified title, number of bins and histogram range.
  Currently, the number of bins must be 256 and the histogram range range must be 
  the same as the image range expect for 32 bit images. */
public void showHistogram(ImagePlus imp, int bins, double histMin, double histMax) {
  boolean limitToThreshold = (Analyzer.getMeasurements()&LIMIT)!=0;
  ImageProcessor ip = imp.getProcessor();
  if (ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD
  && ip.getLutUpdateMode()==ImageProcessor.NO_LUT_UPDATE)
    limitToThreshold = false;  // ignore invisible thresholds
  if (imp.getBitDepth()==24 && rgbMode<INTENSITY1)
    rgbMode=INTENSITY1;
  if (rgbMode==RED||rgbMode==GREEN||rgbMode==BLUE) {
    int channel = rgbMode - 2;
    ColorProcessor cp = (ColorProcessor)imp.getProcessor();
    ip = cp.getChannel(channel, null);
    ImagePlus imp2 = new ImagePlus("", ip);
    imp2.setRoi(imp.getRoi());
    stats = imp2.getStatistics(AREA+MEAN+MODE+MIN_MAX, bins, histMin, histMax);
  } else if (rgbMode==RGB)
    stats = RGBHistogram(imp, bins, histMin, histMax);
  else
    stats = imp.getStatistics(AREA+MEAN+MODE+MIN_MAX+(limitToThreshold?LIMIT:0), bins, histMin, histMax);
  showHistogram(imp, stats);
}

代码示例来源:origin: net.imagej/ij

void sum8BitHistograms(ImagePlus imp) {
  Calibration cal = imp.getCalibration();
  boolean limitToThreshold = (Analyzer.getMeasurements()&LIMIT)!=0;
  int minThreshold = 0;
  int maxThreshold = 255;
  ImageProcessor ip = imp.getProcessor();
  if (limitToThreshold && ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD) {
    minThreshold = (int)ip.getMinThreshold();
    maxThreshold = (int)ip.getMaxThreshold();
  }
  ImageStack stack = imp.getStack();
  Roi roi = imp.getRoi();
  longHistogram = new long[256];
  int n = stack.getSize();
  for (int slice=1; slice<=n; slice++) {
    IJ.showProgress(slice, n);
    ip = stack.getProcessor(slice);
    if (roi!=null) ip.setRoi(roi);
    int[] hist = ip.getHistogram();
    for (int i=0; i<256; i++)
      longHistogram[i] += hist[i];
  }
  pw=1.0; ph=1.0;
  getRawStatistics(longHistogram, minThreshold, maxThreshold);
  getRawMinAndMax(longHistogram, minThreshold, maxThreshold);
  copyHistogram(256);
  IJ.showStatus("");
  IJ.showProgress(1.0);
}

代码示例来源:origin: net.imagej/ij

void sum16BitHistograms(ImagePlus imp) {
  Calibration cal = imp.getCalibration();
  boolean limitToThreshold = (Analyzer.getMeasurements()&LIMIT)!=0;
  int minThreshold = 0;
  int maxThreshold = 65535;

代码示例来源:origin: net.imagej/ij

this.stats = stats;
cal = imp.getCalibration();
boolean limitToThreshold = (Analyzer.getMeasurements()&LIMIT)!=0;
imp.getMask();
histogram = stats.getHistogram();

相关文章