Search in sources :

Example 1 with ClusteringAlgorithm

use of uk.ac.sussex.gdsc.core.clustering.ClusteringAlgorithm in project GDSC-SMLM by aherbert.

the class TraceMolecules method readClusterDialog.

private boolean readClusterDialog(ExtendedGenericDialog gd) {
    pluginSettings.inputOption = ResultsManager.getInputSource(gd);
    settings.setDistanceThreshold(gd.getNextNumber());
    settings.setTimeThreshold(gd.getNextNumber());
    settings.setTimeUnit(SettingsManager.getTimeUnitValues()[gd.getNextChoiceIndex()]);
    settings.setClusteringAlgorithm(gd.getNextChoiceIndex());
    settings.setPulseInterval((int) gd.getNextNumber());
    settings.setSplitPulses(gd.getNextBoolean());
    settings.setSaveTraces(gd.getNextBoolean());
    settings.setShowHistograms(gd.getNextBoolean());
    settings.setSaveTraceData(gd.getNextBoolean());
    if (altKeyDown) {
        debugMode = pluginSettings.inputDebugMode = gd.getNextBoolean();
    }
    writeSettings();
    if (gd.invalidNumber() || !showHistogramsDialog()) {
        return false;
    }
    // Check arguments
    try {
        // Allow distance of 0 for exact clustering
        ParameterUtils.isPositive("Distance threshold", settings.getDistanceThreshold());
        final ClusteringAlgorithm clusteringAlgorithm = getClusteringAlgorithm(settings.getClusteringAlgorithm());
        if (clusteringAlgorithm == ClusteringAlgorithm.CENTROID_LINKAGE_DISTANCE_PRIORITY || clusteringAlgorithm == ClusteringAlgorithm.CENTROID_LINKAGE_TIME_PRIORITY) {
            ParameterUtils.isAboveZero("Time threshold", settings.getTimeThreshold());
            ParameterUtils.isPositive("Pulse interval", settings.getPulseInterval());
        }
    } catch (final IllegalArgumentException ex) {
        IJ.error(pluginTitle, ex.getMessage());
        return false;
    }
    return true;
}
Also used : ClusteringAlgorithm(uk.ac.sussex.gdsc.core.clustering.ClusteringAlgorithm)

Aggregations

ClusteringAlgorithm (uk.ac.sussex.gdsc.core.clustering.ClusteringAlgorithm)1