use of uk.ac.sussex.gdsc.core.match.BasePoint in project GDSC-SMLM by aherbert.
the class PsfCreator method getSpots.
/**
* Extract all the ROI points and optionally exclude those that have a box region overlapping with
* any other spot.
*
* @param offset the offset
* @return the spots
*/
private BasePoint[] getSpots(float offset, boolean checkOverlap) {
final int z = imp.getStackSize() / 2;
// float z = (imp.getStackSize() - 1) / 2.0f; // Interpolate between slices
final Roi roi = imp.getRoi();
if (roi != null && roi.getType() == Roi.POINT) {
final FloatPolygon p = roi.getFloatPolygon();
final int n = p.npoints;
if (n == 0) {
return new BasePoint[0];
}
if (offset != 0 && // Check if already float coordinates
(!SimpleArrayUtils.isInteger(p.xpoints) || !SimpleArrayUtils.isInteger(p.ypoints))) {
offset = 0;
}
final BasePoint[] roiPoints = new BasePoint[n];
for (int i = 0; i < n; i++) {
roiPoints[i] = new BasePoint(p.xpoints[i] + offset, p.ypoints[i] + offset, z);
}
return (checkOverlap) ? checkSpotOverlap(roiPoints) : roiPoints;
}
return new BasePoint[0];
}
Aggregations