Search in sources :

Example 1 with StoppingCriteria

use of gdsc.smlm.fitting.nonlinear.StoppingCriteria in project GDSC-SMLM by aherbert.

the class FitConfiguration method createStoppingCriteria.

/**
	 * Creates the appropriate stopping criteria for the configuration
	 * 
	 * @param func
	 *            The Gaussian function
	 * @param params
	 *            The Gaussian parameters
	 * @return The stopping criteria
	 */
public StoppingCriteria createStoppingCriteria(Gaussian2DFunction func, double[] params) {
    StoppingCriteria stoppingCriteria;
    if (fitCriteria == FitCriteria.PARAMETERS) {
        ParameterStoppingCriteria sc = new ParameterStoppingCriteria(func);
        sc.setSignificantDigits(significantDigits);
        addPeakRestrictions(func, sc, params);
        stoppingCriteria = sc;
    } else if (fitCriteria == FitCriteria.COORDINATES) {
        GaussianStoppingCriteria sc = new GaussianStoppingCriteria(func);
        sc.setDelta(delta);
        addPeakRestrictions(func, sc, params);
        stoppingCriteria = sc;
    } else {
        ErrorStoppingCriteria sc = new ErrorStoppingCriteria();
        sc.setSignificantDigits(significantDigits);
        sc.setAvoidPlateau(fitCriteria == FitCriteria.LEAST_SQUARED_PLUS);
        stoppingCriteria = sc;
    }
    // Removed to reduce verbosity of logging output
    //stoppingCriteria.setLog(log);
    stoppingCriteria.setMinimumIterations(minIterations);
    stoppingCriteria.setMaximumIterations(maxIterations);
    return stoppingCriteria;
}
Also used : GaussianStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.GaussianStoppingCriteria) ParameterStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.ParameterStoppingCriteria) GaussianStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.GaussianStoppingCriteria) StoppingCriteria(gdsc.smlm.fitting.nonlinear.StoppingCriteria) ParameterStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.ParameterStoppingCriteria) ErrorStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.ErrorStoppingCriteria) ErrorStoppingCriteria(gdsc.smlm.fitting.nonlinear.stop.ErrorStoppingCriteria)

Aggregations

StoppingCriteria (gdsc.smlm.fitting.nonlinear.StoppingCriteria)1 ErrorStoppingCriteria (gdsc.smlm.fitting.nonlinear.stop.ErrorStoppingCriteria)1 GaussianStoppingCriteria (gdsc.smlm.fitting.nonlinear.stop.GaussianStoppingCriteria)1 ParameterStoppingCriteria (gdsc.smlm.fitting.nonlinear.stop.ParameterStoppingCriteria)1