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

Method getLength

ij/src/main/java/ij/gui/Roi.java:371–385  ·  view source on GitHub ↗

Returns the perimeter length.

()

Source from the content-addressed store, hash-verified

369
370 /** Returns the perimeter length. */
371 public double getLength() {
372 double pw=1.0, ph=1.0;
373 if (imp!=null) {
374 Calibration cal = imp.getCalibration();
375 pw = cal.pixelWidth;
376 ph = cal.pixelHeight;
377 }
378 double perimeter = 2.0*width*pw + 2.0*height*ph;
379 if (cornerDiameter > 0) { //using Ramanujan's approximation for the circumference of an ellipse
380 double a = 0.5*Math.min(cornerDiameter, width)*pw;
381 double b = 0.5*Math.min(cornerDiameter, height)*ph;
382 perimeter += Math.PI*(3*(a + b) - Math.sqrt((3*a + b)*(a + 3*b))) -4*(a+b);
383 }
384 return perimeter;
385 }
386
387 /** Returns Feret's diameter, the greatest distance between
388 any two points along the ROI boundary. */

Callers 15

mousePressedMethod · 0.95
parsePathMethod · 0.95
equalsMethod · 0.95
boxArrayMethod · 0.45
drawHandleMethod · 0.45
searchMethod · 0.45
assertValuesMethod · 0.45
testAddBitsColumnsMethod · 0.45
doTileMethod · 0.45
doTile2Method · 0.45
doTile3Method · 0.45

Calls 3

getCalibrationMethod · 0.80
minMethod · 0.45
sqrtMethod · 0.45

Tested by 11

assertValuesMethod · 0.36
testAddBitsColumnsMethod · 0.36
doTileMethod · 0.36
doTile2Method · 0.36
doTile3Method · 0.36
printArrayMethod · 0.36
doTileMethod · 0.36
mainMethod · 0.36
checkElementAccessMethod · 0.36
checkReadWriteMethod · 0.36
checkAccessMethod · 0.36