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

Method getCoordinates

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

Source from the content-addressed store, hash-verified

1587 }
1588
1589 void getCoordinates() {
1590 Variable xCoordinates = getFirstArrayVariable();
1591 Variable yCoordinates = getLastArrayVariable();
1592 ImagePlus imp = getImage();
1593 Roi roi = imp.getRoi();
1594 if (roi==null)
1595 interp.error("Selection required");
1596 Variable[] xa, ya;
1597 if (roi.getType()==Roi.LINE) {
1598 xa = new Variable[2];
1599 ya = new Variable[2];
1600 Line line = (Line)roi;
1601 xa[0] = new Variable(line.x1d);
1602 ya[0] = new Variable(line.y1d);
1603 xa[1] = new Variable(line.x2d);
1604 ya[1] = new Variable(line.y2d);
1605 } else {
1606 FloatPolygon fp = roi.getFloatPolygon();
1607 if (fp!=null) {
1608 xa = new Variable[fp.npoints];
1609 ya = new Variable[fp.npoints];
1610 for (int i=0; i<fp.npoints; i++)
1611 xa[i] = new Variable(fp.xpoints[i]);
1612 for (int i=0; i<fp.npoints; i++)
1613 ya[i] = new Variable(fp.ypoints[i]);
1614 } else {
1615 Polygon p = roi.getPolygon();
1616 xa = new Variable[p.npoints];
1617 ya = new Variable[p.npoints];
1618 for (int i=0; i<p.npoints; i++)
1619 xa[i] = new Variable(p.xpoints[i]);
1620 for (int i=0; i<p.npoints; i++)
1621 ya[i] = new Variable(p.ypoints[i]);
1622 }
1623 }
1624 xCoordinates.setArray(xa);
1625 yCoordinates.setArray(ya);
1626 }
1627
1628 Variable[] getProfile() {
1629 interp.getParens();

Callers 2

doFunctionMethod · 0.95
doRoiMethod · 0.95

Calls 9

getFirstArrayVariableMethod · 0.95
getLastArrayVariableMethod · 0.95
getImageMethod · 0.95
getRoiMethod · 0.95
getTypeMethod · 0.95
getFloatPolygonMethod · 0.95
getPolygonMethod · 0.95
setArrayMethod · 0.95
errorMethod · 0.45

Tested by

no test coverage detected