MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getValue

Method getValue

ij/src/main/java/ij/macro/Functions.java:5403–5481  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5401 }
5402
5403 double getValue() {
5404 interp.getLeftParen();
5405 if (!isStringArg()) { // getValue(x,y)
5406 double x = interp.getExpression();
5407 double y = getLastArg();
5408 int ix = (int)x;
5409 int iy = (int)y;
5410 if (x==ix && y==iy)
5411 return getProcessor().getPixelValue(ix,iy);
5412 else
5413 return getProcessor().getInterpolatedValue(x,y);
5414 }
5415 String key = getString();
5416 interp.getRightParen();
5417 if (key.equals("image.size"))
5418 return getImage().getSizeInBytes();
5419 else if (key.equals("rgb.foreground"))
5420 return Toolbar.getForegroundColor().getRGB()&0xffffff;
5421 else if (key.equals("rgb.background"))
5422 return Toolbar.getBackgroundColor().getRGB()&0xffffff;
5423 else if (key.contains("foreground")) {
5424 double value = Toolbar.getForegroundValue();
5425 if (Double.isNaN(value))
5426 return getColorValue(Toolbar.getForegroundColor());
5427 else
5428 return value;
5429 } else if (key.contains("background")) {
5430 double value = Toolbar.getBackgroundValue();
5431 if (Double.isNaN(value))
5432 return getColorValue(Toolbar.getBackgroundColor());
5433 else
5434 return value;
5435 } else if (key.equals("font.size")) {
5436 resetImage();
5437 ImageProcessor ip = getProcessor();
5438 setFont(ip);
5439 return ip.getFont().getSize();
5440 } else if (key.equals("font.height")) {
5441 resetImage();
5442 ImageProcessor ip = getProcessor();
5443 setFont(ip);
5444 return ip.getFontMetrics().getHeight();
5445 } else if (key.equals("selection.size")) {
5446 ImagePlus imp = getImage();
5447 Roi roi = imp.getRoi();
5448 if (roi==null)
5449 return 0.0;
5450 else
5451 return roi.size();
5452 } else if (key.equals("selection.width")) {
5453 ImagePlus imp = getImage();
5454 Roi roi = imp.getRoi();
5455 if (roi==null)
5456 interp.error("No selection");
5457 return roi.getStrokeWidth();
5458 } else if (key.equals("results.count")) {
5459 ResultsTable rt = getResultsTable(false);
5460 return rt!=null?rt.size():0;

Callers 15

getFunctionValueMethod · 0.95
getNumericArrayMethod · 0.45
getStringArrayMethod · 0.45
newArrayMethod · 0.45
doPlotMethod · 0.45
joinArrayMethod · 0.45
deleteArrayValueMethod · 0.45
fourierArrayMethod · 0.45
sortArrayMethod · 0.45
getRankPositionsMethod · 0.45
getArrayStatisticsMethod · 0.45
resampleArrayMethod · 0.45

Calls 15

isStringArgMethod · 0.95
getLastArgMethod · 0.95
getProcessorMethod · 0.95
getStringMethod · 0.95
getImageMethod · 0.95
getForegroundColorMethod · 0.95
getBackgroundColorMethod · 0.95
getForegroundValueMethod · 0.95
getColorValueMethod · 0.95
getBackgroundValueMethod · 0.95
resetImageMethod · 0.95
setFontMethod · 0.95

Tested by

no test coverage detected