Potential quality improvement of stochastic optical localization nanoscopy images obtained by frame by frame localization algorithms

A data movie of stochastic optical localization nanoscopy contains spatial and temporal correlations, both providing information of emitter locations. The majority of localization algorithms in the literature estimate emitter locations by frame-by-frame localization (FFL), which exploit only the spatial correlation and leave the temporal correlation into the FFL nanoscopy images. The temporal correlation contained in the FFL images, if exploited, can improve the localization accuracy and the image quality. In this paper, we analyze the properties of the FFL images in terms of root mean square minimum distance (RMSMD) and root mean square error (RMSE). It is shown that RMSMD and RMSE can be potentially reduced by a maximum fold equal to the square root of the average number of activations per emitter. Analyzed and revealed are also several statistical properties of RMSMD and RMSE and their relationship with respect to a large number of data frames, bias and variance of localization errors, small localization errors, sample drift, and the worst FFL image. Numerical examples are taken and the results confirm the prediction of analysis. The ideas about how to develop an algorithm to exploit the temporal correlation of FFL images are also briefly discussed. The results suggest development of two kinds of localization algorithms: the algorithms that can exploit the temporal correlation of FFL images and the unbiased localization algorithms.

In stochastic optical localization nanoscopy-PALM 1 , STORM 2 , FPALM 3 and (d)STORM 4 , a localization nanoscopy image is produced by three steps. First, a set of emitters are attached to ultrastructure of a specimen. Second, in each frame time a random subset of emitters are activated by a laser and emit photons that pass through an optical lens and produce a data frame acquired by a camera. Repeating this process, a data movie that consists of a large number of data frames is acquired. Third, a localization algorithm estimates the emitter locations from the data movie and produces a localization nanoscopy image of the specimen ultrastructure. The localization algorithm plays an important role in obtaining a high quality of localization nanoscopy images.
To boost research and development of localization algorithms and identify high-performance localization algorithms, an online public challenge has been open to the public [62][63][64] . The results of challenge on the 2D and 3D imaging have been reported in Ref. 63 and recently in Ref. 64 . In the challenge, a data movie is synthesized with a set of emitters whose locations are known. A localization algorithm estimates the emitter locations by using the data movie and produces a localization nanoscopy image consisting of the estimated emitter locations. The quality of the localization nanoscopy image and the performance of the algorithm are evaluated by comparison of the estimated emitter locations and the true emitter locations in terms of the quality metrics of accuracy, precision, recall, and Jaccard index 26,47,62,63 . A universal and objective metric, root mean square minimum distance (RMSMD), is proposed recently 66 . RMSMD measures the average, local, and mutual fitness between a set of estimated emitter locations and the set of true locations, and it presents several unique properties and advantages over the other metrics. RMSMD can be utilized to evaluate the quality of nanoscopy localization images and the performance of localization algorithms when a set of true emitter locations is known a prior 66 .
Among the localization algorithms in the literature, only a few exploit temporal correlation by jointly utilizing multiple data frames or the entire data movie in estimation of emitter locations [44][45][46][47] . The majority of localization algorithms 1-43 estimate emitter locations from each single data frame independently or by the frame-by-frame localization (FFL). Thus, most localization nanoscopy images are FFL images. Yet, little is known about their properties. It is imperative and important in both theory and application to understand the properties of FFL nanoscopy images in several aspects. First, since the optical lens is effectively a PSF, a data frame is spatially (pixel-wise) correlated. Moreover, because all data frames are generated by the same set of emitters, the data movie is also temporarily (frame-wise) correlated. The Fisher information matrix of multiple data frames is equal to the sum of their individual Fisher information matrices 69 . Both the spatial and temporal correlations contain information about the emitter locations. If the spatial and temporal correlations are jointly and optimally exploited in localization of emitters, the localization accuracy can approach the bound that the data movie can provide. However, such an advanced localization algorithm is usually computationally complicated; and this is probably the reason why the majority of localization algorithms estimate emitter locations frame by frame independently. The FFL algorithms only exploit the spatial correlation and leave the temporal correlation to be intact. The temporal correlation is still contained in the FFL image, which if exploited, shall improve the localization accuracy of estimated emitter locations and the quality of nanoscopy image as well. The algorithms UNLOC 38 and QC-STORM 43 detect and reconnect the estimated locations that might be generated from the same emitter in consecutive frames in order to improve localization accuracy. It is interesting to know the potentially maximum improvement of quality that can be obtained by exploitation of the temporal correlation in an FFL image. Second, as the number of data frames increases, the number of activations per emitter in the data movie increases and then the number of estimated locations per emitter in an FFL image increases. It is interesting to know how the average number of estimated locations per emitter affects the quality of an FFL image. It is practically interesting to know if it is necessary to acquire as many data frames as possible in order to improve the quality of an FFL image and when an acquisition of data frames shall terminate. A structure-resolving index (SRI) has been proposed to determine the termination time of acquisition 70 . Third, it is desired to know how the variance and bias of localization errors and sample drift affect the quality of an FFL image. The effect of biases of localization errors has been recently paid attention in literature 65 . Understanding the effect of variance and bias of localization errors and sample drift on the image quality enables algorithm developers to allocate resources more adequately to achieve a high quality of FFL images. Fourth, serval deterministic properties of RMSMD are analyzed and presented in Ref. 66 . However, its statistical properties are unknown yet while a data movie and an FFL image are random realizations of certain stochastic processes. An analysis of RMSMD for FFL nanoscopy images shall reveal statistical insights and understandings of RMSMD 71 . Fifth, root mean square error (RMSE) can be utilized to theoretically analyze and quantify the error between the estimated localizations and the groundtruth locations of emitters. The Cramer-Rao lower bound (CRLB) 67, 68 determines the minimum RMSE for all unbiased estimators. While RMSMD can be employed to evaluate the quality of a localization nanoscopy image in comparison with a set of ground-truth locations, RMSE cannot be employed in general since it needs to know the identification of an estimated location associated with a ground-truth location, which is unknown in general. Hence, it is significant to reveal the relationship between RMSMD and RMSE. Moreover, it is also interesting to know the properties of FFL nanoscopy images in terms of RMSE.
In this paper the statistical properties of RMSMD and RMSE for the FFL nanoscopy images are analyzed and compared. First, it is found that while an FFL image is random, its RMSMD converges to a deterministic constant as the average number of activations per emitter tends to infinity. This implies that for a sufficiently large , increasing the number of acquired data frames improves little the quality of an FFL image in terms of reduction of RMSMD variation. A numerical example shows that when = 10 , RMSMD is already stable and close to the limit RMSMD and acquiring more data frames is unnecessary. Second, the analytical result shows that exploitation of temporal correlation in an FFL image can reduce RMSMD and RMSE by a maximum fold of 0.5 . Hence, an algorithm that is able to exploit the temporal correlation in an FFL image can significantly improve the image quality, in particular for a large . A numerical example shows that exploitation of temporal correlation not only reduces RMSMD and RMSE of an FFL image but also considerably improves its visual quality. Third, the variance of localization biases across emitters affects RMSMD and RMSE much more severely than the variance of localization errors. On the basis of the first two results, we can conclude that if only an FFL algorithm is available, acquiring more data frames is unnecessary when the average number of activations per emitter already reaches = 10 . On the other hand, if an FFL algorithm is followed by an algorithm that can exploit the temporal correlation, acquiring more data frames can significantly improve the image quality in both RMSMD and visual quality. At the end, the ideas about how to develop an algorithm to exploit the temporal correlation of Method ffL image, RMSMD and RMSe. FFL image. Let S = {s 1 , ..., s M } be a set of M fixed emitter locations in the n-dimensional real space R n . In practice, the dimension is n = 2 for the 2D imaging and n = 3 for the 3D imaging. In a data movie of L frames each emitter is independently activated, following a Markov chain as considered in the literature 44,45,66 . The Markov chain is irreducible, aperiodic, and positive recurrent and therefore has a stationary probability distribution of states 66 such that an emitter in a frame is activated with a stationary probability p . In practice, an emitter will be ultimately bleached. Without loss of generality and effect on results, we consider that the emitters are not bleached yet in the data movie. The i th emitter is activated N i < L times in the data movie. An FFL algorithm localizes by estimation the activated emitters in each single frame independently. Let X i = {x i1 , ..., x iN i } be the set of all the locations estimated in different frames for the ith emitter s i .
locations for all M emitters estimated from the data movie. As an estimate of S , X is an FFL nanoscopy image for S . In this paper, we do not investigate how to obtain X i 's; instead, given X i 's, we analyze the quality of X and the potential quality improvement by exploitation of temporal correlation that is embedded in X . The quality of X can be measured by the RMSMD and the RMSE between X and S . We shall analyze the statistical properties of the RMSMD and the RMSE when the number of data frames L is large.
Statistics. The i th emitter s i is activated in N i frames. The estimated locations of s i from the N i frames, x ij ∈ X i for j = 1, . . . , N i , can be written as x ij = s i + b i + w ij . b i is the localization bias that is fixed in all estimates and b ik for k = 1, . . . n , the k th component of b i , is the bias of x ijk , the k th component of x ij . w ij is the localization error with zero mean E(w ij ) = 0 and varies randomly in different frames. The localization errors are resulted from the photon emissions of emitters, background autofluorescence, Gaussian noise, and an FFL algorithm, which all are mutually independent [67][68][69] . In stochastic optical localization nanoscopy, the photon emissions from emitters and background autofluorescence both are Poisson processes. It follows from the property of classifying a Poisson number of events 72 that the numbers of detected photons in pixels of different frames are independent. The thermal noise in electronic circuit is additive white Gaussian noise (AWGN) 68,73 and therefore the Gaussian noises in pixels of different frames are independent. Thus, given the activations of emitters, the data frames are mutually independent 69 . An FFL algorithm estimates the locations of activated emitters frame by frame independently. Hence, the localization errors of the same emitter in different frames are independent.
The localization errors of different emitters in the same frame are dependent if their PSFs are overlapped. Consequently, the covariance matrix of w ij varies with j depending on the combination of activated emitters associated with j. For a total of M emitters, the number of possible combinations of activated emitters in a frame is 2 M . If considering only the emitters whose PSFs can be possibly overlapped locally, M is small and the total number of combinations might be small in an experiment. In the condition that the i th emitter is activated, the total number of combinations of activated emitters in a frame, denoted by c il , is equal to J = 2 M−1 . Since the Markov chain of activations of an emitter is stationary and has a stationary probability distribution of state, the l th combination c il for l = 1, · · · , J occurs with a stationary probability q il . Denote by σ 2 ilk = E(w 2 ijk |c il ) the variance of the k th component of w ij in the condition that the l th combination c il occurs. It is clear that σ 2 ilk is stationary, that is, σ 2 ilk depends on the occurrence of the l th combination c il and is independent of the frame index distinguished by j . Therefore, the localization error of the ith emitter w ij ∈ X i for j = 1, . . . , N i is stationary, and thus the variance of its k th component is equal to Then the estimated locations x ij of the ith emitter have a stationary probability density function f i (x).
The total number of activations of the i th emitter, |X i | = N i , has a mean = pL . N , the total number of estimated locations for all emitters in X , has a mean M = MpL . In practice, the total number of frames L is statistically large. To theoretically analyze the property of the RMSMD for a large L , so called a large data behavior, we consider that L tends to infinity. Therefore, the mean of all N i 's as well as N tend to infinity, i.e., → ∞.
RMSMD. Given S and X , their mean square minimum distance (MSMD) is defined by 66 where |·| is the number of elements in a set and � · � is the l 2 norm or the Euclidean distance between two points. Then the RMSMD is D(X, S) . As a universal and objective metric, D(X, S) evaluates how well the two sets X and S averagely, locally, and mutually fit to each other.
In localization nanoscopy X is random and so is D(X, S) . In other words, an FFL image obtained in practice is one realization of X . D(X, S) can be applied to a particular realization of X.
The Voronoi cell of In terms of the Voronoi cells, the RMSMD can be expressed as www.nature.com/scientificreports/ RMSE. The mean square error (MSE) between X and S is defined as where the expectation is taken with respect to f i (x)'s. Then their RMSE is given by h(X, S) . It is shown in "Appendix" that the MSE can be expressed in terms of the variances and biases of all estimated emitter locations In general, RMSMD and RMSE are quite different. First, RMSMD is random while RMSE is deterministic. Second, given X and S , D(X, S) can be employed to evaluate the quality of a localization nanoscopy image X . RMSMD is useful in practice as well as theoretical analysis. Third, in contrast, evaluation of RMSE need to know the partition X i 's of the image X and the probability density function of estimated locations f i (x) . Therefore, RMSE is useful only in theoretical analysis. It is noted that the CRLB 67,68 is the minimum standard deviation σ ijk that any unbiased (i.e., b ik = 0 for all k ) estimator x ijk can possibly achieve. Though they are quite different, as analyzed in the next section, in the special cases when X is sufficiently dense and all the estimated locations are located inside the Voronoi cells of their own emitters, the random RMSMD can well approximate the deterministic RMSE.
properties. Invariance to a large number of estimates. Since an FFL image is random, its RMSMD is random. However, as the average number of activations per emitter increases, the randomness of RMSMD is eventually effectively ignorable as indicated by the following property, which is proved in "Appendix".
Property 1 (Invariance): As → ∞ , the RMSMD between X and S converges almost surely as where the expectation in Eq. (5) is taken with respect to f i (x)'s. □ In practice, for a large and finite , Eqs. (5) and (6) provide an approximation of RMSMD for an FFL image. In particular, Eq. (6) implies that In a particular experiment, an FFL image is a realization of random X and might have a much poorer quality than the average in terms of RMSMD. As indicated by Property 1, however, as → ∞ , the random D 2 (X, S) converges to a deterministic constant at the right-hand side of Eq. (5). For a sufficiently large , the quality of X in terms of D(X, S) in any experiment shall be almost the same. This implies that if is sufficiently large, further increasing does not decrease the variation of RMSMD and acquiring more data frames is unnecessary. The numerical example in the next section shows that when the average number of activations per emitter reaches = 10 , the RMSMD is already steady with small variations.
The RMSMD formulas in Property 1 are applicable to all cases of localization errors for FFL images. In the following two subsections, the RMSMD is further analyzed in the cases of small and large localization errors.

