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;
}
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);
}
Aggregations