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

Method getLine

ij/src/main/java/ij/plugin/Slicer.java:613–635  ·  view source on GitHub ↗
(ImageProcessor ip, double x1, double y1, double x2, double y2, float[] data)

Source from the content-addressed store, hash-verified

611 }
612
613 private float[] getLine(ImageProcessor ip, double x1, double y1, double x2, double y2, float[] data) {
614 double dx = x2-x1;
615 double dy = y2-y1;
616 int n = (int)Math.round(Math.sqrt(dx*dx + dy*dy));
617 if (data==null)
618 data = new float[n];
619 double xinc = dx/n;
620 double yinc = dy/n;
621 double rx = x1;
622 double ry = y1;
623 for (int i=0; i<n; i++) {
624 if (notFloat)
625 data[i] = (float)ip.getInterpolatedPixel(rx, ry);
626 else if (rgb) {
627 int rgbPixel = ((ColorProcessor)ip).getInterpolatedRGBPixel(rx, ry);
628 data[i] = Float.intBitsToFloat(rgbPixel&0xffffff);
629 } else
630 data[i] = (float)ip.getInterpolatedValue(rx, ry);
631 rx += xinc;
632 ry += yinc;
633 }
634 return data;
635 }
636
637 private float[] getOrthoLine(ImageProcessor ip, int x1, int y1, int x2, int y2, float[] data) {
638 int w = ip.getWidth();

Callers 2

getSliceMethod · 0.95
makeSurfacePlotMethod · 0.45

Calls 5

getInterpolatedValueMethod · 0.80
roundMethod · 0.45
sqrtMethod · 0.45
getInterpolatedPixelMethod · 0.45

Tested by

no test coverage detected