Analysis › Regions · version 1
Centres every used ROI, turns it to one orientation and superimposes
One copy of a small structure – a nuclear pore, a kinetochore, a synapse – holds few localizations, and a missing label or a stray blink can make it look like something else. Many copies, laid on top of each other, hold many, and show the structure as it is on average. This plugin does that: it takes every used ROI (region of interest: a shape kept in the ROI manager, inside which things are measured), moves its centre to one point, turns it so that it points one way, and writes all of them, superimposed, into one new table.
The centre is the ROI's own centre, a centre that was measured in it (by Cluster shape, say), or a point of a line drawn on it in the ROI manager. The orientation is none, the ROI's own angle, a line drawn on it, or an angle that was measured. For a structure without a direction, such as a pore seen from the top, a centre is enough. For one with a direction, turn each ROI in the ROI manager (rotate, then its handle) or draw a line along it (Line), and turn by that.
The new table is added to the session as a file of its own, beside the data, and can be rendered, filtered and measured like any other. It holds the localizations themselves, not merged blinks, with every attribute they had.
1. Each ROI's place and turn. For every used ROI the plugin works out two things. Its centre: the ROI's centre, the measured x value and y value, or the start, middle or end of a named line. Its angle: 0, the angle of a named line, or a measured angle value. An ROI that lacks one of them – no line of that name, nothing measured – is left out, and the line under the panel says how many and why.
2. Moving and turning. Each localization of the ROI is moved so that the centre lies at (0, 0), and turned about it by minus the angle. A line at 30° then lies along +x, so every ROI ends up pointing the same way. The localizations are all those inside the ROI's shape, not only those a layer's filter (the lowest and highest values a localization's attributes may have) shows – unless only what the layers show is ticked.
3. One table. The moved localizations of all ROIs go into one table, each with roi_id, the number of the ROI it came from. The table keeps every other attribute, so a layer that filters on channel still shows one colour of a two-colour average.

Twenty-five copies of an arrow of three labels (circles), each turned at random. Left: four of them in their ROIs (green), with the line drawn along each (magenta). Middle: superimposed on their centres only, the arrow is smeared into rings. Right: turned by their lines as well, the three labels come back where they are.
The turn. A localization at of an ROI with centre
and angle
goes to
SMAP's rotcoord. A line's angle is from its start to its end, as the ROI manager writes it into
<line>_angle_deg, so the line's start goes to and its end to
. A line drawn the wrong way round turns its ROI by 180°: Reverse in the ROI manager fixes it. The images show
downwards, so the average comes out as the ROI manager shows the ROIs, turned until their lines point to the right. A measured angle value is read the same way, in degrees from
towards
; an axis measured without a direction, such as Cluster shape's
angle_deg (0 to 180°), leaves the average with a two-fold ambiguity.
Measured values are read from the results table as the ROI manager shows it: the current results of each included ROI, by the column's name there (centre_x_nm, or Cluster shape.centre_x_nm when two steps write it), and the lines' <line>_angle_deg. A centre is in nm, in the coordinates of the data, not relative to the ROI. An ROI whose results are out of date has none, and is left out.
Frames. Merging blinks links localizations in consecutive frames that lie close together. After superimposing, two ROIs' blinks in the same frames lie close together, and would be merged into one. So each ROI's frames are moved past the previous one's: the -th ROI's frames have
added, with
one more than the largest frame of the table. The frame in its own file is kept as
frame_in_file.
Where it goes. The average is centred on (0, 0), so x_nm is the position along the orientation and y_nm across it. z is not turned or moved.
| setting | default | what it does |
|---|---|---|
| centre | ||
centre oncentre.by | the ROI's centre | The point of each ROI that goes to (0, 0). the ROI's centre suits ROIs placed on their structures by a segmenter, or moved onto them by Centre ROIs. For ROIs drawn by hand, or a structure whose centre is better found than guessed, measure the centre first and use measured values: |
x valuecentre.x | centre_x_nm | The column of the results table with the centre's x, in nm (Cluster shape: centre_x_nm; Circle fit: x_nm). |
y valuecentre.y | centre_y_nm | The same for y. |
linecentre.line | line | The line whose point is the centre. |
pointcentre.point | its middle | Which point of the line. Choices: its start; its middle; its end |
| orientation | ||
turn byorientation.by | as it is | What each ROI is turned by, so that it points along +x. as it is averages without turning: right for a structure without a direction, or one imaged always the same way round. the ROI's angle is the angle each ROI was turned to in the ROI manager, whether or not rotate is ticked there – the same turn that shows its structure along |
lineorientation.line | line | The line that ends pointing along +x. |
angle valueorientation.angle | angle_deg | The column of the results table with the angle, in degrees from +x towards +y. |
only what the layers showfiltered | off | Only the localizations that pass a layer's filter; off: every localization in the ROI. Off, as SMAP: every localization in the ROI, whatever the layers' filters. On, those that pass the filter of at least one localization layer – the same photons or precision cut as the picture. |
write tooutput | a new file | A file added to the session, beside the data; or in place of the table (undoable). a new file keeps the data and puts the average beside it, as file of its own: show it in a layer that shows that file. the table replaces the session's table with the average; Edit > Undo brings the data back. Choices: a new file; the table |
A new file, average of N ROIs, holding the superimposed localizations with roi_id and frame_in_file beside their own attributes. The figure shows the average as a 2D histogram, with along the orientation, and its profiles along
and
. A sharp average with the structure's features in place is good; rings or a smear where the structure has corners means the orientation is wrong for some ROIs – lines drawn the wrong way round, or an angle without a direction.
Based on SMAP's AverageSites and its variants AverageSites_kinetochore, _window and _NPC (Ries 2020).