Search in sources :

Example 11 with FloatPolygon

use of ij.process.FloatPolygon 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

FloatPolygon (ij.process.FloatPolygon)11 Roi (ij.gui.Roi)6 ImagePlus (ij.ImagePlus)3 PolygonRoi (ij.gui.PolygonRoi)3 Point (java.awt.Point)3 Rectangle (java.awt.Rectangle)3 OffsetPointRoi (uk.ac.sussex.gdsc.core.ij.gui.OffsetPointRoi)3 ImageStack (ij.ImageStack)2 ImageWindow (ij.gui.ImageWindow)2 Overlay (ij.gui.Overlay)2 PointRoi (ij.gui.PointRoi)2 ByteProcessor (ij.process.ByteProcessor)2 LUT (ij.process.LUT)2 Color (java.awt.Color)2 BasePoint (uk.ac.sussex.gdsc.core.match.BasePoint)2 MemoryPeakResults (gdsc.smlm.results.MemoryPeakResults)1 PeakResult (gdsc.smlm.results.PeakResult)1 Trace (gdsc.smlm.results.Trace)1 Calibration (ij.measure.Calibration)1 USHORTPaint (ini.trakem2.display.paint.USHORTPaint)1