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

Method getLocationAsString

ij/src/main/java/ij/ImagePlus.java:2935–2954  ·  view source on GitHub ↗

Converts the current cursor location to a string.

(int x, int y)

Source from the content-addressed store, hash-verified

2933
2934 /** Converts the current cursor location to a string. */
2935 public String getLocationAsString(int x, int y) {
2936 Calibration cal = getCalibration();
2937 if (getProperty("FHT")!=null)
2938 return getFFTLocation(x, height-y, cal);
2939 String xx="", yy="";
2940 if (cal.scaled()) {
2941 xx = " ("+x+")";
2942 yy = " ("+y+")";
2943 }
2944 String s = " x="+d2s(cal.getX(x)) + xx + ", y=" + d2s(cal.getY(y,height)) + yy;
2945 if (getStackSize()>1) {
2946 Roi roi2 = getRoi();
2947 if (roi2==null || roi2.getState()==Roi.NORMAL) {
2948 int z = isDisplayedHyperStack()?getSlice()-1:getCurrentSlice()-1;
2949 String zz = cal.scaled()&&cal.getZ(z)!=z?" ("+z+")":"";
2950 s += ", z="+d2s(cal.getZ(z))+zz;
2951 }
2952 }
2953 return s;
2954 }
2955
2956 private String d2s(double n) {
2957 return n==(int)n?Integer.toString((int)n):IJ.d2s(n);

Callers 6

mouseMovedMethod · 0.95
updateCrossesMethod · 0.80
mouseMovedMethod · 0.80
moveHandleMethod · 0.80
showStatusMethod · 0.80
showStatusMethod · 0.80

Calls 14

getCalibrationMethod · 0.95
getPropertyMethod · 0.95
getFFTLocationMethod · 0.95
scaledMethod · 0.95
d2sMethod · 0.95
getXMethod · 0.95
getYMethod · 0.95
getStackSizeMethod · 0.95
getRoiMethod · 0.95
getStateMethod · 0.95
isDisplayedHyperStackMethod · 0.95
getSliceMethod · 0.95

Tested by

no test coverage detected