Search in sources :

Example 6 with PointRoi

use of ij.gui.PointRoi in project GDSC-SMLM by aherbert.

the class ImageROIPainter method appendRoi.

/**
	 * Adds a new ROI to the overlay using the coordinates from start to end (non-inclusive)
	 * 
	 * @param x
	 * @param y
	 * @param slice
	 * @param indices
	 * @param o
	 * @param start
	 * @param end
	 */
private void appendRoi(float[] x, float[] y, int[] slice, int[] indices, Overlay o, int start, int end) {
    int p = end - start;
    float[] x2 = new float[p];
    float[] y2 = new float[p];
    for (int j = start, ii = 0; j < end; j++, ii++) {
        x2[ii] = x[indices[j]];
        y2[ii] = y[indices[j]];
    }
    PointRoi roi = new PointRoi(x2, y2, p);
    roi.setPosition(slice[indices[start]]);
    o.add(roi);
}
Also used : PointRoi(ij.gui.PointRoi)

Example 7 with PointRoi

use of ij.gui.PointRoi in project GDSC-SMLM by aherbert.

the class GaussianFit method setOverlay.

/**
	 * Show the points as an overlay
	 * 
	 * @param nMaxima
	 * @param xpoints
	 * @param ypoints
	 */
private void setOverlay(int nMaxima, int[] xpoints, int[] ypoints) {
    PointRoi roi = new PointRoi(xpoints, ypoints, nMaxima);
    Color strokeColor = Color.yellow;
    Color fillColor = Color.green;
    roi.setStrokeColor(strokeColor);
    roi.setFillColor(fillColor);
    roi.setShowLabels(false);
    imp.setOverlay(roi, strokeColor, 2, fillColor);
}
Also used : Color(java.awt.Color) PointRoi(ij.gui.PointRoi)

Example 8 with PointRoi

use of ij.gui.PointRoi in project GDSC-SMLM by aherbert.

the class BenchmarkSmartSpotRanking method addToOverlay.

private void addToOverlay(Overlay o, int frame, int[] x, int[] y, int c, Color color) {
    PointRoi roi = new PointRoi(x, y, c);
    roi.setFillColor(color);
    roi.setStrokeColor(color);
    roi.setPosition(frame);
    roi.setShowLabels(false);
    o.add(roi);
}
Also used : PointRoi(ij.gui.PointRoi)

Example 9 with PointRoi

use of ij.gui.PointRoi in project GDSC-SMLM by aherbert.

the class PeakFit method addSingleFrameOverlay.

private void addSingleFrameOverlay() {
    // If a single frame was processed add the peaks as an overlay if they are in memory
    ImagePlus imp = this.imp;
    if (fitMaxima && singleFrame > 0) {
        if (source instanceof IJImageSource) {
            String title = source.getName();
            imp = WindowManager.getImage(title);
        }
    }
    if (singleFrame > 0 && imp != null) {
        MemoryPeakResults results = null;
        for (PeakResults r : this.results.toArray()) if (r instanceof MemoryPeakResults) {
            results = (MemoryPeakResults) r;
            break;
        }
        if (results == null || results.size() == 0)
            return;
        ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
        gd.enableYesNoCancel();
        gd.hideCancelButton();
        gd.addMessage("Add the fitted localisations as an overlay?");
        gd.showDialog();
        if (!gd.wasOKed())
            return;
        LUT lut = LUTHelper.createLUT(LutColour.ICE);
        Overlay o = new Overlay();
        ArrayList<PeakResult> list = (ArrayList<PeakResult>) results.getResults();
        for (int i = 0, j = results.size() - 1; i < results.size(); i++, j--) {
            PeakResult r = list.get(i);
            PointRoi roi = new PointRoi(r.getXPosition(), r.getYPosition());
            Color c = LUTHelper.getColour(lut, j, results.size());
            roi.setStrokeColor(c);
            roi.setFillColor(c);
            if (imp.getStackSize() > 1)
                roi.setPosition(singleFrame);
            o.add(roi);
        }
        imp.setOverlay(o);
        imp.getWindow().toFront();
    }
}
Also used : Color(java.awt.Color) SystemColor(java.awt.SystemColor) ArrayList(java.util.ArrayList) LUT(ij.process.LUT) ExtendedGenericDialog(ij.gui.ExtendedGenericDialog) ImagePlus(ij.ImagePlus) PeakResult(gdsc.smlm.results.PeakResult) ExtendedPeakResult(gdsc.smlm.results.ExtendedPeakResult) IJImageSource(gdsc.smlm.ij.IJImageSource) PeakResults(gdsc.smlm.results.PeakResults) IJTablePeakResults(gdsc.smlm.ij.results.IJTablePeakResults) MemoryPeakResults(gdsc.smlm.results.MemoryPeakResults) IJImagePeakResults(gdsc.smlm.ij.results.IJImagePeakResults) BinaryFilePeakResults(gdsc.smlm.results.BinaryFilePeakResults) MALKFilePeakResults(gdsc.smlm.results.MALKFilePeakResults) FilePeakResults(gdsc.smlm.results.FilePeakResults) MemoryPeakResults(gdsc.smlm.results.MemoryPeakResults) Overlay(ij.gui.Overlay) PointRoi(ij.gui.PointRoi)

Example 10 with PointRoi

use of ij.gui.PointRoi in project GDSC-SMLM by aherbert.

the class SpotFinderPreview method addRoi.

public static void addRoi(int frame, Overlay o, float[] x, float[] y, int n, Color colour, int pointType) {
    if (n == 0)
        return;
    PointRoi roi = new PointRoi(x, y, n);
    roi.setPointType(pointType);
    roi.setFillColor(colour);
    roi.setStrokeColor(colour);
    if (frame != 0)
        roi.setPosition(frame);
    o.add(roi);
}
Also used : PointRoi(ij.gui.PointRoi)

Aggregations

PointRoi (ij.gui.PointRoi)11 ImagePlus (ij.ImagePlus)5 PeakResult (gdsc.smlm.results.PeakResult)4 Overlay (ij.gui.Overlay)4 Color (java.awt.Color)3 Rectangle (java.awt.Rectangle)3 ArrayList (java.util.ArrayList)3 MemoryPeakResults (gdsc.smlm.results.MemoryPeakResults)2 ImageStack (ij.ImageStack)2 LUT (ij.process.LUT)2 BasePoint (gdsc.core.match.BasePoint)1 Coordinate (gdsc.core.match.Coordinate)1 MatchResult (gdsc.core.match.MatchResult)1 PointPair (gdsc.core.match.PointPair)1 MaximaSpotFilter (gdsc.smlm.filters.MaximaSpotFilter)1 Spot (gdsc.smlm.filters.Spot)1 FitConfiguration (gdsc.smlm.fitting.FitConfiguration)1 FitResult (gdsc.smlm.fitting.FitResult)1 Gaussian2DFitter (gdsc.smlm.fitting.Gaussian2DFitter)1 IJImageSource (gdsc.smlm.ij.IJImageSource)1