Search in sources :

Example 1 with DataFilter

use of gdsc.smlm.engine.DataFilter in project GDSC-SMLM by aherbert.

the class BenchmarkSpotFilter method analyse.

private BenchmarkFilterResult analyse(ArrayList<BatchResult[]> batchResults) {
    // Support z-score of AUC and Max. Jaccard combined.
    // For this wee need the statistics of the population of scores. 
    double[][] stats = getStats(batchResults);
    double max = 0;
    DataFilter dataFilter = null;
    double search = 0;
    double param = 0;
    for (BatchResult[] batchResult : batchResults) {
        if (batchResult == null || batchResult.length == 0)
            continue;
        double[][] data = extractData(batchResult, selection, stats);
        int maxi = 0;
        for (int i = 0; i < batchResult.length; i++) {
            if (data[1][maxi] < data[1][i])
                maxi = i;
        }
        if (max < data[1][maxi]) {
            max = data[1][maxi];
            dataFilter = batchResult[0].dataFilter;
            search = batchResult[0].search;
            param = data[0][maxi];
        }
    }
    if (dataFilter != null) {
        // Convert the absolute distance to be relative to the PSF width
        param = Maths.round(param / config.getHWHMMin(), 0.001);
        final double hwhmMax = config.getHWHMMax();
        // Convert absolute search distance to relative
        config.setSearch(Maths.round(search / hwhmMax, 0.001));
        if (filterRelativeDistances) {
            // If relative distances were specified then we can use the input values
            config.setBorder(border);
        } else {
            // Otherwise we must adjust the input values to convert the absolute values to relative
            config.setBorder(Maths.round(border / hwhmMax, 0.001));
        }
        // Run the filter using relative distances
        config.setDataFilter(dataFilter, param, 0);
        BenchmarkFilterResult result = run(config, true, true);
        getTable(true).flush();
        return result;
    }
    return null;
}
Also used : DataFilter(gdsc.smlm.engine.DataFilter) PeakResultPoint(gdsc.smlm.ij.plugins.ResultsMatchCalculator.PeakResultPoint) BasePoint(gdsc.core.match.BasePoint)

Aggregations

BasePoint (gdsc.core.match.BasePoint)1 DataFilter (gdsc.smlm.engine.DataFilter)1 PeakResultPoint (gdsc.smlm.ij.plugins.ResultsMatchCalculator.PeakResultPoint)1