Search in sources :

Example 11 with BasePoint

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];
}
Also used : BasePoint(uk.ac.sussex.gdsc.core.match.BasePoint) OffsetPointRoi(uk.ac.sussex.gdsc.core.ij.gui.OffsetPointRoi) Roi(ij.gui.Roi) FloatPolygon(ij.process.FloatPolygon) Point(java.awt.Point) BasePoint(uk.ac.sussex.gdsc.core.match.BasePoint)

Aggregations

BasePoint (uk.ac.sussex.gdsc.core.match.BasePoint)11 Point (java.awt.Point)9 Rectangle (java.awt.Rectangle)6 Roi (ij.gui.Roi)5 OffsetPointRoi (uk.ac.sussex.gdsc.core.ij.gui.OffsetPointRoi)5 Overlay (ij.gui.Overlay)4 Plot (ij.gui.Plot)3 ImageExtractor (uk.ac.sussex.gdsc.core.utils.ImageExtractor)3 FloatPolygon (ij.process.FloatPolygon)2 LocalList (uk.ac.sussex.gdsc.core.utils.LocalList)2 CameraModel (uk.ac.sussex.gdsc.smlm.model.camera.CameraModel)2 ImageStack (ij.ImageStack)1 GenericDialog (ij.gui.GenericDialog)1 ImageCanvas (ij.gui.ImageCanvas)1 ImageRoi (ij.gui.ImageRoi)1 FloatProcessor (ij.process.FloatProcessor)1 LUT (ij.process.LUT)1 Color (java.awt.Color)1 ArrayList (java.util.ArrayList)1 Future (java.util.concurrent.Future)1