Search in sources :

Example 6 with PeakResults

use of gdsc.smlm.results.PeakResults 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 7 with PeakResults

use of gdsc.smlm.results.PeakResults in project GDSC-SMLM by aherbert.

the class PulseActivationAnalysis method getImage.

private ImageProcessor getImage(PeakResultsList peakResultsList) {
    PeakResults[] list = peakResultsList.toArray();
    IJImagePeakResults image = (IJImagePeakResults) list[1];
    return image.getImagePlus().getProcessor();
}
Also used : PeakResults(gdsc.smlm.results.PeakResults) MemoryPeakResults(gdsc.smlm.results.MemoryPeakResults) IJImagePeakResults(gdsc.smlm.ij.results.IJImagePeakResults) IJImagePeakResults(gdsc.smlm.ij.results.IJImagePeakResults)

Example 8 with PeakResults

use of gdsc.smlm.results.PeakResults in project GDSC-SMLM by aherbert.

the class PeakFit method initialiseFitting.

/**
	 * Set-up the fitting using all the configured properties. Prepare the output results.
	 */
public boolean initialiseFitting() {
    if (source == null)
        return false;
    // Do this to ensure the serialised configuration is correct
    updateFitConfiguration(config);
    results.setSource(source);
    if (maximaIdentification)
        results.setName(source.getName() + " (Maxima)");
    else if (fitMaxima)
        results.setName(source.getName() + " (" + getSolverName() + " Fit Maxima)");
    else
        results.setName(source.getName() + " (" + getSolverName() + ")");
    results.setBounds(bounds);
    Calibration cal = calibration.clone();
    // Account for the frame integration
    // TODO - Should we change this so that if integrate frames is used then the data 
    // are converted to ExtendedPeakResult with a start and end frame
    //cal.exposureTime *= integrateFrames;
    //if (interlacedData)
    //{
    //	cal.exposureTime *= ((double)dataBlock / (dataBlock + dataSkip));
    //}
    results.setCalibration(cal);
    results.setConfiguration(XmlUtils.toXML(config));
    addMemoryResults(results, false);
    addImageResults(results);
    addFileResults(results);
    addTableResults(results);
    addDefaultResults(results);
    results.begin();
    if (simpleFit && showImage) {
        for (PeakResults r : results.toArray()) {
            if (r instanceof IJImagePeakResults) {
                ImagePlus i = ((IJImagePeakResults) r).getImagePlus();
                Utils.log("Super-resolution image title = " + i.getTitle());
                WindowManager.toFront(i.getWindow());
            }
        }
    }
    return true;
}
Also used : 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) Calibration(gdsc.smlm.results.Calibration) IJImagePeakResults(gdsc.smlm.ij.results.IJImagePeakResults) ImagePlus(ij.ImagePlus)

Aggregations

IJImagePeakResults (gdsc.smlm.ij.results.IJImagePeakResults)8 MemoryPeakResults (gdsc.smlm.results.MemoryPeakResults)8 PeakResults (gdsc.smlm.results.PeakResults)8 IJTablePeakResults (gdsc.smlm.ij.results.IJTablePeakResults)7 BinaryFilePeakResults (gdsc.smlm.results.BinaryFilePeakResults)7 FilePeakResults (gdsc.smlm.results.FilePeakResults)7 MALKFilePeakResults (gdsc.smlm.results.MALKFilePeakResults)7 ExtendedPeakResult (gdsc.smlm.results.ExtendedPeakResult)2 PeakResult (gdsc.smlm.results.PeakResult)2 TSFPeakResultsWriter (gdsc.smlm.results.TSFPeakResultsWriter)2 ImagePlus (ij.ImagePlus)2 ExtendedGenericDialog (ij.gui.ExtendedGenericDialog)2 File (java.io.File)2 TurboList (gdsc.core.utils.TurboList)1 FitEngine (gdsc.smlm.engine.FitEngine)1 SpotFilter (gdsc.smlm.filters.SpotFilter)1 IJImageSource (gdsc.smlm.ij.IJImageSource)1 Calibration (gdsc.smlm.results.Calibration)1 PeakResultsList (gdsc.smlm.results.PeakResultsList)1 GenericDialog (ij.gui.GenericDialog)1