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

Method getCurvature

ij/src/main/java/ij/plugin/Selection.java:468–486  ·  view source on GitHub ↗
(int[] x, int[] y, int n)

Source from the content-addressed store, hash-verified

466 }
467
468 float[] getCurvature(int[] x, int[] y, int n) {
469 float[] x2 = new float[n];
470 float[] y2 = new float[n];
471 for (int i=0; i<n; i++) {
472 x2[i] = x[i];
473 y2[i] = y[i];
474 }
475 ImageProcessor ipx = new FloatProcessor(n, 1, x2, null);
476 ImageProcessor ipy = new FloatProcessor(n, 1, y2, null);
477 ipx.convolve(kernel, kernel.length, 1);
478 ipy.convolve(kernel, kernel.length, 1);
479 float[] indexes = new float[n];
480 float[] curvature = new float[n];
481 for (int i=0; i<n; i++) {
482 indexes[i] = i;
483 curvature[i] = (float)Math.sqrt((x2[i]-x[i])*(x2[i]-x[i])+(y2[i]-y[i])*(y2[i]-y[i]));
484 }
485 return curvature;
486 }
487
488 PolygonRoi trimFloatPolygon(PolygonRoi roi, double length) {
489 FloatPolygon poly = roi.getFloatPolygon();

Callers 2

trimPolygonMethod · 0.95
trimFloatPolygonMethod · 0.95

Calls 2

convolveMethod · 0.95
sqrtMethod · 0.45

Tested by

no test coverage detected