Raw channel offset

Localize · version 1

How far the bead map between a split camera's halves is off in the sample: the crosstalk of every molecule into the other half, summed from the raw frames where the map puts it; per region, with a shift or affine correction for Transform.

What it does

On a split camera with one dye in each half, the two halves are put on top of each other by a map measured on fluorescent beads – the registration, made by Overlay channels or Calibrate transform. The beads were imaged at another time than the sample, and in another colour than the dyes. So in the sample the map can be off by some nanometres, and nothing in the localizations shows it: each molecule is found in its own half only.

But a few percent of each molecule's light reaches the other half too – crosstalk. For one molecule it is far too dim to detect, a dozen photons over the background. Summed over a hundred thousand molecules it is a bright, sharp spot. Where that spot lies, compared with where the map puts the molecule's partner, is how far the map is off – measured in the sample, with the dye's own light.

This plugin makes that sum from the raw frames. It reports the offset for each direction (main half into the other, and back), the fraction of light that leaks, and the offset in regions of the field. From the regions it fits a correction, a shift or an affine map, which Transform applies to the overlaid table on request, and which can be folded into a corrected copy of the map for the next sample. It changes nothing by itself.

It needs:

A direction in which no light leaks – one dye may not reach the other half at all – is reported as such. The other direction is then enough.

How it works

1. The molecules. Every well-fitted localization of one half – photons above min photons, a width within 0.6 to 1.6 times the half's median – whose partner, where the map puts it, lies inside the other half. A molecule is left out when a localization of the other half lies in its patch, in its frame or in the control frame: a molecule of the other dye is on there, and its light would swamp the crosstalk.

2. The patches. Around where the map puts the partner, the raw frame of the other half is cut: a square of patch pixels on each side of the nearest whole pixel. The same square of the frame control frames later is cut too. What does not blink – autofluorescence, haze seen in both halves – is in both and cancels; a molecule is on for a few frames, not fifty.

3. The sum, finer than a pixel. Each molecule's partner lies somewhere within its pixel. Every pixel of its patch is added, unchanged, to a grid four times finer than a camera pixel, at its exact distance from the predicted position. The molecules lie at all sub-pixel positions, so together they fill the fine grid: an image of the crosstalk sampled at a quarter pixel, without resampling any frame.

4. The spot. A Gaussian fitted to the sum (less the control) gives the spot's centre. Its distance from the centre of the grid is how far the map is off. The width says whether it is a spot at all; the spot's brightness, divided by the same sum made at the molecules' own positions, is the fraction of light that leaks.

The summed crosstalk of the simulated sample, each direction a panel: the cross is the fitted centre, the circles one and two widths, the white plus where the map puts the partner. The upper dye leaks 8 % of its light, and the spot is clearly off the plus; the lower dye leaks none, and the panel is noise.

5. Regions and the correction. The same is done in each of regions x regions parts of the field. The two directions are combined in each region, weighted by their errors. A shift or an affine map (shift, rotation, scale and shear) is fitted to the regions' offsets, and kept under name as a transformation that Transform applies. With save corrected map on, the map with the correction folded in is also written beside the map, as <map>_raw_2ct.h5, for Overlay channels to use.

The offset in each region of the simulated field (blue arrows, greatly enlarged; the numbers in nm with their errors) and the shift fitted to them (grey). The simulated map is off by the same 12 and -8 nm everywhere, and every region finds that, within its error.

In detail

The sum. For molecule the map predicts the partner at ; the patch is cut around the nearest whole pixel , and pixel of it lies at from the prediction. With the frame and the control lag, bin of the fine grid (a quarter pixel) holds

the sum, the number of pixels that landed in it and their mean offset. The fit puts the value at , not at the bin's centre. When the molecules sit at every sub-pixel position the two are the same. When they all sit alike – beads, or a sample on a regular grid – every pixel is rounded to its bin's centre in the same direction, and the whole spot moves by up to half a bin (16 nm on a 127 nm pixel). The mean offset carries no such error.

A spot 10 nm off its prediction, summed from 40,000 simulated molecules that all lie 0.2 px right of a pixel's centre, fitted with each bin at its centre (orange) and at the mean offset of its pixels (blue); the line is the truth. Rounded to the centres, every pixel moves the same way and the spot with them.

The spot. A circular Gaussian plus a constant,

