Search in sources :

Example 1 with SpotFilter

use of uk.ac.sussex.gdsc.smlm.filters.SpotFilter in project GDSC-SMLM by aherbert.

the class PeakFit method createFitEngine.

/**
 * Creates a fitting engine using the current configuration.
 *
 * @param numberOfThreads the number of threads
 * @param queue the queue
 * @param queueSize the queue size
 * @return The fiting engine
 */
public FitEngine createFitEngine(int numberOfThreads, FitQueue queue, int queueSize) {
    // Ensure thread safety
    final PeakResultsList list = (numberOfThreads > 1) ? results.getThreadSafeList() : results;
    // Reduce to single object for speed
    final PeakResults r = (results.numberOfOutputs() == 1) ? list.toArray()[0] : list;
    // Update the configuration
    if (!updateFitConfiguration(config)) {
        return null;
    }
    final FitEngine engine = FitEngine.create(config, r, numberOfThreads, queue, queueSize);
    // Write settings out to the IJ log
    if (resultsSettings.getLogProgress()) {
        IJ.log(LOG_SPACER);
        IJ.log("Peak Fit");
        IJ.log(LOG_SPACER);
        ImageJUtils.log("Initial Peak SD = %s,%s", MathUtils.rounded(fitConfig.getInitialXSd()), MathUtils.rounded(fitConfig.getInitialYSd()));
        final SpotFilter spotFilter = engine.getSpotFilter();
        IJ.log("Spot Filter = " + spotFilter.getDescription());
        final int w = 2 * engine.getFitting() + 1;
        ImageJUtils.log("Fit window = %d x %d", w, w);
        if (!fitConfig.isDisableSimpleFilter()) {
            IJ.log("Coordinate shift = " + MathUtils.rounded(config.getFitConfiguration().getCoordinateShift()));
            IJ.log("Signal strength = " + MathUtils.rounded(fitConfig.getSignalStrength()));
        }
        if (fitConfig.isDirectFilter()) {
            IJ.log("Smart filter = " + fitConfig.getSmartFilter().getDescription());
        }
        if (extraOptions) {
            IJ.log("Noise = " + MathUtils.rounded(fitConfig.getNoise()));
        }
        IJ.log("Width factor = " + MathUtils.rounded(fitConfig.getMaxWidthFactor()));
        IJ.log(LOG_SPACER);
    }
    return engine;
}
Also used : PeakResultsList(uk.ac.sussex.gdsc.smlm.results.PeakResultsList) FitEngine(uk.ac.sussex.gdsc.smlm.engine.FitEngine) MemoryPeakResults(uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults) FilePeakResults(uk.ac.sussex.gdsc.smlm.results.FilePeakResults) ImageJTablePeakResults(uk.ac.sussex.gdsc.smlm.ij.results.ImageJTablePeakResults) ImageJImagePeakResults(uk.ac.sussex.gdsc.smlm.ij.results.ImageJImagePeakResults) PeakResults(uk.ac.sussex.gdsc.smlm.results.PeakResults) SpotFilter(uk.ac.sussex.gdsc.smlm.filters.SpotFilter)

Aggregations

FitEngine (uk.ac.sussex.gdsc.smlm.engine.FitEngine)1 SpotFilter (uk.ac.sussex.gdsc.smlm.filters.SpotFilter)1 ImageJImagePeakResults (uk.ac.sussex.gdsc.smlm.ij.results.ImageJImagePeakResults)1 ImageJTablePeakResults (uk.ac.sussex.gdsc.smlm.ij.results.ImageJTablePeakResults)1 FilePeakResults (uk.ac.sussex.gdsc.smlm.results.FilePeakResults)1 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)1 PeakResults (uk.ac.sussex.gdsc.smlm.results.PeakResults)1 PeakResultsList (uk.ac.sussex.gdsc.smlm.results.PeakResultsList)1