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

Method getFFTLocation

ij/src/main/java/ij/ImagePlus.java:2917–2932  ·  view source on GitHub ↗
(int x, int y, Calibration cal)

Source from the content-addressed store, hash-verified

2915 }
2916
2917 String getFFTLocation(int x, int y, Calibration cal) {
2918 double center = width/2.0;
2919 double r = Math.sqrt((x-center)*(x-center) + (y-center)*(y-center));
2920 double theta = Math.atan2(y-center, x-center);
2921 theta = theta*180.0/Math.PI;
2922 if (theta<0) theta=360.0+theta;
2923 String s = "r=";
2924 if (r<1.0)
2925 return s+"Infinity/c (0)"; //origin ('DC offset'), no angle
2926 else if (cal.scaled())
2927 s += IJ.d2s((width/r)*cal.pixelWidth,2) + " " + cal.getUnit() + "/c (" + IJ.d2s(r,0) + ")";
2928 else
2929 s += IJ.d2s(width/r,2) + " p/c (" + IJ.d2s(r,0) + ")";
2930 s += ", theta= " + IJ.d2s(theta,2) + IJ.degreeSymbol;
2931 return s;
2932 }
2933
2934 /** Converts the current cursor location to a string. */
2935 public String getLocationAsString(int x, int y) {

Callers 1

getLocationAsStringMethod · 0.95

Calls 4

d2sMethod · 0.95
scaledMethod · 0.80
sqrtMethod · 0.45
getUnitMethod · 0.45

Tested by

no test coverage detected