Introduction

Microtubules are dynamic filaments essential for many cellular processes such as intracellular transport, cell motility and chromosome segregation. They assemble from dimeric αβ-tubulin subunits that polymerize in a head-to-tail fashion into polar filaments1 (Fig. 1). Microtubules show a behavior termed dynamic instability, which can be empirically described by four parameters: (1) the polymerization velocity at which microtubules grow (vg), (2) the depolymerization velocity at which microtubules shrink (vs), (3) the catastrophe frequency at which microtubules switch from growth to shrinkage (fc), and (4) the rescue frequency at which microtubules switch from shrinkage to growth (fs)2. This dynamic behavior is intrinsic to microtubules. In a cellular context, however, the dynamic properties of microtubules are modulated by motors and accessory proteins known as microtubule associated proteins (MAPs)3,4,5,6,7. In most cases, the cellular context is too complex to study a single protein’s contribution to microtubule dynamics. Therefore, biochemical activities of individual proteins have primarily been characterized in vitro using purified components and total-internal reflection fluorescence (TIRF) microscopy8,9,10,11,12,13,14,15,16,17. Furthermore, microtubule dynamics are strongly affected by a set of drugs routinely used to treat diseases such as cancer18 and malaria19. Owing to their clinical relevance, it is a viable need to understand the exact regulation of microtubule dynamics by a given drug and thereby elucidate the underlying molecular mechanisms. Given the growing interest in biochemical reconstitution systems3,4,20, automation of data analysis will unveil the full potential of the experimental approaches as described above.

Figure 1
figure 1

Microtubule Dynamics by TIRF Microscopy. (a) Schematic experimental design: Stabilized microtubule seeds (red) are bound to the coverglass by antibodies and serve as nucleation points for dynamic microtubules (green). One microtubule end usually shows higher growth rates (+) than the other end (−). Total internal reflection fluorescence (TIRF) microscopy selectively excites fluorophores in a restricted volume adjacent to the glass-water interface allowing the visualization of individual microtubules. (b) TIRF microscopy image of dynamic microtubules (green) grown from stabilized seeds (red). Scale bar: 10 µm.

Quantitatively deriving dynamic microtubule parameters from fluorescence microscopy images by manually creating and analyzing kymographs (spatial position over time) is still common practice21. This limits the collection of statistically significant amounts of data. Moreover, manual analysis can bias data collection and introduce variability. Thus, methods have been developed that allow microtubule detection and/or tracking22,23,24,25,26,27. However, to date, there is no fully automated workflow that provides detection and tracking of microtubules followed by automated data analysis and statistics collection. Here, we present the software MTrack, which detects, tracks, measures, and analyses the behavior of fluorescently labeled microtubules imaged by TIRF microscopy (Supplementary Fig. 1). MTrack is capable of automatically identifying and tracking dynamically growing microtubules that potentially bend and cross with subpixel resolution, even at high growth rates and low signal-to-noise ratios (SNR) using advanced objection recognition and robust outlier removal. The software is easily accessible for users and developers since it can be automated and is provided as an open-source Fiji28 plug-in.

Results

The MTrack software is organized in two consecutive modules that can be run independently. The first module robustly detects microtubule seeds and tracks dynamic microtubules over time. The second module interprets the length over time plots to extract relevant parameters of dynamic instability and population statistics.

Robust Detection of Microtubule Seeds using MSER and Sum of 2D Gaussians

A common way to reconstitute and analyze microtubule dynamics is by the use of TIRF microscopy and fluorescently labeled tubulin14,16. Stabilized (non-dynamic) fluorescent microtubule seeds are immobilized onto glass surfaces. These microtubule seeds serve as nucleation points from which dynamic fluorescent microtubules will grow (Fig. 1). Previous microtubule tracking software relies on manually clicking each individual microtubule to be analyzed23,27. Therefore, our aim was to develop an approach that robustly detects microtubule seeds in the image in a fully automated fashion. It is essential to precisely determine the exact end point of each seed, as these are the sites from which microtubules will subsequently grow and shrink. MTrack does so by using the Maximally Stable Extremal Regions (MSER) algorithm29,30 to identify image areas belonging to each seed, a sum of 2D Gaussians (SoG) model to accurately localize individual seeds, and finally a Gaussian Mask fit31 to determine the precise end point of each seed with subpixel resolution (Fig. 2a).

Figure 2
figure 2

