Search in sources :

Example 31 with FitConfiguration

use of uk.ac.sussex.gdsc.smlm.engine.FitConfiguration in project GDSC-SMLM by aherbert.

the class PeakFit method configureSmartFilter.

/**
 * Show a dialog to configure the smart filter. The updated settings are optionally saved to the
 * settings file.
 *
 * <p>If the fit configuration isSmartFilter is not enabled then this method returns true. If it
 * is enabled then a dialog is shown to input the configuration for a smart filter. If no valid
 * filter can be created from the input then the method returns false.
 *
 * <p>Note: If the smart filter is successfully configured then the user may want to disable the
 * standard fit validation.
 *
 * @param config the config
 * @param flags the flags
 * @return true, if successful
 */
public static boolean configureSmartFilter(FitEngineConfiguration config, int flags) {
    final FitConfiguration fitConfig = config.getFitConfiguration();
    if (!fitConfig.isSmartFilter()) {
        return true;
    }
    final boolean result = configureSmartFilter(fitConfig);
    if (result) {
        if (BitFlagUtils.anyNotSet(flags, FLAG_NO_SAVE)) {
            SettingsManager.writeSettings(config, 0);
        }
    }
    return result;
}
Also used : FitConfiguration(uk.ac.sussex.gdsc.smlm.engine.FitConfiguration)

Example 32 with FitConfiguration

use of uk.ac.sussex.gdsc.smlm.engine.FitConfiguration in project GDSC-SMLM by aherbert.

the class PsfCalculator method run.

@Override
public void run(String arg) {
    SmlmUsageTracker.recordPlugin(this.getClass(), arg);
    final PSFCalculatorSettings settings = SettingsManager.readPsfCalculatorSettings(0);
    final double sd = calculate(settings, false);
    if (sd < 0) {
        return;
    }
    SettingsManager.writeSettings(this.settingsBuilder);
    final FitEngineConfiguration config = SettingsManager.readFitEngineConfiguration(0);
    final FitConfiguration fitConfig = config.getFitConfiguration();
    fitConfig.setNmPerPixel(getPixelPitch());
    fitConfig.setPsfType(PSFType.ONE_AXIS_GAUSSIAN_2D);
    fitConfig.setInitialPeakStdDev(sd);
    SettingsManager.writeSettings(config, 0);
}
Also used : PSFCalculatorSettings(uk.ac.sussex.gdsc.smlm.ij.settings.GUIProtos.PSFCalculatorSettings) FitEngineConfiguration(uk.ac.sussex.gdsc.smlm.engine.FitEngineConfiguration) FitConfiguration(uk.ac.sussex.gdsc.smlm.engine.FitConfiguration)

Aggregations

FitConfiguration (uk.ac.sussex.gdsc.smlm.engine.FitConfiguration)32 ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)11 FitEngineConfiguration (uk.ac.sussex.gdsc.smlm.engine.FitEngineConfiguration)9 BasePoint (uk.ac.sussex.gdsc.core.match.BasePoint)8 PeakResultPoint (uk.ac.sussex.gdsc.smlm.results.PeakResultPoint)7 Checkbox (java.awt.Checkbox)6 Rectangle (java.awt.Rectangle)5 CalibrationWriter (uk.ac.sussex.gdsc.smlm.data.config.CalibrationWriter)5 ArrayList (java.util.ArrayList)4 ImageStack (ij.ImageStack)3 TextField (java.awt.TextField)3 ConcurrentRuntimeException (org.apache.commons.lang3.concurrent.ConcurrentRuntimeException)3 StoredDataStatistics (uk.ac.sussex.gdsc.core.utils.StoredDataStatistics)3 PSF (uk.ac.sussex.gdsc.smlm.data.config.PSFProtos.PSF)3 BenchmarkSpotFilterResult (uk.ac.sussex.gdsc.smlm.ij.plugins.benchmark.BenchmarkSpotFilter.BenchmarkSpotFilterResult)3 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)3 TIntObjectHashMap (gnu.trove.map.hash.TIntObjectHashMap)2 Choice (java.awt.Choice)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2