ROIManager › Segment · version 2
Finds nuclear pores with a ring filter, fits a circle to each and keeps
Nuclear pore complexes (NPCs) are rings of eight corners, about 110 nm across, in the flat nuclear envelope. Imaged at a pore protein such as Nup96, they are the reference structure of quantitative SMLM (Thevathasan et al. 2019, doi:10.1038/s41592-019-0574-9): the labelling efficiency, the resolution and the scale of a microscope can all be measured on them. For that, each pore needs its own region of interest (ROI) in the ROI manager, centred on the pore.
This plugin finds the pores in a file and puts an ROI on each. It looks for rings of the pore's radius, fits a circle to every candidate, and keeps those that look like a ring: the right radius, and few localizations far from it. The ROIs are centred on the fitted circle, which is what NPC Corners and NPC Labeling Efficiency need.
The checks are made to keep sparse pores. A pore with only a few corners labelled is still a pore, and those pores are what the labelling efficiency is measured from; what has to go is what is not a ring at all – blobs, filled clumps, pieces of filament. Use it on a 2D view of the nuclear envelope at the bottom of the nucleus, where the pores are seen face on, on grouped localizations (one per blink). For structures that are not rings, Density Peaks finds sites by density alone.
1. A density image. The localizations are binned into an image with pixels of bin (10 nm). Its square root is taken, so that one molecule that blinks many times in one place does not outweigh a whole pore.
2. A ring filter. The image is filtered with a ring of the pore's radius (55 nm), minus a disc of the same total weight. At each position the filter gives the density on a ring around it minus the mean density over the disc. An empty area gives zero, and so does an evenly covered one. A ring gives a strong peak at its centre.
3. Candidates. The peaks of the filtered image are candidates, taken strongest first. A candidate with fewer than min localizations (4) in the band of ±ring width around its ring is dropped at once.
4. Circle fit, on the precise localizations. Only the localizations better than judge on precision (20 nm) within the window (100 nm) are used from here on. A circle of the set radius is fitted to them to place the centre, twice; the ROI goes there. Then the radius is fitted as well.
5. Is it a ring? The fitted radius must lie between min fitted radius and max fitted radius: a blob fits a small circle. And the localizations must lie on that circle: each one's distance from it is compared with its own precision. A localization more than three of its precisions off the ring is far. On a pore that is rare; on a filled clump many are. The candidate is rejected when it has more far ones than max far (1 %) can explain by chance – judged by count, so a pore with ten localizations is not rejected for one stray.
6. Separation. A pore whose centre is closer than the separation (120 nm) to a pore already found, or to an ROI already in the file, is dropped. Running the plugin a second time adds only what is new.

A 2 µm piece of a simulated nuclear envelope (Nup96, 60 % labelling). Left: the localizations. Middle: the ring-filtered density, bright at the centre of every pore. Right: the pores found, each with its fitted circle, and the true centres (+).