Microtubule Seed Detection. (a) The default algorithm to identify microtubule seeds as objects is Maximally Stable Extremal Regions (MSER). 1. Microtubule seeds detected by MSER are marked by fitted red ellipses. 2. To determine the extact end point of each microtubule seed, a sum of 2D Gaussian model is fit to the major axis of the ellipsoid. FWHM (full width at half maximum) of the PSF (point spread function) is determined experimentally. 3. Detected end points are marked by green circles. (b) Detection accuracy of microtubule seeds with a close to 100% accuracy when the distance between seeds is larger than 5 pixels. Detection error is marked in yellow. (c) Subpixel accuracy of microtubule seed end point detection depends on SNR. Values correspond to detection errors in pixels.

The principle underlying MSER is a component tree, which computes every possible threshold of the image thereby increasing the dimensionality of the input image by one (e.g. 2d > 3d, Supplementary Movie 1). Stable regions within the component tree are those that do not significantly change over multiple thresholds. Since microtubules can vary in size, are randomly oriented, potentially bent, and are the main bright objects in the fluorescent image, the MSER detector performs accurately without the need to make assumptions about shape, orientation, and size of regions. Successfully detected microtubule seeds show a one-to-one assignment to ellipsoidal regions (Fig. 2a). Even for low SNRs, the overall detection accuracy mostly depends on the density of microtubule seeds (Fig. 2b). MTrack detects seeds with a close to 100% accuracy when the distance between seeds is larger than 5 pixels, which is experimentally feasible. Using the region identified by MSER, we fit a SoG model (see Supplementary Material) using the major axis of the ellipsoid as a starting point to detect the accurate end position of the seeds (Fig. 2a). Final end points are computed using a modified Gaussian Mask fit31 to maximize location precision (see Supplementary Material). It uses combined Gaussian distributions to model the appearance of the end points in the image as defined by their location and the point-spread function of the system (Fig. 2a).

The signal-to-noise ratio (SNR) is directly related to the maximally achievable localization precision23,31. Therefore, we simulated microtubule seeds with different SNRs and show that at reasonable experimental SNRs (Material and Methods, Supplementary Fig. 2) endpoints can be accurately localized with subpixel resolution (Fig. 2c). Despite the fact that microtubule ends show no symmetric intensity distribution, the detection error is normally distributed showing no bias towards microtubules pointing in either direction (Supplementary Fig. 2). Therefore, detection precision is robust and does not depend on filament orientation.

Tracking Microtubules by 2D Gaussian Polynomial Models

The goal of microtubule tracking is to identify the end points of growing and shrinking microtubules within each frame of a fluorescent time-lapse movie with the highest possible accuracy and reliability. Typically such data is displayed as a length versus time graph (kymograph). Microtubules stochastically switch between growth and shrinkage. Growth velocities observed in vitro range from 0.6 μm/min32 to 40 μm/min33. Moreover, depolymerization velocity is typically an order of magnitude greater than the corresponding growth velocity21. Thus, the frame-to-frame difference in microtubule length can be significant. In addition, brightness changes, growth heterogeneity, microtubules bending, crossing, and moving out of focus present further challenges to accurate tracking. We will show that fitting polynomial functions enables us to robustly track microtubules, even when bending or crossing.

In more detail, MSER first detects an image region for each dynamic microtubule within each frame of the fluorescent time-lapse movie (as described for seed detection). To initialize the iterative microtubule detection within each MSER region, we need a start point and the guess of an end point. The start point is fixed and defined by the detected seed end, while the end point is estimated by the intersection of the current MSER region boundary with the projected growth direction from the last successfully segmented frame, which can potentially be many frames away (Fig. 3a, see also discussion). These two points define a line used to initialize the fitting of a 2D SoG model to the image region that identifies the microtubule. However, the 2D SoG path is represented by a 3rd order polynomial function, which enables tracking of bending (Fig. 3b) and crossing microtubules (Fig. 3c, Supplementary Material). The iterative fitting of the 2D SoG model is robust and will recover even after many frames have been missed since it is able to identify the correct microtubule path as long as the initialization line intersects with the microtubule at any point. Additionally, we reject estimates of microtubule paths in the current frame that differ significantly from the previous time-point (see also discussion, Supplementary Material). The precise endpoint of the growing or shrinking microtubule is finally computed using our modified Gaussian Mask fit as described for seed detection.

Figure 3
figure 3

Microtubule Tracking. The MTrack algorithm successfully tracks straight, bending and crossing microtubules over time. (a) First, MSER detects an image region (red ellipse) for each dynamic microtubule (blue). The seed end is used as starting point (green circle) and the end point (x) is estimated by the intersection of the current MSER region boundary with the projected growth direction (dashed line) from the last successfully segmented microtubule. These two points initialize a 2D SoG fit represented by a 3rd order polynomial function. The actual length of the dynamic microtubule is calculated as the contour length (l–c) of the final fit. This approach allows tracking of bending (b) and crossing (c) microtubules. Tracking accuracy for (d) bending microtubules (SNR 10) and (e) straight microtubules (SNR 3, 5 and 10) was determined as the distance between the actual simulated position of the microtubule end (Δactual) and the position given by the tracking algorithm (Δtracked).

