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

Method makeXorYArray

ij/src/main/java/ij/gui/PointRoi.java:208–218  ·  view source on GitHub ↗

Creates a one-element array with a coordinate; if 'imp' is non-null converts from a screen coordinate to an image (offscreen) coordinate. The array can be used for adding to an existing point selection

(double value, ImagePlus imp, boolean isY)

Source from the content-addressed store, hash-verified

206 * converts from a screen coordinate to an image (offscreen) coordinate.
207 * The array can be used for adding to an existing point selection */
208 static float[] makeXorYArray(double value, ImagePlus imp, boolean isY) {
209 if (imp != null) {
210 ImageCanvas canvas = imp.getCanvas();
211 if (canvas != null) { //offset 0.5 converts from area to pixel center coordinates
212 value = (isY ? canvas.offScreenYD((int)value) :canvas.offScreenXD((int)value)) - 0.5;
213 if (!magnificationForSubPixel(canvas.getMagnification()))
214 value = Math.round(value);
215 }
216 }
217 return new float[] {(float)value};
218 }
219
220 void handleMouseMove(int ox, int oy) {
221 }

Callers 1

PointRoiMethod · 0.95

Calls 6

offScreenYDMethod · 0.95
offScreenXDMethod · 0.95
getMagnificationMethod · 0.95
getCanvasMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected