@Override public double getBoundsX() { if (stats == null) calculateShapeMeasurements(); return stats.getBoundsX(); }
@Override public double getBoundsWidth() { if (stats == null) calculateShapeMeasurements(); return stats.getBoundsWidth(); }
@Override public double getBoundsHeight() { if (stats == null) calculateShapeMeasurements(); return stats.getBoundsHeight(); }
/** * Get the number of vertices used to represent this area. There is some 'fuzziness' to the meaning of this, since * curved regions will be flattened and the same complex areas may be represented in different ways - nevertheless * it provides some measure of the 'complexity' of the area. * @return */ public int nVertices() { if (stats == null) calculateShapeMeasurements(); return stats.getNVertices(); }
@Override public double getArea() { if (stats == null) calculateShapeMeasurements(); return stats.getArea(); }
@Override public double getPerimeter() { if (stats == null) calculateShapeMeasurements(); return stats.getPerimeter(); }
@Override public double getBoundsY() { if (stats == null) calculateShapeMeasurements(); return stats.getBoundsY(); }
/** * Get the x coordinate of the ROI centroid; * <p> * Warning: If the centroid computation was too difficult (i.e. the area is particularly elaborate), * then the center of the bounding box will be used instead! (However this should not be relied upon as it is liable to change in later versions) */ @Override public double getCentroidX() { if (stats == null) calculateShapeMeasurements(); double centroidX = stats.getCentroidX(); if (Double.isNaN(centroidX)) return getBoundsX() + .5 * getBoundsWidth(); else return centroidX; }
/** * Get the y coordinate of the ROI centroid; * <p> * Warning: If the centroid computation was too difficult (i.e. the area is particularly elaborate), * then the center of the bounding box will be used instead! (However this should not be relied upon as it is liable to change in later versions) */ @Override public double getCentroidY() { if (stats == null) calculateShapeMeasurements(); double centroidY = stats.getCentroidY(); if (Double.isNaN(centroidY)) return getBoundsY() + .5 * getBoundsHeight(); else return centroidY; }