When imaging dynamic microtubules, background fluorescence is inevitable as fluorescent tubulin in solution is required to allow microtubules to grow. With high tubulin concentrations, background fluorescence increases and therefore the effective SNR of the microtubule signal considering the fluorescent background can be considerably low (Supplementary Fig. 2). To characterize tracking performance, we simulated sequences of dynamic microtubules assuming different SNRs. Such an approach was previously demonstrated to be valuable for the study of the localization precision in single molecule localization microscopy34 and found to be a good single predictor of tracking precision23. Our analysis shows that irrespective of growth along a 3rd order polynomial (Fig. 3d) or a line (Fig. 3e), the error distribution remains similar and achieves pixel resolution.

Automatic Derivation of Microtubule Dynamic Parameters using Iterative Robust Outlier Removals

The aim of this module is to extract relevant microtubule dynamic parameters from length versus time data produced by the tracking (Fig. 4a). Each microtubule track has an unknown number of growth and shrinkage events. To automatically derive these dynamic parameters, we developed an iterative, model-based robust outlier removal algorithm based on RANSAC (Random Sample Consensus)35. RANSAC is a non-deterministic algorithm that fits a function to data points by maximizing the number of data points that support the function fit (inliers), given an error ε (Fig. 4b).

Figure 4
figure 4

Automated Derivation of Parameters of Microtubule Dynamic Instability using Iterative Robust Outlier Removal. (a) Kymograph of a dynamic microtubule. (b) In the length versus time plot obtained from tracking, RANSAC first identifies the largest subset of consecutive time points that follow near-linear growth as a growth event. (c) To identify all growth events, RANSAC iteratively removes time points belonging to an identified growth event from the sampling set and repeats the RANSAC sampling until no further growth events can be identified. (d) The final graph containing detected growth and shrinkage events, as well as catastrophes and rescues.

First, all growth events are detected. Microtubule polymerization velocity (vg [nm/s]) was shown to be a linear function of tubulin concentration and is usually approximated by a single constant growth rate13. We therefore assume that periods of microtubule growth follow an increasing, near-linear polynomial function, which is implemented as a 2nd or 3rd order polynomial regularized with linear function. To do so, RANSAC first identifies the largest subset of consecutive time points that follow near-linear growth (Fig. 4b). To identify all growth events in one track, the software iteratively removes time points belonging to an identified growth event from the sampling set. It then repeats the RANSAC sampling until no further growth events can be found. In the example shown in Fig. 4, RANSAC identifies four growth events in order of their length. To achieve compatibility with the general accepted assumption of linear microtubule growth, the software finally fits only a linear function to all inlier points of each growth event (Fig. 4c). Next, RANSAC identifies events of microtubule shrinkage. Microtubule depolymerization velocity (vs [nm/s]) can be an order of magnitude higher than polymerization velocity and therefore, depolymerization events tend to be short. We therefore use a linear model limited to fast decline for our iterative RANSAC algorithm (Fig. 4d, blue lines). Subsequently, catastrophe frequency and rescue frequency are calculated. Catastrophe frequency (fc [s−1]) is determined by dividing the total number of identified shrinkage events by the total time the microtubules were growing (events/time), taking only full growth events into account. Analogously, rescue frequency (fr [s−1]) is determined by dividing the total number of identified growth events by the total time the microtubule spent shrinking (events/time). We distinguish between total catastrophes, when the microtubule shrinks all the way back to the seed, and rescues by comparing the start of the new growth event to the baseline, which is given by the end point of the seed (Material and Methods). As mentioned in the introduction, microtubules have an intrinsic polarity. The microtubule plus end typically grows significantly faster than the microtubule minus end1. When both microtubule ends are selected and tracked, MTrack automatically assigns the faster growing end as the plus end. Finally, given the four parameters of dynamic instability, the microtubule length distribution can be computed (based on36) at a user chosen time-point or averaged over all the time points to obtain a time-averaged length distribution.

Discussion