fitted by least squares with each bin weighted by . The centre is the offset in the other half; is the leaked light per molecule, in the camera's raw units. The same fit at the molecules' own positions gives their own , and the fraction that leaks is : the camera's offset and gain cancel, so no camera calibration is needed.

The errors. The frames are cut into 8 blocks, each summed and fitted on its own, and the error of every number is the spread over the blocks divided by . On simulations it came out about a third smaller than the scatter between repeated simulations: treat a difference of three errors as borderline. A direction counts as measured when its leaked fraction is more than five times its error.

Into the main half. An offset measured in the secondary half (main dye leaking into it) is turned into what the map is off by in the main half, at the molecules' place : , with the map from the secondary to the main half. One measured in the main half (secondary dye leaking into it) is already that. Both are "where the molecule is, less where the map puts its partner": the amount the map should add.

The correction. The regions' offsets at their places are fitted with (shift) or (affine), each axis weighted by the inverse variance of each region's offset. It is kept as the affine map in nm. Transform applies it to the overlaid table's channel 1, whose positions are the map's. The corrected map is that correction after the map, , and is written only for a projective map; a polynomial one cannot take it, and the plugin says so.

What it measures. The crosstalk is one dye's light in the other half: the offset is the map's error at that dye's colour. The other dye's colour in its own half is not measured, and on a microscope with lateral chromatic error the two differ. With both directions measurable, the combination averages the two colours.

Parameters

settingdefaultwhat it does
raw frames
raw
–The movie the table was fitted from; auto: the one it records, or a file of that name near the table.

Leave it on auto while the movie is where the table says or near the table. The plugin reads it frame by frame; over a network share, 10,000 frames of 435 x 213 pixels took about a minute.

channel map
registration
–The bead map (_2ct.h5); auto: the one Overlay channels moved the table with.

auto takes the map from Overlay channels' record in the table. Choose a _2ct.h5 for a table that was not overlaid, or to test another map against the same sample.

first frame
start
autoAuto: the middle of the fitted frames.

auto takes the frames from the middle of the fitted range. The first frames are often too dense for single molecules, and the crosstalk sum wants frames where molecules blink apart.

frames
frames
10000How many frames are read: about 1.5 nm per 10,000 on a typical movie.

The precision grows with the square root of the molecules. On a movie with about 15 well-fitted molecules a frame, 10,000 frames measured the offset to about 1.5 nm.

at least 100
regions
grid
3The field divided into n x n regions, each measured on its own.

1 gives one offset for the field; 2 or 3 show whether it changes across the field, and an affine correction needs at least 2. Each region needs thousands of molecules.

1 to 6
correction
model
shiftWhat is fitted to the regions' offsets.

shift when the regions agree within their errors; affine when they show a gradient – a small difference in magnification between the bead colour and the dye's is a common cause.

Choices: shift; affine
name
name
–What the correction is kept as for Transform; auto: raw channel offset.

Running again with the same name replaces the kept transformation.

save corrected map
save
offAlso write the map with the correction as <map>_raw_2ct.h5, for Overlay channels.

The corrected map is written beside the map file (<map>_raw_2ct.h5), so choose a map in a folder you can write to. It needs the map's file: auto finds it from the table when Overlay channels recorded it.

min photons (more)
min_photons
300Molecules dimmer than this are left out.

Dim molecules leak too little light to help, and add their patches' noise.

control (more)
lag
50 frames laterThe control frame: what is still there this much later is background.

Far enough that a molecule blinking now is off again, near enough that the background has not changed: 50 frames suits typical blinking. Too short and the molecule's own light is subtracted; too long and slow background changes stay in.

at least 1 frames later
patch (more)
radius
5 pxHalf the width of the patches summed.

At least three PSF widths. Larger patches hold more of the other dye's molecules, which leave a molecule out of the sum.

3 to 10 px

Output

The text gives, for each direction, how many molecules were summed, the fraction of their light that leaks, the offset of the map in nm with its error, and the spot's width. Then the correction fitted to the regions, how far the regions scatter about it compared with their errors, and the name it is kept under. A scatter much larger than the errors means the model is too simple: try affine, or more regions.

The figures: the summed crosstalk of each direction with its fitted spot, and the offsets of the regions with the correction. A sharp spot of about the PSF's width is a measurement; a flat or noisy panel is a direction in which nothing leaks.

The form's notice offers Apply with Transform once the correction is kept, set to move channel 1 of the overlaid table.