@Override public int hashCode() { return Polyline.hashCode(this); }
@Override public PolygonRoi convert(final Polyline mask) { final float[] x = new float[mask.numVertices()]; final float[] y = new float[mask.numVertices()]; for (int i = 0; i < mask.numVertices(); i++) { final RealLocalizable v = mask.vertex(i); x[i] = (float) v.getDoublePosition(0); y[i] = (float) v.getDoublePosition(1); } return new PolygonRoi(x, y, mask.numVertices(), Roi.POLYLINE); }
/** * Computes a hash code for a polyline. The hash code value is based on the * vertex positions. * * @param polyline * The polyline for which to compute the hash code. * @return Hash code of the polyline. */ static int hashCode( final Polyline polyline ) { int result = 777; int t = 11; for (final RealLocalizable v : polyline.vertices()) { for ( int d = 0; d < v.numDimensions(); d++ ) { final double p = v.getDoublePosition( d ); result += t * ( p * p ); } t += 3; } return result; } }
@Override public int hashCode() { return Polyline.hashCode(this); }
@Override public int hashCode() { return Polyline.hashCode( this ); }