Analysis › After fit · version 2
Move the localizations of a split camera's second half onto the first, by a registration from a file, fitted beads or bead movies; channel is the half.
Some two-colour experiments use a split camera: a dichroic mirror sends one dye's light to one half of the chip and the other dye's light to the other half. When the two dyes are spectrally well separated, each molecule is seen in one half only. There is no photon ratio to measure, and nothing to pair, so the two-colour fitters, which fit every molecule in both halves at once, are the wrong tool.
Instead the movie is fitted with a one-colour fitter (Gaussian 2D or Spline 3D) with channels > read set to two channels. Each half is then detected and fitted on its own, and every localization keeps the half it was found in, camera_channel (0 the main half, 1 the other). The two halves are still two pictures side by side. This plugin puts the second one on top of the first.
To do that it needs the registration between the halves: the map that says where a point seen in the second half is in the first. That map is measured on fluorescent beads, which shine in both halves. It comes from one of three places:
The last two keep what they measured beside the beads and use it again, so a day of samples against one bead folder fits the beads once.
The bead map is used as it is. The beads are imaged before or after the sample, and in between the splitter, the focus or the temperature may move one half against the other by some nanometres; the two dyes' colours can also differ from the beads'. Where that matters, and the two dyes label structures that lie together, the shift that is left can be measured on the overlaid table with Register layers, one layer per channel, and taken out with Transform. Whatever the structures, Raw channel offset measures how far the map is off from the dyes' crosstalk in the raw frames, per region of the field.
Every fitter offers this plugin as a step of its *after the fit*, overlay channels, so a fit can come out overlaid. There the beads are fitted with the fitter's own camera and arrangement.
1. Fit the sample as two channels. Each half is detected with its own threshold and fitted on its own. The positions are where each half saw the molecule on the camera chip, so before this plugin the second dye's localizations sit in the other half of the picture.
2. The registration from beads. Beads shine in both halves, so every bead is a pair of localizations in the same frame. The pairs are found and the map is fitted exactly as in Calibrate transform, whose page explains it: a vote for the offset between the halves, then pairing and refitting at a shrinking distance, with a projective or a polynomial map. For bead movies the plugin first fits them with Gaussian 2D on two channels, in the arrangement and with the camera the sample was read with. A bead's centre is all a 2D registration needs, whatever model fitted the sample.

Simulated beads, fitted as two channels and registered: the vote for the offset between the halves, the pairs' residuals after the fit, and where in the main half the pairs are. A sharp vote, a tight residual and pairs over the whole field are what a usable registration looks like.
3. Kept beside the beads. With keep the registration on, what was measured is written as <name>_2ct.h5 beside the bead movie, the folder or the bead file, together with which bead files it came from and the settings it was measured with. The next run that names the same beads with the same settings reads it instead of measuring again. When a bead file changes, or a setting does, it is measured again and the file is replaced.
4. Move the second half. The localizations with camera_channel 1 are moved through the map onto the main half. The main half's are not moved. channel, the dye, is then written from camera_channel, so the Render tab's layers can show one dye each.

