Search in sources :

Example 1 with PcPalmMolecules

use of uk.ac.sussex.gdsc.smlm.ij.plugins.pcpalm.PcPalmMolecules in project GDSC-SMLM by aherbert.

the class BlinkEstimator method calculateAveragePrecision.

private double calculateAveragePrecision(MemoryPeakResults results, boolean verbose) {
    double fittedAverage = 0;
    try {
        final PcPalmMolecules fitter = new PcPalmMolecules();
        final List<Molecule> molecules = fitter.extractLocalisations(results);
        final String title = (verbose) ? TITLE + " Localisation Precision" : null;
        fittedAverage = fitter.calculateAveragePrecision(molecules, title, settings.histogramBins, true, true);
    } catch (final DataException ex) {
    // This is thrown when the data cannot be converted for precision computation
    }
    // Sense check the precision
    if (fittedAverage < 5 || fittedAverage > 60) {
        final GenericDialog gd = new GenericDialog(TITLE);
        gd.addMessage("Estimated precision is not within expected bounds.\nPlease enter an estimate:");
        gd.addSlider("Precision", 5, 60, fittedAverage);
        gd.showDialog();
        if (!gd.wasCanceled()) {
            fittedAverage = gd.getNextNumber();
        }
    }
    // The fitter does checks for a good fit to the histogram so just return the value
    return fittedAverage;
}
Also used : Molecule(uk.ac.sussex.gdsc.smlm.ij.plugins.pcpalm.Molecule) DataException(uk.ac.sussex.gdsc.core.data.DataException) GenericDialog(ij.gui.GenericDialog) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog) PcPalmMolecules(uk.ac.sussex.gdsc.smlm.ij.plugins.pcpalm.PcPalmMolecules)

Aggregations

GenericDialog (ij.gui.GenericDialog)1 DataException (uk.ac.sussex.gdsc.core.data.DataException)1 ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)1 Molecule (uk.ac.sussex.gdsc.smlm.ij.plugins.pcpalm.Molecule)1 PcPalmMolecules (uk.ac.sussex.gdsc.smlm.ij.plugins.pcpalm.PcPalmMolecules)1