TrackNTrace: A simple and extendable open-source framework for developing single-molecule localization and tracking algorithms

Super-resolution localization microscopy and single particle tracking are important tools for fluorescence microscopy. Both rely on detecting, and tracking, a large number of fluorescent markers using increasingly sophisticated computer algorithms. However, this rise in complexity makes it difficult to fine-tune parameters and detect inconsistencies, improve existing routines, or develop new approaches founded on established principles. We present an open-source MATLAB framework for single molecule localization, tracking and super-resolution applications. The purpose of this software is to facilitate the development, distribution, and comparison of methods in the community by providing a unique, easily extendable plugin-based system and combining it with a novel visualization system. This graphical interface incorporates possibilities for quick inspection of localization and tracking results, giving direct feedback of the quality achieved with the chosen algorithms and parameter values, as well as possible sources for errors. This is of great importance in practical applications and even more so when developing new techniques. The plugin system greatly simplifies the development of new methods as well as adapting and tailoring routines towards any research problem’s individual requirements. We demonstrate its high speed and accuracy with plugins implementing state-of-the-art algorithms and show two biological applications.


Supplementary
. Example of parameter settings graphical user interface (GUI). The GUI is rebuilt when choosing a different candidate detection, refinement, or tracking plugin according to the plugin settings. A tooltip is displayed for each parameter when hovering the mouse above. Clicking the Preview button opens the visualizer and lets the user inspect the outcome of the data analysis given the current settings. If satisfied with the current parameter set, the two bottom right buttons will save all settings and either move to the next chosen movie or start processing, or use the same settings for all following movies. a b Supplementary Figure 2. Localization and 3D orientation estimation of defocused single molecules. Atto655 molecules were spincoated on a glass surface with a concentration of 0.1 nM and excited with 640 nm at an average power of 0.5 to 1 kW/cm 2 . The emission was filtered with a 690/40 bandpass and imaged with a 1.49 NA 100x TIRF objective. The exposure time was 10 seconds with an EM gain of 3 to 5. The defocusing was about 1 micron. Molecules were detected using the Defocused patterns candidate plugin and these detections refined to sub-pixel accuracy with the Defocused refinement plugin. (a) Output of the Defocused refinement plugin in the TrackNTrace visualizer. All parameters, like in-plane and out-of-plane angles of the dipole, estimated by the plugin are shown when selecting a detected candidate. (b) Computer generated image using the estimated positions, amplitudes and orientations of the detected molecules. This output is generated by the plugin and displayed through the TrackNTrace visualization interface.

TrackNTrace plugin system
To give an example of the plugin creation process, let us turn the Radial Symmetry (RS) software [1], which is fully written in MATLAB, into a TrackNTrace plugin. The software can be downloaded from the supplementary files of which only the main function, radialcenter.m, is needed. The first step is to define the header: The RS algorithm can be used to determine the precise position of an already detected, radially symmetric spot, as such, it belongs to the "refinement" category which has the type number 2. The function refinePositions_radialSymmetry implements the actual algorithm on each frame of the movie. Optionally, one can also give a description of the output parameters for plotting purposes as shown here, before invoking the plugin build function. Finally, a mandatory description is added and the input parameters are defined so they can later be set by the user in the TrackNTrace graphical user interface (GUI).
Finally, one needs to add the main function refinePositions_radialSymmetry which serves as an interface between the RS function radialcenter and TrackNTrace and is called once for every movie frame. The former expects a subimage containing only one particle. The latter provides the movie frame, a list of the position estimates or candidate particles, all input options defined in the above step in the form of a MATLAB struct, and the frame index. Thus, the interface function must prepare subimages for each candidate, call radialcenter, and save the refined positions: The size of the subimages is determined by the input parameter PSFSigma as defined in the header. The rest of the function is straightforward: After allocating the output memory, the function loops over every candidate, calculates the subimage coordinates, calls radialcenter, and converts back to image coordinates before saving the output.
The input and output data structure is rigid, hence the function declaration, handling of input variables, and the number of output variables has to follow a certain standard laid out in the software manual and the accompanying plugins. In most cases, software code like the above example can be assembled within minutes by copying existing code with some minor modifications.

Supplementary software
TrackNTrace is implemented in MATLAB and currently runs on Linux and Windows. It can be obtained from its GitHub repository https://github.com/scstein/TrackNTrace.