use of gnu.trove.procedure.TIntObjectProcedure in project GDSC-SMLM by aherbert.
the class BenchmarkSpotFilter method histogramFailures.
/**
* Histogram the number of negatives preceding each positive.
*
* @param benchmarkFilterResult the filter result
* @return the cumulative histogram
*/
private static double[][] histogramFailures(BenchmarkSpotFilterResult benchmarkFilterResult) {
final StoredData data = new StoredData();
benchmarkFilterResult.filterResults.forEachEntry((TIntObjectProcedure<FilterResult>) (peak, filterResult) -> {
for (final ScoredSpot spot : filterResult.spots) {
if (spot.match) {
data.add(spot.fails);
}
}
return true;
});
final double[][] h = MathUtils.cumulativeHistogram(data.getValues(), true);
benchmarkFilterResult.cumul = h;
benchmarkFilterResult.stats = data;
return h;
}
use of gnu.trove.procedure.TIntObjectProcedure in project GDSC-SMLM by aherbert.
the class BenchmarkSpotFilter method addSpotsToMemory.
/**
* Add all the true-positives to memory as a new results set.
*
* @param filterResults the filter results
*/
private static void addSpotsToMemory(TIntObjectHashMap<FilterResult> filterResults) {
final MemoryPeakResults results = new MemoryPeakResults();
results.setName(TITLE + " TP " + truePositivesResultsSetId.getAndIncrement());
filterResults.forEachEntry((TIntObjectProcedure<FilterResult>) (peak, filterResult) -> {
for (final ScoredSpot spot : filterResult.spots) {
if (spot.match) {
final float[] params = new float[] { 0, spot.getIntensity(), 0, spot.spot.x, spot.spot.y, 0, 0 };
results.add(peak, spot.spot.x, spot.spot.y, spot.getIntensity(), 0d, 0f, 0f, params, null);
}
}
return true;
});
MemoryPeakResults.addResults(results);
}
Aggregations