use of gdsc.smlm.filters.JurySpotFilter 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;
}
Aggregations