RMSMD in small localization errors.
In general, the random RMSMD and the deterministic RMSE are irrelative. However, in the special case when is sufficiently large and localization errors are small, the RMSMD effectively coincides with the RMSE. We consider that all locations x ij 's estimated by an FFL algorithm are located in the Voronoi cell of their own emitter location s i with probability one, that is, Pr X i V (s j ) = X i = δ ij for all i , j where δ ij is the Kronecker delta. This implies that the localization errors measured by RMSE are relatively small compared with the Voronoi cells. The following property is proved in "Appendix".
Property 2 (Coincidence with RMSE): If x ij 's all are located in the Voronoi cells of their own emitter locations with probability one, then in the almost sure sense which is equal to the right-hand side of Eq. (4).
□ In an experiment, if most estimated locations x ij 's are in the Voronoi cells of their own s i 's and is sufficiently large, then D 2 (X,

RMSMD upper bound in large localization errors.
Consider that an FFL image is defined over a finite region ⊂ R n and the variances of all estimated locations X ij 's and the average number of activations per emitter both www.nature.com/scientificreports/ tend to infinity, i.e., σ 2 ik → ∞ and → ∞ . Then infinitely many estimated locations are uniformly distributed in . The uniform distribution of estimated locations is equivalent to a random guess of the emitter locations and no information about the emitter locations is contained in such a localization nanoscopy image. Because of this, the RMSMD of this limit image can be considered the upper bound of RMSMD, which correspond to the worst quality of a localization nanoscopy image. The following property is straightforward to obtain from (6).
Property 3 (Upper bound on large localization error): As σ 2 ik → ∞ for all i , k and → ∞ , in the almost sure sense where |·| denotes the volume of a continuous set. □ Exploitation of temporal correlation. We consider exploitation of temporal correlation retained in an FFL image and investigate the RMSMD improvement that is achievable by exploitation of temporal correlation.
The locations x ij ∈ X i are estimates for the same emitter location s i from different frames. When the distribution of the localization errors is unknown, the statistical property of the errors cannot be exploited. However, when the localization errors of the same emitter across frames are independent, an efficient and simple method to improve the accuracy of estimated emitter location is the averaging of the estimates x ij ∈ X i for s i to cancel out part of the errors, that is For the mutually independent localization errors of x ij 's, x i is the linear minimum-mean-square-error (LMMSE) estimator of the emitter location and bias. If the localization errors are further Gaussian distributed, x i is the maximum likelihood estimator 74 . In these senses, when the distribution of localization errors is unknown, x i is an optimal estimator to exploit the temporal correlation from an FFL image. Now, let X i = {x i } and X = M i=1X i ; and then X , as an estimate of S that has the same number M of emitter locations as that of S , is a new localization nanoscopy image. The following formula is shown in "Appendix", The averaging of estimated locations estimated for the same emitter reduces the MSE on the part of variance by a fold of but does not do on the part of biases. In the limit, the effect of error variances vanishes and the MSE is determined only by the biases.
The following property is proved in "Appendix". Property 4 (Averaging): If x ij 's all are located in the Voronoi cells of their own emitter locations with probability one, then in the almost sure sense which is equal to the right-hand side of Eq. (12).
□ Property 1-Property 4 imply that in the large data limit, exploitation of temporal correlation by the averaging of estimated locations per emitter can improve RMSMD by a fold of In an experiment, if most estimated locations x ij 's are in the Voronoi cells of their own s i 's and is sufficiently large, D 2 (X, S) is approximately by Eqs. (11) and (13) Hence, the RMSMD is improved by an approximate fold of which converges to the right-hand side of Eq. (14), the maximum fold of improvement for biased estimates. www.nature.com/scientificreports/ Maximum fold of improvement in RMSMD. The improvement of RMSMD in Eq. (16) is limited by the bias. If x ij 's are all unbiased with b i = 0 , the improvement tends to infinity as increases. We investigate the rate of RMSMD improvement. With the unbiased estimates x ij 's, Eqs. (4) and (11) become, respectively The following property is obtained by means of Property 2 and Property 4.

Property 5 (Maximum fold of improvement)
: If x ij 's all are unbiased and with probability one are located in the Voronoi cells of their own emitter locations, respectively, which is equal to the right-hand side of Eq. (17).
□ Property 5 implies that as → ∞ , D(X, S) → 0 at the rate of −0.5 . In practice, RMSMD shall be in the order of The averaging of estimated locations per emitter can improve RMSMD by a fold of In practice, x ij 's are usually not located in their own Voronoi cells and all estimated locations are mingled together. Moreover, x ij 's are usually biased. Furthermore, an algorithm that determines the partition X i 's from X yields certain error in the estimated partition. All of these reduce the fold of improvement to an amount less than 0.5 in Eq. (21). Hence, 0.5 is the maximum fold of improvement in RMSMD by exploitation of temporal correlation. For several types of available emitters 75 , the average number of activations before bleaching is in the range of ∼ = 30 ∼ 80 and therefore exploitation of temporal correlation can improve RMSMD by a maximum fold of 0.5 ∼ = 5.5 ∼ 9.
In an experiment, if we know the estimated locations that are produced by the same emitter, simply averaging the estimated locations per emitter can improve RMSMD by a fold as large as 0.5 . However, practically only the entire set X is known and its partition sets X i 's are unknown and need to be estimated. To develop an algorithm that can effectively identify the partition sets X i 's from the set of all estimated locations X is the key to improve the quality of an FFL image through exploitation of temporal correlation.

Results and discussion
A numerical example. In this section we present a numerical example to demonstrate the properties of RMSMD for the FFL images. For simplicity, we consider that infinitely many emitters are located at the grids on the entire 2D plane R 2 , s ij = (ia, ja) with a > 0 for all integers i , j . The Voronoi cell of s ij is Figure 1a shows the emitter placement for a = 200 nm. The estimated locations x ijk ∈ X ij = {x ij1 , . . . , x ijN ij } for emitter s ij are Gaussian distributed with mean E(x ijk ) = s ij + b ij and covariance matrix C = diag(σ 2 , σ 2 ).

Invariance to a large number of estimates.
Consider that x ijk 's are unbiased with b ij = 0 and σ ≪ a . Then all the estimated locations x ijk 's for emitter s ij are almost located inside its own Voronoi cell X ij ⊆ V (s ij ) . By Eq. (4) As σ increases, the RMSE between X and S increases without bound. However, the random RMSMD behaves quite differently. By means of Property 2  Figure 1f shows the RMSMDs and RMSEs of X and X versus for σ = 25 nm. When is small, D(X, S) randomly varies significantly and presents a high uncertainty in quality, implying that the chance in an experiment to get a low-quality FFL image with a large RMSMD is high. As increases, the variation decreases. When = 10 , the variation is small and D(X, S) is close to the expected limit value 2 0.5 σ . As predicted by Property 1, continuing to increase by increasing the total number of frames L and/or the activation probability p , www.nature.com/scientificreports/ only slightly reduces the variation. D(X, S) eventually converges to its limit 2 0.5 σ as predicted by Property 2. In other words, when is large, the quality of all FFL images X 's in practice is almost the same in terms of RMSMD. As shown in Fig. 1f, the RMSMDs of Fig. 1b, d with = 10 and 25 , respectively, differ slightly. In practice, when the average number of activations per emitter reaches = 10 , it is unnecessary to acquire more data frames in order to reduce RMSMD variation or uncertainty of an FFL image. x ijk , produces a set X of estimated locations each for one emitter. For the Gaussian distribution, x ij is the maximum likelihood estimator. By the symmetry of emitter placement, it follows from Eq. (11) that for the unbiased estimates and then for a large and σ ≪ a . Exploitation of temporal correlation reduces RMSMD by the maximum fold of 0.5 . The image X in Fig. 1c is obtained by averaging the locations estimated for the same emitter in the image X in Fig. 1b. After averaging, the RMSMD is reduced approximately by the maximum fold of 0.5 = 10 0.5 ∼ = 3.2 as shown in Fig. 1f. Moreover, with one estimated location for one emitter, the image X in Fig. 1c has a much better visual quality than that in Fig. 1b. Similarly, as shown in Figs. 1f and 2c, the RMSMD of Fig. 1e is about the maximum 0.5 = 5 times lower than that of Fig. 1d, and the former presents a much better visual quality than the latter. Figure 1f shows that as increases, the RMSMD and RMSE of X monotonically decrease at the rate about −0.5 as Property 2 and Property 5 predict.
RMSMD upper bound in a large localization error. We investigate how RMSMD is affected by a large localization error with zero bias b ij = 0 . As σ increases, the estimated emitter locations x ijk spread and RMSE in Eq. (22) monotonically increases without bound. This implies that the localization of emitters becomes worse and worse. However, as an estimated location x ijk enters another emitter's Voronoi cell V (s lm ) , RMSMD considers only the distance between x ijk and the nearest emitter location s lm instead of its own emitter location s ij . Consequently, RMSMD is eventually upper bounded and converges to a finite limit as σ → ∞ . In the limit, all estimated locations are uniformly distributed over the entire 2D plane. Due to the symmetric placement of s ij and the uniform distribution of x ijk , the RMSMD between X and S over the 2D plane is equal to the RMSMD over one Voronoi (24) h(X, S) = σ 2/ www.nature.com/scientificreports/ cell, say the Voronoi cell of s 00 = (0, 0) . According to Property 3, the limit MSMD is equal to the expectation of x 2 with x uniformly distributed over V (s 00 ) , that is This implies that as RMSE increases, RMSMD is eventually upper bounded and converges to the constant a/6 0.5 .
All FFL images X 's for a sufficiently large σ are statistically identical and their visual qualities are also the same. The uniform distribution of estimated locations in the limit of σ → ∞ is equivalent to a random guess of the emitter locations and no information about the emitter locations is embedded in the uniform distribution. Because of this, the limit RMSMD of a/6 0.5 is considered the upper bound of RMSMD, which correspond to the worst quality of a localization nanoscopy image. Now we determine the limit D(S,X) as σ → ∞ . For the nanoscopy image X , there is one estimate x ij for each emitter s ij and x ij is uniformly distributed in the limit. Hence, the probability that k estimates x ij 's are located in V (s 00 ) is a Poisson distribution with a unit mean, that is, e −1 /k! . Denote by D k (X ∞ , s 00 ) the limit RMSMD over the Voronoi cell V (s 00 ) that contains k estimated locations. By Eq. (6), the limit D(X, S) is given by To evaluate Eq. (27) is tedious but a lower bound can be obtained. For k = 0 , V (s 00 ) contains no estimated location and the nearest x ij must be outside V (s 00 ) , and then D 2 0 (X ∞ , s 00 ) > a 2 /3 , which is the average squared distance from the origin to the boundary of V (s 00 ) . For k = 1 , V (s 00 ) contains one estimated location and D 2 1 (X ∞ , s 00 ) = a 2 /6 given by Eq. (26). For any k ≥ 2 , we have D 2 k (X ∞ , s 00 ) > D 2 1 (X ∞ , s 00 ) . Therefore, which is greater than the limit D 2 (X, S) in Eq. (26). This means that as the variance of localization error σ 2 increases, D(X, S) eventually surpasses D(X, S) and the averaging no longer reduces RMSMD. However, as shown numerically below, this does not occur in a practical experiment where a localization error is usually much smaller than the localization error at which D(X, S) intersects with D(X, S). As shown in Fig. 2c with = 25 , in the region of small σ , D(X, S) and D(X, S) are approximately equal to h(X, S) and h(X, S) , respectively, and D(X, S) is improved by the maximum fold of 0.5 = 5 over D(X, S) . As σ increases, D(X, S) is eventually upper bounded and converges to the upper bound of a/6 0.5 . Meanwhile, D(X, S) increases and the improvement by the averaging dwindles. Though not shown in the figure, D(X, S) eventually surpasses D(X, S) and converges to its upper bound that is slightly larger than the approximated upper bound of (1 + e −1 ) 0.5 a/6 0.5 . This means that Eq. (28) is a good approximation of the upper bound in Eq. (27), which is confirmed in Figs. 3c,d and 4d as well. Predicted by their much smaller RMSMDs, the visual qualities of images X in Figs. 1c, e and 2b are much better than those of X in Figs. 1b, d and 2a, respectively, implying that the temporal correlation can significantly improve the image quality. In return, this implies that RMSMD is a rational quality metric for localization nanoscopy images. Finally, as σ increases, h(X, S) and h(X, S) increase linearly without bound, meaning that RMSE is not a proper quality metric for large localization errors.
Effect of bias. Now we investigate the effect of localization biases on RMSMD. Specifically, the estimated locations x ijk are Gaussian distributed with mean E(x ijk ) = s ij + b ij , b ij = 0 , and covariance matrix C = diag(σ 2 , σ 2 ) . Unlike the sample drift, the biases of estimated locations x ijk 's for different emitter s ij 's are usually different.
When both the variance of localization error σ 2 and the variance of biases δ 2 across emitters are small such that the estimated locations all are almost surely located in the Voronoi cells of their own emitters, Property 2 and Property 4 are applicable and As expected, the averaging cannot reduce the effect of biases. As σ → ∞ , D 2 (X, S) still converges to the right-hand side of Eq. (26) regardless of bias δ . On the other hand, given σ , as δ → ∞ , all estimated locations are eventually uniformly distributed, that is, δ plays a similar role in D(X, S) and D(X, S) as σ does. Hence, similar to Eqs. (26) and (28), we obtain  www.nature.com/scientificreports/ Figure 3 shows the effect of bias and variance of localization errors on RMSMD and RMSE with = 25 . Figure 3a,b respectively show an image of X and its corresponding X with σ = 25 nm and δ = 25 nm. The biases for different emitters are different. As shown in Fig. 3c, in the region of small δ , the RMSMDs of X and X are approximately equal to h(X, S) and h(X, S) , respectively. As δ increases, both eventually diverge and vary significantly around their upper bounds in Eqs. (31) and (32), respectively. As σ increases, the RMSMDs of X and X with δ = 25 nm behave similarly to those in Fig. 2c with zeros bias; but the former is lifted and pressed towards the upper bounds due to the bias. It is worthy to point out that comparing Fig. 3c, d, the RMSMDs of both X and X converge faster to their bounds as δ increases than as σ increases. Moreover, the biases cannot be reduced by the averaging. Therefore, the variance of biases across emitters affects more severely on the RMSMD than the variance of localization errors.
Effect of sample drift. We investigate the effect of sample drift on RMSMD. While the localization errors cause different biases across emitters, a sample drift produces the same bias on all emitters. Because of this, the drift in a localization nanoscopy image is easy to identify and remove. Nevertheless, the effect of a drift on RMSMD is significant as analyzed below.
In comparison, as the drift increases, the X with the drift of (d 1 , d 2 ) is statistically identical to the X with the drift of (d 1 , d 2 ) + (ma, la) for integers m and l. This implies that D(X, S) varies periodically with a period of a as the drift changes, and so does D(X, S) . Considering the period, when the estimated locations for one emitter are all located inside the Voronoi cell of an emitter, the RMSMDs of X and X are still determined by Property 2 and Property 4, that is, www.nature.com/scientificreports/ The averaging does not change the sample drift. As σ → ∞ , the RMSMDs of X and X still converge respectively to their upper bounds of Eqs. (26) and (27) regardless of drift.
In Fig. 4a-d the drift (d 1 , Figure 4a is an image of X with σ = 25 nm and d = −40 nm in which the effect of drift can be seen. Figure 4b is the image X obtained by averaging from (a). The visual quality is significantly improved and the effect of sample drift can be seen unchanged. The RMSMDs of (a) and (b) are indicated in (c) and (d). Figure 4c demonstrates how RMSMD and RMSE change with respect to d with σ = 25 . As |d| increases, RMS-MDs of X and X are eventually bounded and vary periodically with the period of a while RMSEs increase without bound. When the drift is small such as d = −40 nm in (a) and (b), D(X, S) ∼ = h(X, S) and D(X, S) ∼ = h(X, S) . However, when the drift is large, they diverge significantly. It is noticeable that the worst drift is d = (k + 0.5)a such that the estimated locations are located at the vertices of four adjacent Voronoi cells. In this case, RMSMDs of X and X are larger than the corresponding bounds in Eqs. (31) and (32). However, under any sample drift the nanoscopy image has the same pattern as that after the drift is removed. Furthermore, a sample drift is easy to identify and remove. Hence, the upper bounds in Eqs. (26) and (27) are still considered the highest RMSMD that correspond to the worst quality of nanoscopy images where no information of emitter locations is contained. Figure 4d demonstrates how RMSMD and RMSE change with respect to σ with the drift of d = −40 nm. The RMSMDs of X and X behave similarly to Fig. 3d with bias. Due to the symmetric placement of emitters and the small drift, the effect of drift is similar to that of a bias.
Methods to exploit temporal correlation. In this paper, we focus on analysis of the potential maximum quality improvement of FFL images by exploiting its embedded temporal correlation. In this section, we briefly discuss how to develop such an algorithm to exploit the temporal resolution. First, due to its photodynamics each emitter is usually assumed to be activated independently from one frame to another in accordance with a Markov chain 44  www.nature.com/scientificreports/ Markov chain and therefore are temporally correlated. The properties of the Markov chain can be exploited to identify the estimated locations that are generated by the same emitter. Second, the estimated locations of an emitter are usually distributed as a cluster around its true location. Exploiting the property of clusters can detect the identity of estimated locations and improve the image quality. Many existing clustering algorithms in the literature 76 are ready to apply, say the k-means method, the methods based on the Gaussian mixture model, etc. While an algorithm can exploit either the property of a Markov chain or the property of clusters, an optimum algorithm shall jointly exploit the properties of both the Markov chain and the clusters, which is necessarily more computationally complex.

conclusions
We have analyzed the statistical properties of root mean square minimum distance (RMSMD) and root mean square error (RMSE) for the frame-by-frame localized (FFL) nanoscopy images. When the average number of estimated locations per emitter is greater than ten, the variation of RMSMD is slightly reduced by continuously increasing ; and then increasing the number of data frames in an acquisition is unnecessary. On the other hand, exploiting the temporal resolution can reduce RMSMD and RMSE by a maximum fold of 0.5 and therefore the fold of improvement increases as the number of acquired data frames increases. When the localization error is small, the RMSMD and the RMSE coincide. As the localization error increases without bound, the RMSE increases without bound; in contrast, the RMSMD is eventually upper bounded by that of the worst nanoscopy image where all estimated locations are uniformly distributed and no information about emitter locations is contained. This implies that even for large localization errors, the RMSMD is a proper metric of image quality but the RMSE is not without saying that the RMSE is not applicable in practice. The random biases of localization errors across emitters affect the RMSMD in the similar way to the variance of localization errors but the former affects more severely than the latter. As the sample drift increases, the RMSMD goes up and down alternately. The analytical results for the emitters located on the 2D grids can be used as a reference to benchmark the quality of FFL nanoscopy images. An algorithm to exploit the temporal resolution can take use of the properties of the Markov chain and clusters. The results suggest to develop two kinds of algorithms: the algorithms that can exploit the temporal correlation of FFL nanoscopy images and the unbiased localization algorithms.

Proof of Property 4
By the law of large numbers, as → ∞ , x i → s i almost surely and then the probability that x i is in the Voronoi cells of other s j for j = i tends to zero, that is, Pr(x i ∈ V (s j )) → δ ij for all i , j ; and correspondingly, Pr(s i ∈ V (x j )) → δ ij . X and S are a pair of kernel sets. It follows from Eq. (3) in Ref. 66