In the last decade, advances in high-resolution techniques have shed new light on how the dynamic behavior of microtubules is modulated (as reviewed in37). Here, we present new software, MTrack, which automatically identifies and tracks dynamic microtubules with subpixel resolution and provides automatic data interpretation and statistics. MTrack will be valuable to any experimentalist (1) who studies different microtubule populations38,39, (2) who aims to characterize the effect of a MAP or motor protein on microtubule dynamics8,9,10,11,12,13,15,17 or (3) who is interested in characterizing the molecular mechanism of microtubule binding drugs. We believe that MTrack is a powerful tool, which together with high-resolution imaging will provide unbiased, high-accuracy data with sufficient statistics to help elucidate new mechanisms of microtubule dynamics control.

The demand for software, which automatically detects and tracks microtubules is mirrored by the recent development of several software packages that allow microtubule detection and/or tracking22,23,24,25,26,27. The most recent approach by Bohner and colleagues is a further development of the previously published tracking software FIESTA27 by optimizing it for low SNRs. In other words, the former software27 is ideal to track non-dynamic microtubule seeds, for example in single-motor stepping assays40, while the latter23 is well-suited for tracking microtubules in dynamic growth assays with free fluorescent tubulin. In addition, in order to validate the tracking performance across a broad range of conditions, Bohner and colleagues tracked simulated dynamic microtubules with varying experimental conditions. While they found the fluorophore labeling density, the pixel size of the image as well as the exposure time to be important parameters, they found the SNR a good single predictor of tracking precision23. Motivated by this observation, we systematically varied the SNR ratio and determined the detection and tracking accuracy of our software. In Module 1, endpoints of non-dynamic microtubule seeds can be accurately localized with subpixel resolution even at low SNRs. Moreover, the detection error is normally distributed showing no bias towards microtubule direction. From this we concluded that the detection precision was robust even at experimentally relevant SNRs and did not depend on the filament orientation. We then showed that allowing the final fit to follow a 3rd order polynomial function enabled us to track straight, bending, and crossing microtubules. The tracking accuracy achieved pixel resolution, providing a close to molecular precision.

While the above mentioned programs reliably track microtubules with nanoscale precision, both approaches require the manual selection of each individual microtubule to be tracked, neither of the program offers automated data analysis nor do the authors comment on how either software performs on bending or crossing microtubules. MTrack is a fully automated workflow that provides detection and tracking of microtubules and is - to our knowledge - the first software that offers automated data interpretation using iterative robust outlier removal. Directly tracking microtubules and analyzing their dynamics is different to tracking and analyzing end-binding proteins (EBs)41,42. Microtubule end-binding proteins such as EB1 accumulate exclusively at growing microtubule ends11,43 but get lost once microtubules shrink. In such datasets, microtubule behavior has to be interpolated during phases of microtubule shortening and pausing. In contrast, MTrack can make use of the full length over time information giving by the tracking module to extract information about MT dynamics.

In sum, MTrack is the first software that reliably detects, tracks, and analyzes the behavior of dynamic microtubules. Each module is automated yet highly adaptable and can be used (1) to robustly detect the end points of any linear, fluorescent, filamentous structure, (2) to reliably track fluorescent structures or (3) to analyze length over time plots in an automated fashion.

Materials and Methods

Point Spread Function (PSF)

The Point Spread Function (PSF) of a microscope is well approximated by the images of single subdiffraction-sized fluorescent beads. We quantified the PSF and the resolution by fitting 2D Gaussian functions to individual beads for each wavelength. The estimated resolution of the microscope based on the mean value of the full width half maximum (FWHM) is 199 nm and 205 nm for the 561 nm and the 647 nm laser, respectively.

Signal-to-noise Ratio (SNR)

After background subtraction, we measure and calculate the SNR of seeds and dynamic microtubules by IMT/σMT where IMT is the mean and σMT is the standard deviation of the pixel intensities along a line scan of a seed or dynamic microtubule.

In the simulations, we use the ImageJ Poisson noise generator to measure detection and tracking accuracy at different SNRs. This plugin computes Poisson distributed values for each pixel of an image based on ground truth data and a target SNR. Poisson noise is the main source of fluctuations in fluorescence microscopy, it occurs when a finite number of particles that carry energy, such as photons in an optical device, is small enough to give rise to detectable statistical fluctuations in a measurement.

Experimental Data, TIRF microscopy and Imaging

The in vitro reconstitution of microtubule dynamics was performed as described14,16. Briefly, GMPCPP-stabilized bovine tubulin seeds contained 10% Cy5-labeled and 20% biotin-labeled tubulin. Polymerization reactions were carried out at 37 °C in BRB80 buffer (80 mM PIPES, 1 mM MgCl2, 1 mM EGTA, pH 6.8) supplemented with 1% β-mercaptoethanol, 1 mg/mL casein, and 1 mM GTP at different concentrations of free tubulin. Free tubulin was either purified from Xenopus egg extracts44 or bovine brain tubulin (purchased from PurSolutions) containing 10% Cy3-labeled tubulin. Reaction chambers were constructed from glass coverslips and slides passivated with dichlorodimethylsilane45.