How far each overlaid localization of the second dye is from the true molecule, for the isolated spots of the simulated sample. Both distributions are centred on zero: the bead map has put the second half onto the first, and what is left is each localization's own precision.
Where the halves are. The registration lives in camera-chip pixels. The table's nm columns are put back into chip pixels with the pixel size the table records, the map is applied, and the result goes back into nm. The fit records where on the chip it found its two halves, and so does the registration. When the two disagree, the beads were fitted in another arrangement than the sample, and the run says so in a warning. A table whose second half has already been moved is refused: moving it twice is never what is meant, and undo puts it back.
The bead fit. Gaussian 2D, channels on two channels, the dynamic cutoff of the bead fit part, and at most at most frames of each movie. Everything else is the fitter's default. The camera is the fitter's own when this runs as its step. Run on its own, it is what the table recorded of its camera (conversion, offset, EM gain, pixel size), and else what the bead files and the camera database say, as for any fit. The movies of a folder are every image stack directly in it; each one's frames are kept apart from the others', so no bead is paired across two movies.
Keeping it. A registration is used again when the file's record of its beads matches: each bead file's full path, size and time of last change, and every setting it was measured with – the arrangement, the registration's settings, and for movies the bead fit's settings and the camera. The file goes beside the movie or the folder, not inside the folder, which stays images only. For one bead movie this is the same name Calibrate transform proposes, <movie>_2ct.h5.
No correction from the sample. An earlier version corrected the bead map with crosstalk pairs in the sample: a molecule and the few percent of its light in the other half, in the same frame. On a real two-dye movie its pairs were mostly chance meetings and badly fitted spots, and in the dense first frames it applied a 100 nm shift that the real pairs did not support; the crosstalk of a dim dye, some 15 photons a frame, is not found at all. So the bead map is used as it is, and a shift left between the dyes is measured, where the structures allow it, by correlating the two channels' images with Register layers.
| setting | default | what it does |
|---|---|---|
transformation fromsource | transformation file | A saved registration, beads already fitted as two channels, or bead movies to fit. transformation file for a registration you already trust. fitted beads when the beads were fitted by hand, for instance to check them first. bead movies to have everything done here: the usual choice in a fitter's after the fit. Choices: transformation file; fitted beads; bead movies |
filepath | – | A _2ct.h5 (Calibrate transform, or this plugin's), or a dual-colour bead calibration. A dual-colour bead calibration from the PSF calibration window works too: its registration is used and its PSFs are not. |
fitted beadsbeads_table | – | Bead localizations fitted with channels > read: two channels. Fit the beads with the same arrangement as the sample, channels > read on two channels. Several bead positions in one file are fine. |
bead moviesbeads | – | A folder of bead movies, or one movie's path; beads seen in both halves. The browse button picks a folder; a single movie's path can be typed. Image stacks the camera wrote, at a few positions over the field, so the pairs cover it: a registration is an extrapolation where there were no beads. |
| bead fit – How the bead movies are fitted: Gaussian 2D, two channels, the sample's camera. | ||
cutoffbead_fit.cutoff | 1.7 | The detection threshold, in units of the filtered frame's noise (the fitters' dynamic cutoff). Beads are bright, and the default finds them. Raise it if dirt or dim specks are paired too; lower it for dim beads. at least 0.1 |
at mostbead_fit.max_frames | auto | Frames fitted per bead movie; auto: all. A registration needs a few hundred pairs, not every frame of a long bead movie. Leave it on auto for short movies; set it to a few hundred frames for long ones, to save time. at least 1 frames |
| channels – Where a split chip's two channels lie: the microscope's entry, or chosen by hand. | ||
layoutchannels.layout | the microscope's | How the chip is split: the microscope's entry, or chosen by hand with the main channel and the split. The microscope's entry says how its chip is split. Choose it here only for a microscope without one; in a fitter's step the fitter's own is used. Choices: the microscope's; right-left; right-left mirrored; up-down; up-down mirrored |
main channelchannels.main_channel | the microscope's | The channel the other is registered onto: the microscope's (its transmitted arm), or either half, to swap them. Which half the other is moved onto: the microscope's (its transmitted arm), or the other half to swap them – with the microscope's layout too. In a fitter's step the fitter's own is used. Choices: the microscope's; left; right; upper; lower |
split position (more)channels.split_position | auto | The first pixel of the second channel, on the chip, for a layout chosen by hand; empty: the middle of the frame. Only for a split away from the middle of the chip. at least 1 px |
| registration – How a registration between two channels is measured: the vote, the pairing and the fit. | ||
transformationregistration.model | projective (8 coefficients) | Projective extrapolates gracefully; the polynomial describes a distorted field far better where the pairs reach, and is refused when they do not reach far enough. As in Calibrate transform: projective is safe everywhere; polynomial also follows the field's distortion where the bead pairs cover the field. Choices: projective (8 coefficients); polynomial, order 3 (20) |
vote bin (more)registration.vote_bin_px | 2 px | The bin of the histogram of pair vectors the offset is voted in. at least 0.1 px |
vote smoothing (more)registration.vote_smooth_px | 4 px | The width of the difference-of-Gaussians filter the vote is scored with. at least 0.1 px |
coarse matchingregistration.coarse_tolerance_px | 20 px | First pass; must cover the rotation between the channels – 3 degrees over 512 px is 27 px. at least 0.1 px |
fine matchingregistration.fine_tolerance_px | 1 px | Second pass over clean matches only, which is where the accuracy comes from; 0 skips it. |
adapt fine matching (more)registration.adapt_fine_tolerance | on | Widen the fine matching to what the coarse fit misses its own pairs by, when those pairs are clean. |
minimum pairs (more)registration.min_pairs | 20 | Fewer pairs than this and the registration refuses. at least 4 |
pairs used in the fit (more)registration.max_pairs | 20000 | At most this many pairs, drawn at random, go into each fit. at least 4 |
outlier threshold (more)registration.reprojection_threshold_px | 1 px | The robust (RANSAC) fit's inlier radius, at least; it widens with the matching tolerance. at least 0.01 px |
dx/dy limit (more)registration.transform_axis_limit_px | 0.5 px | The largest |dx| or |dy| a pair may keep after the first fit, at least; it widens with the matching tolerance. at least 0.01 px |
keep the registrationsave | on | Write it beside the beads as <name>_2ct.h5 and use it again while the beads and these settings are unchanged. Leave it on unless the bead folder is read-only. Turn it off to measure the registration afresh on every run. |
The table with the second half moved onto the first, and channel written: 0 for the main half's dye, 1 for the other's. The move is recorded in the table's metadata with the map that was used, and the _2ct.h5 it is kept in when it is in one, and is one step of the undo.
The output says how many localizations were moved, where the registration came from (a file, measured now, or measured before on the same beads), the and the bead pairs' residual when it was measured now: a few hundredths of a pixel is a good registration, a tenth or more one to look at in the figure.
The figures: beads – the vote, the residuals and the pairs' coverage, as in Calibrate transform, when the registration was measured in this run.