What the checks see, on made-up structures with a precision of 5 nm: the fitted circle (blue), the localizations more than 3 precisions from it (red), and the verdict. A full pore passes, and so does a sparse one with three corners. A single blob fits a small circle. A filled disc fails on its far localizations, whether the site is on it or beside it – where the ring filter often puts it.
The filter. With the bin,
the radius and
the ring width, the kernel is
on a grid of pixels of size reaching to
, with
one where the condition holds and zero elsewhere. It sums to zero. It is applied by an FFT convolution to
,
the localizations per pixel. The image covers the localizations with a margin of
and may have at most 16 million pixels. A candidate is a pixel above zero that is the largest within a square of about the separation on a side.
The fits. Both minimise ,
the distance of localization
from the centre, with the soft-L1 loss
,
the ring width: a localization far from the circle counts with its distance, not its square. They are minimised by Gauss-Newton with reweighting, up to 30 iterations. They use the localizations better than judge on precision within the window; when fewer than 3 are, or the table has no precision column, all of them.
The far test. With the fitted radius and
the precision (
xy_err_nm) of each of the precise localizations,
the ring spread (5 nm, for the tilt of the pore and the size of the label). A localization is far when
. With
far ones, the candidate fails when
far test level (0.05) for
binomial with
trials and the chance max far. Two things follow. The test is the same at 500 photons as at 5000, because each localization is judged by its own precision; and it needs nothing about how often a fluorophore blinks, which is not known at this point. Without a precision column the test is off, and only the radius is checked.
Why not the fractions inside and outside. Counted on every localization, as SMAP's clean-up does, those fractions do not tell a pore from a clump at low photon numbers: a pore's imprecise localizations land inside and outside too. And a filled clump the size of a pore passes them, because the ring filter answers a filled disc with a ring of response around it, so the site lands beside the clump, and from there the clump is an arc of the right radius with nothing inside. On simulations with pore-sized clumps among the pores, the far test kept the clumps that reached the analysis to 3 to 5 per 300 pores at 5000 photons (16 to 19 with the fractions); see studies/npc_le.
Min localizations. Every localization in the band counts here, precise or not. A pore that shows corners has at least
of them, so with the analysis fitted from 5 corners, any value up to 5 loses no pore the analysis uses; 4 removes most of the background. A higher value removes the sparse pores that still show 5 corners: the earlier default of 10 found 27 % of the pores showing 4 corners in the simulations of
studies/npc_le, and 14 % with one blink per fluorophore at 500 photons.
What it runs on. In the ROI manager, the plugin runs on the file being shown, on its localizations after the layer's filters, and on the grouped localizations when the layer is grouped. The ROIs get the manager's size and shape (a circle of 300 nm by default). Each ROI records how it was found (this plugin, its version, its settings, the filters) and its numbers: the fitted radius, the localizations on the ring, the precise ones, the fraction far, and the checks it failed.
The defaults are for Nup96 and other proteins of the pore's cytoplasmic and nuclear rings, at a radius of about 54 nm. For a protein at another radius, change radius and the radius range together.
| setting | default | what it does |
|---|---|---|
radiusradius_nm | 55 nm | Radius of the pore: the ring the filter looks for and the one the band is drawn around. at least 1 nm |
ring widthring_width_nm | 15 nm | Half the width of the ring band; also the width of the filter's ring. About the localization precision plus the label's size, 10 to 20 nm. at least 1 nm |
min localizationsmin_locs | 4 | Localizations a candidate needs in the ring band. At most the fewest corners the analysis is fitted from (5): see In detail. at least 1 |
judge on precisionprecision_nm | 20 nm | The checks use only localizations more precise than this. The same as NPC Corners' corner precision, so that the pores are judged on the localizations they are counted with. Looser lets more imprecise ones into the far test, which they pass anyway; tighter leaves sparse pores too few to judge (3 are needed). at least 0.1 nm |
min fitted radiusmin_radius_nm | 40 nm | Smallest fitted radius that is a pore. With max fitted radius, the band around the expected radius. Look at the fitted radius in the checks figure: real pores make a narrow peak. |
max fitted radiusmax_radius_nm | 70 nm | Largest fitted radius that is a pore. |
max farmax_far | 0.01 | Largest fraction of localizations more than 3 of their precisions from the ring. On a pore about 0.3 % of the localizations are more than three precisions off; 1 % leaves room for neighbours and the tilt. Raise it if the checks figure shows real pores rejected for far. 0 to 1 |
keep rejectedkeep_rejected | off | Add candidates that fail the checks as ROIs that are not used, to look at them. Tick it while choosing the settings: each rejected candidate becomes an ROI that is not used, and its origin lists the checks it failed. |
replace earlier poresreplace | off | Remove the ROIs this segmenter made on the file before finding the pores again. On, a second run with other settings gives a fresh answer: the ROIs an earlier run of this segmenter made on the file go first (their origin says which). Off, to add the pores of a second region or a second pass to those already found – a candidate near an existing ROI is suppressed. ROIs drawn by hand or made by another segmenter stay either way. |
far test level (more)radial_alpha | 0.05 | A candidate fails when its far ones are this unlikely for a pore. 1e-06 to 0.5 |
ring spread (more)radial_extra_nm | 5 nm | Tilt and label, added to each precision in the far test. |
window (more)window_nm | 100 nm | Radius around a candidate that is fitted and judged. at least 1 nm |
separation (more)separation_nm | 120 nm | Reject a candidate this close to a stronger one or to an existing ROI. |
bin (more)bin_nm | 10 nm | Pixel size of the density image that is filtered. at least 0.1 nm |
Run without the ROI manager, from a script (Context(locs=locs)), it returns every candidate with its numbers in data["sites"], and the centres of the pores that passed in data["centers"].
Ported from SMAP's ROIManager/Segment/segmentNPC and its clean-up evaluator ROIManager/Evaluate/NPCsegmentCleanup (Ries 2020).
sigma_nm in the layer.fitposring is plain least squares on all of them.