Images were taken on the motorized inverted Nikon Eclipse Ti-E microscope with a motorized TIRF angle controlled with ND acquisition software, equipped with a Nikon Plan Apochromat 100x/1.5NA oil immersion objective lens and an EMCCD, Andor iXon Ultra X3 987 Camera. Cy5-labeled seeds were imaged with a 647 nm laser at 1.5 mW (0.2%) and 50 ms exposure time. Cy3-labeled dynamic microtubule μs were imaged with a 561 nm laser at 0.54 mW (1.2%) and 50 ms exposure time. Image size is 512 × 512 with a pixel size of 156 nm. Movies analysed by MTrack have been taken from polymerization reactions with Xenopus laevis, Xenopus tropicalis and Bos taurus tubulin ranging from 6–20 μM total tubulin with growth speeds ranging from 0.4 μm/min to 3 μm/min (also see Supplementary Fig. 3).

Mathematics

Fitting Microtubule Intensity Models

MTrack fits a microtubule’s pixel intensities by using a model, which is a sum of Gaussians along a polynomial. In order to determine the model parameters, we perform minimization of χ squared function defined as

$$\chi {(\overrightarrow{\theta })}^{2}={{\sum }_{i}({I}_{i}-{F}_{i}(\overrightarrow{\theta }))}^{2}.$$
(1)

The sum is over the pixel co-ordinates (ix, iy) and Ii is the pixel intensity at that position. Fi represents the value given by the model at the same pixel co-ordinate, and model parameters are represented by the vector \(\overrightarrow{\theta }\). The components of the vector are dependent on the model used (Line model or 3rd order polynomial to approximate a beam model46). These components will be described in the sections detailing the respective model.

Line Model

For the seed image, MTrack uses a first order polynomial. A first order polynomial is a line in the image and in this model we place Gaussians along the line. The function F introduced before has the following form:

$${F}_{i}(\vec{\theta })=A{\sum }_{j}^{J}{G}_{j,i}\delta ({\mu }_{y,j}-m{\mu }_{x,j}-c)+Bg$$
(2)

Here, we placed Gaussians enumerated by index j. δ denotes the dirac-delta function that constrains the location of the Gaussians to be along a function, which is in this case a line. J defines the total number of Gaussians in the sum. The centroid of the Gaussian j is given by (μx,j, μy,j). By using a delta function we ensure that these centroids are always along the line, which is defined as the argument of the delta function. Bg is the background intensity term, A is the amplitude of all Gaussians J. Gj,i defines a two dimensional Gaussian located at pixel location (ix, iy). In our sum of Gaussian model, the intensity contribution of Gaussian j at pixel location i is given by

$${G}_{j,i}=\exp (-\frac{{({i}_{x}-{\mu }_{x,j})}^{2}}{{\sigma }_{x}^{2}}-\frac{{({i}_{y}-{\mu }_{y,j})}^{2}}{{\sigma }_{y}^{2}})$$
(3)

σx and σy are determined by the point spread function of the microscope. The spacing between the successive Gaussians placed along a curve is assumed to be a constant, defined by the parameter ds.

$$\begin{array}{rcl}ds & = & \sqrt{d{\mu }_{x,j}^{2}+d{\mu }_{y,j}^{2}}\\ {\mu }_{y,j} & = & m{\mu }_{x,j}+c\\ d{\mu }_{y,j} & = & md{\mu }_{x,j}\end{array}$$
(4)

Using these expressions we can write ds in the above expression as

$$ds=d{\mu }_{x,j}\sqrt{1+{m}^{2}}$$
(5)

Using the expression above and expanding the expression in 2 we obtain modelled intensities for each pixel i by

$${F}_{i}=A({G}_{{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}},i}+{G}_{j,i}+\cdots +{G}_{{\rm{e}}{\rm{n}}{\rm{d}},i})+Bg$$
(6)

Gstart,i and Gend,i define the two dimensional Gaussian at the start and the end location. The modelled intensity of each Gaussian Gj,i along a line is defined as

$${G}_{j,i}=\exp (\,-\,\frac{{({i}_{x}-{\mu }_{x,j})}^{2}}{{\sigma }_{x}^{2}}-\frac{{({i}_{y}-m{\mu }_{x,j}-c)}^{2}}{{\sigma }_{y}^{2}})$$
(7)

