Layers

Analysis › Process · version 2

The layers' bounds and whether they merge blinks, as the Render tab would set them.

What it does

In the Render tab a person sets up the layers (the pictures of the localizations, each with its own filter and colours) by hand: which layer merges blinks, and which localizations each one keeps – a precision better than 20 nm, a relative log-likelihood above -2, at least a few hundred photons. Every plugin downstream reads the localizations through those filters (also called bounds). Merge blinks (also called grouping or linking) combines the localizations in consecutive frames that come from one blinking event into one.

A chain (plugins run one after another as one) has no hands on the Render tab, and a batch job – a chain run over many files – has no Render tab at all. This step does the same work from settings, so that a chain filters every file the same way and says in its log what the filters were. Put it first in a chain (docs/batch.md describes chains and batch jobs).

Without it, a chain filters each file as a freshly opened file is filtered: the default bounds, with blinks merged. That is a sensible default, but an implicit one; this step makes it explicit.

How it works

One block per layer. Each block says three things:

A row for an attribute the starting bounds already have replaces that bound.

Rows rather than settings. Which attributes a table has is not known until a file is open, and in a batch it is a different file each time, so the bounds are rows naming an attribute rather than one setting per attribute. In the GUI the attribute box offers the open table's attributes, and from current layers copies what the Render tab shows now.

Per file. When the step runs, each row is resolved against the table in front of it. A quantile row takes its limits as fractions and turns them into values for this file: 0.1 as the lower limit means "drop the dimmest 10%". A row whose attribute the table does not have is skipped, and the report says so; if it is required, the file is stopped instead, with a message listing the attributes it does have.

One quantile row, lower limit 0.2, resolved on two files that differ only in how bright the dye is. It removes the dimmest fifth of each (shaded) – 139 photons in one file, over 700 in the other. A fixed limit of 400 photons (dashed) would remove two fifths of the dim file and a tenth of the bright one.

Setting the layers. The resolved bounds replace each layer's filter entirely; a layer's merge blinks is switched if the block asks for it. A block for a layer the session does not have yet makes one, as a copy of the first. Layers beyond the blocks are left as they are. In the GUI the step acts on the session's own layers, so the Render tab shows afterwards what the chain did.

Removing. With remove filtered, the localizations that no layer keeps are dropped from the table, and so from the file a chain or a batch saves. Without it, nothing is removed: the filters only decide what is drawn and what the next plugins are given.

In detail

Which table. The localizations: the quantile limits are of the whole table of single localizations (below), and remove filtered drops localizations, whatever a layer shows.

The defaults. defaults starts from the bounds a freshly opened table gets: xy_err_nm at most 25 nm, logl_rel at least -2, z_nm between -500 and 500 nm, and, for a 2D table (no z_nm), sigma_nm at most 180 nm – each only where the table has the attribute – and then the bounds the table carries with it, such as the use flag Remove Localizations writes when it hides localizations, so what the file hides stays hidden. (Before version 2 the carried bounds were left out.) A new layer merges blinks by default.

Quantiles. A quantile row's limits are fractions and between 0 and 1. They become the bound

with the attribute's value and its empirical quantile function over the whole table of single localizations – not over what another bound or the drawn ROI (region of interest) keeps, and ignoring values that are not finite. An empty limit stays open.

Merged blinks. A layer's bounds apply to its merged blinks and to its single localizations alike. A bound on an attribute that means something else per blink – photons, which is summed over the blink, or n_in_group – is the same number on both, so on a layer that merges blinks it cuts at a different point of the distribution.

What is removed. remove filtered judges every single localization by the bounds of each layer and keeps those that pass the bounds of at least one. The ROI and a layer's choice of files do not enter into it.

The record. The step's report – one line per layer with whether it merges blinks and its bounds, the rows that were skipped, and how many localizations were removed – goes into the chain's log entry, together with its settings. Run on its own, it is logged when it removes localizations; otherwise it changes only the layers, and it is the chain's entry that records it.

Parameters

settingdefaultwhat it does
layers
layers
{'grouped': True, 'start': 'defaults', 'bounds': []}One block per layer: whether it merges blinks, where its bounds start from, and rows of field, lo, hi (either may be empty); a quantile row takes lo and hi as fractions, resolved per file; a required row stops a file that lacks the field.

A lower quantile limit around 0.05 to 0.2 on photons is a way to drop the dimmest localizations without knowing how bright the dye is. For bounds that must mean the same thing in every file – a precision, a z range – use absolute values.

remove filtered
remove
offDrop the localizations no layer keeps from the table, and so from the saved file.

Leave it off unless the saved files are meant to contain only what passed: what is removed is not in the saved file, and no later filter brings it back.

Output

Differences from SMAP

SMAP has no counterpart as a plugin: its layers and filters are set by hand in its render panel. Dropping the filtered localizations was an option of SMAP's writer, only save visible in File/Save/SMLMsaver; here it is remove filtered, a step of its own, so that it is in the log. Quantile bounds, resolved per file, are new.