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

Method toUnscaled

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

Source from the content-addressed store, hash-verified

7950 }
7951
7952 void toUnscaled() { //calibrated coordinates to pixel coordinates
7953 ImagePlus imp = getImage();
7954 Plot plot = (Plot)(getImage().getProperty(Plot.PROPERTY_KEY)); //null if not a plot window
7955 int height = imp.getHeight();
7956 Calibration cal = imp.getCalibration();
7957 interp.getLeftParen();
7958 if (isArrayArg()) {
7959 Variable[] x = getArray();
7960 interp.getComma();
7961 Variable[] y = getArray();
7962 interp.getRightParen();
7963 for (int i=0; i<x.length; i++)
7964 x[i].setValue(plot == null ? cal.getRawX(x[i].getValue()) : plot.scaleXtoPxl(x[i].getValue()));
7965 for (int i=0; i<y.length; i++)
7966 y[i].setValue(plot == null ? cal.getRawY(y[i].getValue(),height) : plot.scaleYtoPxl(y[i].getValue()));
7967 } else {
7968 Variable xv = getVariable();
7969 Variable yv = null;
7970 Variable zv = null;
7971 boolean twoArgs = interp.nextToken()==',';
7972 if (twoArgs) {
7973 interp.getComma();
7974 yv = getVariable();
7975 }
7976 boolean threeArgs = interp.nextToken()==',';
7977 if (threeArgs) {
7978 interp.getComma();
7979 zv = getVariable();
7980 }
7981 interp.getRightParen();
7982 double x = xv.getValue();
7983 if (twoArgs) {
7984 double y = yv.getValue();
7985 xv.setValue(plot == null ? cal.getRawX(x) : plot.scaleXtoPxl(x));
7986 yv.setValue(plot == null ? cal.getRawY(y,height) : plot.scaleYtoPxl(y));
7987 if (threeArgs)
7988 zv.setValue(cal.getRawZ(zv.getValue()));
7989 } else //oneArg; convert horizontal length (not the x coordinate, no offset)
7990 xv.setValue(x/cal.pixelWidth);
7991 }
7992 }
7993
7994 private Variable doRoi() {
7995 interp.getToken();

Callers 1

doFunctionMethod · 0.95

Calls 15

getImageMethod · 0.95
getHeightMethod · 0.95
getCalibrationMethod · 0.95
isArrayArgMethod · 0.95
getArrayMethod · 0.95
setValueMethod · 0.95
getRawXMethod · 0.95
scaleXtoPxlMethod · 0.95
getRawYMethod · 0.95
scaleYtoPxlMethod · 0.95
getVariableMethod · 0.95
getValueMethod · 0.95

Tested by

no test coverage detected