For the seed image the line parameters (m and c) are determined by using MSER29. σx and σy are user input for the PSF of the microscope and are not fit parameters. The fit parameters to be determined are the start and the end sub-pixel co-ordinate of the model (μx,start, μy,start) and (μx,end, μy,end) respectively, the spacing between the Gaussians ds, the background term Bg and the amplitude A.

In order to determine these parameters, the function defined in 1 is minimized using the Levenberg-Marquardt solver47,48. Such a minimization requires providing derivatives with respect to the fit parameters. MTrack uses analytical derivatives for that and their form is described in the next section.

Analytical Derivatives for Line Models

Derivative with respect to μ s

Using the expression in 6, we can write the derivative with respect to the first term as

$${D}_{i,({\mu }_{s,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}})}=\frac{{\rm{\partial }}}{{\rm{\partial }}{\mu }_{s,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}}F=\frac{2A}{{\sigma }^{2}}(({i}_{s}-{\mu }_{s,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}})\cdot \vec{I}){G}_{{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}$$
(8)

Here, we have used the vector notation to represent the co-ordinates (s = 0, 1) for (x, y) co-ordinates respectively and \(\overrightarrow{I}\) represents the unity vector. The derivative with respect to the end point is also similar to above with μs,start being replaced by μs,end and Gstart being replaced by Gend.

Derivative with respect to ds

We define

$$\begin{array}{ccc}\vec{B} & = & [\begin{array}{c}\frac{1}{\sqrt{1+{m}^{2}}}\\ \frac{m}{\sqrt{1+{m}^{2}}}\end{array}]\end{array}$$
(9)

and

$${D}_{i,ds}=\frac{\partial }{\partial ds}F={\sum }_{j}\frac{2j}{{\sigma }^{2}}(({\overrightarrow{i}}_{s}-{\overrightarrow{\mu }}_{s,j})\cdot \overrightarrow{B}){G}_{j,i}$$
(10)

Derivative with respect to A and Bg

For A the derivative is 6 without the B term and for derivative with respect to Bg it is unity.

Polynomial Model

For the time-lapse images, MTrack uses a polynomial model to do the fitting, which allows tracking of bending and crossing microtubules. We use a 3rd order polynomial and modify the model presented in 2 to the following:

$${F}_{{\rm{p}}{\rm{o}}{\rm{l}}{\rm{y}},i}={\sum }_{j}A\times {G}_{j,i}\delta ({\mu }_{y,j}-I{\mu }_{x,j}^{3}-b{\mu }_{x,j}^{2}-m{\mu }_{x,j}-c)+Bg$$
(11)

We now have two more parameters to determine I and b. I is the inflection of the polynomial and b describes the curvature of the polynomial. Now, the delta function represents putting the centroids of the Gaussians along a curve represented by the argument of the delta function. There are two more fit parameters to be determined: b and I. For doing so, we need analytical derivatives for the fit function in 1 with respect to these two new parameters. These will be derived in the following section. The spacing ds between the Gaussians now becomes

$$\begin{array}{rcl}ds & = & \sqrt{d{\mu }_{x,j}^{2}+d{\mu }_{y,j}^{2}}\\ {\mu }_{y,j} & = & I{\mu }_{x,j}^{3}+b{\mu }_{x,j}^{2}+m{\mu }_{x,j}+c\\ d{\mu }_{y,j} & = & (3I{\mu }_{x,j}^{2}+2b{\mu }_{x,j}+m)d{\mu }_{x,j}\\ ds & = & d{\mu }_{x,j}\sqrt{1+{(3I{\mu }_{x,j}^{2}+2b{\mu }_{x,j}+m)}^{2}}\end{array}$$
(12)

Analytical Derivatives for Polynomial Model

Derivative with Respect to μ s, A and Bg

These derivatives are the same as described for the line model.

Derivative with Respect to ds

The term m is now determined by the other fit parameters and can be written as

$$m=\frac{{\mu }_{y,{\rm{end}}}-{\mu }_{y,{\rm{start}}}}{{\mu }_{x,{\rm{end}}}-{\mu }_{x,{\rm{start}}}}-b({\mu }_{x,{\rm{end}}}+{\mu }_{x,{\rm{start}}})-I({\mu }_{x,{\rm{start}}}^{2}+{\mu }_{x,{\rm{end}}}^{2}+{\mu }_{x,{\rm{start}}}{\mu }_{x,{\rm{end}}})$$
(13)

We define a new term S as

$$S=m+2b{\mu }_{x,{\rm{start}}}+3I{\mu }_{x,{\rm{start}}}^{2}$$
(14)

The vector \(\overrightarrow{B}\) can then be redefined as

$$\begin{array}{ccc}\vec{B} & = & [\begin{array}{c}\frac{1}{\sqrt{1+{S}^{2}}}\\ \frac{S}{\sqrt{1+{S}^{2}}}\end{array}]\end{array}$$
(15)

The derivative with respect to ds can then be written as before

$${D}_{i,ds}=\frac{\partial }{\partial ds}F={\sum }_{j}\frac{2j}{{\sigma }^{2}}(({\overrightarrow{i}}_{s}-{\overrightarrow{\mu }}_{s,j})\cdot \overrightarrow{B})\,{G}_{j,i}$$
(16)

Derivative with Respect to Curvature (b)

We define a term H as

$$H=-\,Sds(\frac{2{\mu }_{x}-({\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}})}{{(1+{S}^{2})}^{3/2}})$$
(17)

