本文整理了Java中ij.plugin.filter.Analyzer.getPrecision()
方法的一些代码示例,展示了Analyzer.getPrecision()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.getPrecision()
方法的具体详情如下:
包路径:ij.plugin.filter.Analyzer
类名称:Analyzer
方法名:getPrecision
[英]Returns the number of digits displayed to the right of decimal point.
[中]返回小数点右侧显示的位数。
代码示例来源:origin: net.imagej/ij
private void init() {
int p = Analyzer.getPrecision();
if (p>precision)
precision = (short)p;
for (int i=0; i<decimalPlaces.length; i++)
decimalPlaces[i] = AUTO_FORMAT;
}
代码示例来源:origin: imagej/ImageJA
private void init() {
int p = Analyzer.getPrecision();
if (p>precision)
precision = (short)p;
for (int i=0; i<decimalPlaces.length; i++)
decimalPlaces[i] = AUTO_FORMAT;
}
代码示例来源: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: imagej/ImageJA
/** 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: 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: net.imagej/ij
void getValue (String title, String prompt, double defaultValue, int digits) {
int places = Analyzer.getPrecision();
if (digits>0 || (int)defaultValue!=defaultValue)
digits = Math.max(places, 1);
gd = new GenericDialog(title);
gd.addNumericField(prompt, defaultValue, digits, 8, null);
gd.addPreviewCheckbox(pfr);
gd.addDialogListener(this);
gd.showDialog();
}
代码示例来源:origin: imagej/ImageJA
void getValue (String title, String prompt, double defaultValue, int digits) {
int places = Analyzer.getPrecision();
if (digits>0 || (int)defaultValue!=defaultValue)
digits = Math.max(places, 1);
gd = new GenericDialog(title);
gd.addNumericField(prompt, defaultValue, digits, 8, null);
gd.addPreviewCheckbox(pfr);
gd.addDialogListener(this);
gd.showDialog();
}
代码示例来源:origin: sc.fiji/VIB-lib
protected void drawHistogram(ImageProcessor ip) {
int x, y;
double minCount2 = histogram[0];
double maxCount2 = histogram[0];
int mode2 = 0;
int saveModalCount;
ip.setColor(Color.black);
ip.setLineWidth(1);
decimalPlaces = Analyzer.getPrecision();
digits = binSize!=1.0?decimalPlaces:0;
for (int i = 1; i<histogram.length; i++)
if (histogram[i] > maxCount2) {
maxCount2 = histogram[i];
mode2 = i;
} else if (histogram[i] < minCount2)
minCount2 = histogram[i];
drawPlot(minCount2, maxCount2, ip);
x = XMARGIN + 1;
y = YMARGIN + HIST_HEIGHT + 2;
y += BAR_HEIGHT+15;
drawText(ip, x, y);
}
代码示例来源:origin: sc.fiji/Color_Histogram
decimalPlaces = Analyzer.getPrecision();
代码示例来源:origin: net.imagej/ij
rt.setPrecision(allIntegers?0:Analyzer.getPrecision());
for (int i=0; i<fp.npoints; i++) {
rt.incrementCounter();
代码示例来源:origin: net.imagej/ij
saveSettingsCalled = true;
measurements = Analyzer.getMeasurements();
decimalPlaces = Analyzer.getPrecision();
blackBackground = Prefs.blackBackground;
autoContrast = Prefs.autoContrast;
代码示例来源:origin: imagej/ImageJA
saveSettingsCalled = true;
measurements = Analyzer.getMeasurements();
decimalPlaces = Analyzer.getPrecision();
blackBackground = Prefs.blackBackground;
autoContrast = Prefs.autoContrast;
代码示例来源:origin: zitmen/thunderstorm
decimalPlaces = Analyzer.getPrecision();
digits = cal.calibrated() || stats.binSize != 1.0 ? decimalPlaces : 0;
saveModalCount = histogram[stats.mode];
代码示例来源:origin: imagej/ImageJA
rt.setPrecision(allIntegers?0:Analyzer.getPrecision());
for (int i=0; i<fp.npoints; i++) {
rt.incrementCounter();
代码示例来源:origin: net.imagej/ij
ip.setColor(Color.black);
ip.setLineWidth(1);
decimalPlaces = Analyzer.getPrecision();
digits = cal.calibrated()||stats.binSize!=1.0?decimalPlaces:0;
saveModalCount = histogram[stats.mode];
代码示例来源:origin: imagej/ImageJA
ip.setColor(Color.black);
ip.setLineWidth(1);
decimalPlaces = Analyzer.getPrecision();
digits = cal.calibrated()||stats.binSize!=1.0?decimalPlaces:0;
saveModalCount = histogram[stats.mode];
代码示例来源:origin: imagej/ImageJA
int yOffset = y;
if (decimalPlaces == -1)
decimalPlaces = Analyzer.getPrecision();
x = (int)(XMARGIN*zoom) + xOffset;
y = (int)(YMARGIN*zoom) + yOffset;
代码示例来源:origin: net.imagej/ij
int yOffset = y;
if (decimalPlaces == -1)
decimalPlaces = Analyzer.getPrecision();
x = (int)(XMARGIN*zoom) + xOffset;
y = (int)(YMARGIN*zoom) + yOffset;
内容来源于网络,如有侵权,请联系作者删除!