Analysis › Regions · version 1
Of two used ROIs closer than a distance, keeps the one with more
A segmenter sometimes puts two ROIs (regions of interest: shapes kept in the ROI manager, inside which things are measured) on one structure: a nuclear pore found twice, a bright cluster split in two peaks, ROIs added by hand over ones already found. Measured twice, such a structure counts twice in every summary. This plugin finds the used ROIs whose centres are closer than a distance and, of each such pair, keeps the one with more localizations and excludes the other: it sets its use off.
Run it after segmenting and before measuring, with the distance a little below the spacing of real neighbours: below a pore's diameter for pores.
1. How large each ROI is. Each used ROI's localizations are counted, as the ROI manager shows them: inside the ROI's shape, under the layer's filter (the lowest and highest values of attributes a localization must lie between), and as merged blinks when the layer merges them. An excluded ROI takes no part: it neither stays nor removes another.
2. Who stays. The ROIs are taken from the most localizations down. One stays unless an ROI that already stays, of the same file, has its centre closer than closer than; otherwise it is a double and is excluded. So of two doubles the larger stays, whichever was found first, and of three in a row where only neighbours are close, the two ends stay and the middle one goes.

Four sites (localizations in grey), each with an ROI, and three doubles near three of them. Of each close pair the ROI that holds more localizations stays (blue); the other is excluded (red, dashed). The numbers are the localizations in each ROI.
3. The edit. The doubles' use is set off, as one step of the ROI manager's undo (Undo). Nothing is deleted: an excluded ROI keeps its number and its results, and can be ticked again.
ROIs of different files are never doubles: the files share coordinates. Two ROIs exactly closer than apart are not doubles. Of two with the same number of localizations, the one earlier in the ROI list (as sorted by Sort ROIs) stays. The neighbours are found with a k-d tree, so even 10^5 ROIs take a fraction of a second; the counting is what costs, a few milliseconds per ROI. Before the run, the line under the panel says how many ROIs it would exclude (up to 2000 ROIs).
| setting | default | what it does |
|---|---|---|
closer thandistance_nm | 100 nm | Two used ROIs of one file whose centres are closer than this are doubles. Below the closest spacing two real structures can have, above how far two ROIs on one structure lie apart – a fraction of the ROI size. For nuclear pores, about 100 nm. |
The line under the panel names the ROIs it excluded and how many are used now. Excluded ROIs turn grey in the ROI manager and drop out of the results.
Ported from SMAP's RemoveDoubleSites (Ries 2020).