Defining a vector \(\overrightarrow{J}\) as

$$\begin{array}{ccc}\vec{J} & = & [\begin{array}{c}H\\ SH+(2{\mu }_{x}-({\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}}))\times \frac{ds}{\sqrt{1+{m}^{2}}}\end{array}]\end{array}$$
(18)

The derivative with respect to b can then be written as before

$${D}_{i,b}=\frac{\partial }{\partial b}F={\sum }_{j}\frac{2j}{{\sigma }^{2}}(({\overrightarrow{i}}_{s}-{\overrightarrow{\mu }}_{s,j})\cdot \overrightarrow{J}){G}_{j,i}$$
(19)

Derivative with Respect to Inflection (IF)

We define a term K as

$$K=-\,Sds(\frac{3{\mu }_{x}^{2}-({\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}^{2}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}}^{2}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}}{\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}})}{{(1+{S}^{2})}^{3/2}})$$
(20)

Defining a vector \(\overrightarrow{L}\) as

$$\begin{array}{ccc}\vec{L} & = & [\begin{array}{c}K\\ SK+(3{\mu }_{x}^{2}-({\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}^{2}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}}^{2}+{\mu }_{x,{\rm{e}}{\rm{n}}{\rm{d}}}{\mu }_{x,{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}}))\times \frac{ds}{\sqrt{1+{m}^{2}}}\end{array}]\end{array}$$
(21)

The derivative with respect to IF can then be written as before

$${D}_{i,IF}={\sum }_{j}\frac{2j}{{\sigma }^{2}}(({\overrightarrow{i}}_{s}-{\overrightarrow{\mu }}_{s,j})\cdot \overrightarrow{L}){G}_{j,i}$$
(22)

Line Parameters from MSER Ellipses

For the seed image the line parameters need to be determined. The line parameters are the slope and the intercept of the line, for a two dimensional ellipse, the covariance matrix can be represented as

$$\begin{array}{ccc}M & = & [\begin{array}{cc}p & q\\ q & r\end{array}]\end{array}$$

Here \(p={\sigma }_{x}^{2}\), \(r={\sigma }_{y}^{2}\), q = ρxy. Defining a parameter dr as \(dr=\sqrt{{p}^{2}+4{q}^{2}-2pr+{r}^{2}}\). The eigenvalues of the 2 × 2 matrix are given by

$$\lambda =\frac{p+r\pm dr}{2}$$
(23)

The eigenvector is given by

$$\vec{\upsilon }=[\begin{array}{c}2q\\ r-p\pm dr\end{array}]$$
(24)

Any point (x, y) along the vector can be represented as

$$(x,y)=({x}_{c},{y}_{c})+t(2q,r-p+dr)$$
(25)

Eliminating t from the above vector equation gives us the line parameters (slope = m, intercept = c) of the major axis of the ellipse as

$$m=\frac{r-p+dr}{2q},\,c={y}_{c}-{x}_{c}\frac{r-p+dr}{2q}$$
(26)

The Levenberg-Marquradt Solver

In order to obtain the optimized set of parameters, we use the Levenberg-Marquradt solver to minimize the sum of squared differences in Eq. 1. The χ squared function can be written as

$${\chi }^{2}={\sum }_{{\rm{p}}{\rm{i}}{\rm{x}}{\rm{e}}{\rm{l}}{\rm{s}}}{[{I}_{i}-{F}_{i}(\vec{\theta })]}^{2}={\sum }_{{\rm{p}}{\rm{i}}{\rm{x}}{\rm{e}}{\rm{l}}{\rm{s}}}{f}_{i}{(\vec{\theta })}^{2}$$
(27)

To do so, we perform Taylor expansion on the χ2 function as

$${\chi }^{2}(\overrightarrow{\theta }+\overrightarrow{\delta })={\chi }^{2}(\overrightarrow{\theta })+{\overrightarrow{\delta }}^{T}g+\frac{1}{2}{\overrightarrow{\delta }}^{T}H\overrightarrow{\delta }$$
(28)

