Search in sources :

Example 1 with SingleSpotFilter

use of gdsc.smlm.filters.SingleSpotFilter in project GDSC-SMLM by aherbert.

the class FitEngineConfiguration method createSpotFilter.

/**
	 * Create the spot filter for identifying candidate maxima. The actual border, search width and smoothing parameters
	 * can be configured relative to the configured standard deviations or left absolute. The standard deviation is used
	 * to determine the Half-Width at Half-Maximum (HWHM) for each dimension and the parameters set as follows.
	 * 
	 * <pre>
	 * 
	 * int search = (int) Math.ceil(getSearch() * hwhmMax);
	 * int border = (int) Math.floor(getBorder() * hwhmMax);
	 * // For each filter
	 * double smooth = getSmooth(i) * hwhmMin;
	 * 
	 * </pre>
	 * 
	 * @param relative
	 *            True if the parameters should be made relative to the configured standard deviations
	 * @return
	 */
public MaximaSpotFilter createSpotFilter(boolean relative) {
    final double hwhmMin, hwhmMax;
    if (relative) {
        // Get the half-width at half maximim
        hwhmMin = getHWHMMin();
        hwhmMax = getHWHMMax();
    } else {
        hwhmMin = hwhmMax = 1;
    }
    // Region for maxima finding
    int search = (int) Math.ceil(Maths.round(getSearch() * hwhmMax, 0.01));
    if (search < 1)
        search = 1;
    // Border where peaks are ignored
    int border = (int) Math.floor(Maths.round(getBorder() * hwhmMax, 0.01));
    if (border < 0)
        border = 0;
    DataProcessor processor0 = createDataProcessor(border, 0, hwhmMin);
    final int nFilters = Math.min(dataFilter.length, smooth.length);
    final MaximaSpotFilter spotFilter;
    switch(dataFilterType) {
        case JURY:
            if (nFilters > 1) {
                DataProcessor[] processors = new DataProcessor[nFilters];
                processors[0] = processor0;
                for (int i = 1; i < nFilters; i++) processors[i] = createDataProcessor(border, i, hwhmMin);
                spotFilter = new JurySpotFilter(search, border, processors);
                break;
            }
        case DIFFERENCE:
            if (nFilters > 1) {
                DataProcessor processor1 = createDataProcessor(border, 1, hwhmMin);
                spotFilter = new DifferenceSpotFilter(search, border, processor0, processor1);
                break;
            }
        case SINGLE:
        default:
            spotFilter = new SingleSpotFilter(search, border, processor0);
    }
    return spotFilter;
}
Also used : MaximaSpotFilter(gdsc.smlm.filters.MaximaSpotFilter) JurySpotFilter(gdsc.smlm.filters.JurySpotFilter) DifferenceSpotFilter(gdsc.smlm.filters.DifferenceSpotFilter) BlockAverageDataProcessor(gdsc.smlm.filters.BlockAverageDataProcessor) MedianDataProcessor(gdsc.smlm.filters.MedianDataProcessor) CircularMeanDataProcessor(gdsc.smlm.filters.CircularMeanDataProcessor) GaussianDataProcessor(gdsc.smlm.filters.GaussianDataProcessor) AverageDataProcessor(gdsc.smlm.filters.AverageDataProcessor) DataProcessor(gdsc.smlm.filters.DataProcessor) SingleSpotFilter(gdsc.smlm.filters.SingleSpotFilter)

Example 2 with SingleSpotFilter

use of gdsc.smlm.filters.SingleSpotFilter in project GDSC-SMLM by aherbert.

the class SmoothImage method createSpotFilter.

private MaximaSpotFilter createSpotFilter() {
    final int search = 1;
    final int border = 0;
    DataProcessor processor0 = FitEngineConfiguration.createDataProcessor(border, filters[filter1], smooth1);
    if (differenceFilter) {
        DataProcessor processor1 = FitEngineConfiguration.createDataProcessor(border, filters[filter2], smooth2);
        return new DifferenceSpotFilter(search, border, processor0, processor1);
    }
    return new SingleSpotFilter(search, border, processor0);
}
Also used : DifferenceSpotFilter(gdsc.smlm.filters.DifferenceSpotFilter) DataProcessor(gdsc.smlm.filters.DataProcessor) SingleSpotFilter(gdsc.smlm.filters.SingleSpotFilter)

Aggregations

DataProcessor (gdsc.smlm.filters.DataProcessor)2 DifferenceSpotFilter (gdsc.smlm.filters.DifferenceSpotFilter)2 SingleSpotFilter (gdsc.smlm.filters.SingleSpotFilter)2 AverageDataProcessor (gdsc.smlm.filters.AverageDataProcessor)1 BlockAverageDataProcessor (gdsc.smlm.filters.BlockAverageDataProcessor)1 CircularMeanDataProcessor (gdsc.smlm.filters.CircularMeanDataProcessor)1 GaussianDataProcessor (gdsc.smlm.filters.GaussianDataProcessor)1 JurySpotFilter (gdsc.smlm.filters.JurySpotFilter)1 MaximaSpotFilter (gdsc.smlm.filters.MaximaSpotFilter)1 MedianDataProcessor (gdsc.smlm.filters.MedianDataProcessor)1