Save localizations

File › Export · version 1

Write the localizations for another program: csv, ThunderSTORM's csv,

What it does

Writes the localizations to a file for another program: a text table (csv), the same table with the column names ThunderSTORM uses (Ovesný et al. 2014), or Picasso's HDF5 file (Schnitzbauer et al. 2017).

It is not Save. Save writes everything this program knows about the data – the table, its history, the ROIs and their results, the GUI – in this program's own file, to be opened here again. Export writes the table alone, in a form another program reads, and only the part of it asked for:

How it works

1. The table. The layer's table, or the localizations or merged blinks whatever the layer shows, cut to what the layer shows when localizations is visible.

2. The format. Chosen, or taken from the file's name: .csv, .tsv or .txt is a text table, .hdf5 or .h5 Picasso's file.

3. The file. A text table has one header line and one row per localization, separated by commas in a .csv and by tabs in a .tsv or .txt. Picasso's file is written as Picasso writes it, with its .yaml beside it.

In detail

Text. Whole numbers (frame, channel, ids) are written as whole numbers, everything else with 9 significant digits – enough to give back a single-precision value exactly. With smappy's names, the attributes are written under their names here and frames count from 0, so Load from path reads the file back as it was. With ThunderSTORM's names the usual attributes are renamed and frames count from 1, as ThunderSTORM's own export does; the attributes ThunderSTORM has no name for keep this program's:

here ThunderSTORM
x_nm, y_nm, z_nmx [nm], y [nm], z [nm]
photonsintensity [photon]
backgroundoffset [photon]
sigma_nmsigma [nm]
xy_err_nm, z_err_nmuncertainty_xy [nm], uncertainty_z [nm]
frameframe, plus 1

Picasso. Picasso's file is one dataset of records, /locs, with positions, widths and precisions in camera pixels – so the table must know its pixel size, which a fitted one does – and z in nanometres:

Picasso from
frameframe
x, yx_nm, y_nm over the pixel size
photons, bgphotons, background
sx, sysigma_nm (and sigma_y_nm) over the pixel size
lpx, lpyx_err_nm, y_err_nm, or xy_err_nm, over the pixel size
ellipticity of sx and sy, as Picasso works it out
net_gradient0: a number of Picasso's own spot detection, which this program does not have
z, lpzz_nm, z_err_nm, for a 3D table
groupthe Picasso group attribute, if one is chosen
len, n, photon_ratefor merged blinks only: see below

A field the table has no attribute for is written as 0, and the text says which. The metadata Picasso needs – Width, Height and Frames – and the Pixelsize go into the file (/metadata, as Picasso 0.9 and later embed it) and into a .yaml beside it (for older versions). The width and height are the camera region the fit read where the table records it, and otherwise as many pixels as the positions need – but never less than the file the table was read from, if that was Picasso's. Picasso throws away, without saying so, every localization with a value missing, a negative position, width or precision, or a position outside the image; the export leaves those out itself and says how many.

Merged blinks are written as Picasso writes a linked table, in which each row is one binding event: n is the number of localizations merged into it (n_in_group), len the frames from its first to its last, dark frames bridged by the merge included – three localizations in frames 10, 11 and 13 are n 3 and len 4 – and photon_rate its photons over n. The merged table keeps only where a blink starts, so its last frame is read from the localizations it was merged from. The localizations themselves are written without these three fields, as Picasso's unlinked files are. A table read from a linked Picasso file keeps the len and n it came with.

The metadata. Picasso's metadata is a list, one entry for each step that made the file, and Picasso reads a value from the last entry that has it. A table read from a Picasso file keeps that list, and the export appends one entry of its own – smappy and its version, the image size and pixel size, and the steps of the session's history that changed the table, with their settings – as Picasso's own steps do. So a file that goes from Picasso to here and back still says what Picasso did to it, followed by what was done here.

Parameters

settingdefaultwhat it does
file
path
–Where to write; .csv, .tsv, .txt or .hdf5.
format
format
by the file nameWhat to write; by the file name means a csv for a text suffix and Picasso's for .hdf5. Choices: by the file name; csv (smappy's names); csv (ThunderSTORM's names); Picasso HDF5; smappy HDF5, the table only
localizations
localizations
visible: filter and ROIWhat the layer shows, or the whole table. Choices: visible: filter and ROI; all
table
grouping
as the layer shows itThe localizations, or one row per blink. Choices: as the layer shows it; localizations; merged blinks
attributes
columns
The attributes to write; all ticked writes every attribute, also those a later table adds.

Untick what the other program does not need: a table of x, y and frame is a third of the size of the whole one. With every box ticked, every attribute the table has when it runs is written – also one a later plugin adds – which is what a chain or a batch wants.

Picasso group
group
–An id attribute written as Picasso's group, its picks: cluster_id, molecule_id, pick_id, ...

Picasso shows its picks by this attribute. Writing cluster_id there, for example, makes every cluster a pick in Picasso; leave it on none for a plain table. Every id attribute is offered – any whose name ends in _id, such as cluster_id, molecule_id or a Picasso file's own pick_id – and any other whole-numbered one. On merged blinks an id is a number per blink, written as a whole number; a blink with none is written as -1.

Output

The file, and a line saying how many localizations went where, in which format; for Picasso, also what was left out or written as 0. The export is written into the history, since where a file went is not visible in the file.

Differences from SMAP

Based on SMAP's export_coordinates and export_picasso_hdf5 (Ries 2020), one plugin here. The main changes:

References