δ is given by

$$\overrightarrow{\delta }=-\,{(H+{\lambda }^{-1}I)}^{-1}g,$$
(29)

and the matrix H is given by

$$H=\sum 2\nabla {f}_{i}(\overrightarrow{\theta }){\nabla }^{T}{f}_{i}(\overrightarrow{\theta })+2{f}_{i}(\theta )\nabla {\nabla }^{T}{f}_{i}(\overrightarrow{\theta })$$
(30)

As the matrix H is sparse, the second term containing the 2nd order derivative is ignored and only the first term is kept. We minimize the χ squared function with respect to delta and if the solution is going towards minima the λ parameter is decreased by a factor of 10, else increased by the same factor.

Gaussian Mask Fits

After obtaining the optimized set of parameters from the Levenberg-Marquradt solver, we refine the obtained result by doing a weighted sum of Gaussian mask fits31 to further improve the accuracy of the detection. For this step we construct the mask for the start and end positions as

$$\begin{array}{ccc}{W}_{{\rm{e}}{\rm{n}}{\rm{d}}} & = & \exp [-\frac{{(\vec{x}-{\vec{x}}_{c})}^{2}}{2{\vec{\sigma }}^{2}}]+\exp [-\frac{{(\vec{x}+\vec{d}s-{\vec{x}}_{c})}^{2}}{2{\vec{\sigma }}^{2}}]\\ {W}_{{\rm{s}}{\rm{t}}{\rm{a}}{\rm{r}}{\rm{t}}} & = & \exp [-\frac{{(\vec{x}-{\vec{x}}_{c})}^{2}}{2{\vec{\sigma }}^{2}}]+\exp [-\frac{{(\vec{x}-\vec{d}s-{\vec{x}}_{c})}^{2}}{2{\vec{\sigma }}^{2}}]\end{array}$$
(31)

This is an iterative process of finding the location of the mask constructed by sum of two Gaussians and at the end of the iteration we obtain a sub-pixel accurate localization of the end points of the microtubule. The process is repeated for each frame and for all the detected microtubules.

One-to-one Mapping of Microtubules to MSER Regions

For seeds as well as (non-colliding) dynamic microtubules, there is a one-to-one mapping of the detected microtubules with the MSER-segmented regions. In order to make an initial guess for the start and the end position, we use the slope of the line determined for the seeds and determine the intersection point of the line with the MSER-segmented region as the initial guess for the start and the end position of the dynamic microtubule.

For the dynamic channel, we draw a line from the start and end position of the previous frame and determine the intersection point of the drawn line with the MSER segmented region. Along that line we look for the intensity points which are at least greater than 50% of the maximum intensity value in that region. The guess for the polynomial function, which the microtubule growth follows is taken from the polynomial function determined in the previous frame. For the first frame in the dynamic channel the line parameters are used from the seed image frame and the polynomial parameters are assumed to be 0 and then determined via the optimizer.

Handling Colliding Microtubules

Each microtubule evolves according to a polynomial function, whose parameters are determined in each frame using the function parameters of its evolution in the previous frame. Including prior knowledge helps making good initial guesses for the localization to proceed in the current frame. As the dynamic function of evolution of each microtubule is smooth and unique, the optimizer is unlikely to make mistakes and if it does the program can recognize that by noting sharp changes in the polynomial function parameters of growth of a given microtubule. Two special cases are discussed with respect to colliding microtubules.

Single MSER Region for Multiple Colliding Microtubules

In a scenario where a single segmented region contains multiple microtubules, the optimizer relies on the polynomial parameters for the microtubule determined in the previous frame and is able to correctly determine the growing end points. MTrack keeps track of the angular change in the direction of the dynamic microtubules and determines a mistake if the angular change is greater than a user defined value, which by default is 20 degrees.

Multiple MSER Regions for a Single Microtubule

When microtubules are close or collide, it may happen that a single microtubule finds itself in multiple MSER segmented regions. In such a case, the optimizer will fit in all regions to determine the growing end point location and will choose the point closest to the last known location of the microtubule.

Simulations

Microtubules are simulated using linear models and 3rd order polynomials, where the parameters of each function are determined by a random number generator. Images are created by convolution with the PSF, adding a background, and rendering the final pixel intensities using a Poisson process. The simulation code is available on Github https://github.com/PreibischLab/MTrack/tree/master/src/main/java/dummyMT.

Documentation and Installation

Detailed documentation and installation instructions are available on the ImageJ wiki http://imagej.net/MicrotubuleTracker.