## Introduction

Localization-based fluorescence microscopy relies on sparse activation of individual fluorophores within a sample (Betzig *et al.*, 2006; Hess *et al.*, 2006; Rust *et al.*, 2006). The activated fluorophores are spatially well separated and can be imaged individually. This activate-and-image process is then repeated over many frames, after which the coordinates of each detected fluorophore are determined computationally and combined to yield the final super-resolved image. The point spread function (PSF) model of the microscope plays a key role in these techniques. Every point-source fluorophore gives rise to a PSF pattern in the image domain, and a localization procedure is applied to the individual patterns. The PSF model that is being used for the localization task determines the accuracy that can be achieved in describing the examined biological structure (Manley *et al.*, 2008; Hedde *et al.*, 2009; Märki *et al.*, 2010; Geissbühler *et al.*, 2011).

Localization accuracy is also determined by the level and type of noise. Poisson noise may appear in the acquired image due to the photon emission characteristics of the fluorophore and due to scattering background noise. Gaussian additive noise, introduced by the imaging sensors, may further reduce the localization accuracy. This matter has been investigated within the context of estimation theory, giving rise to Cramér-Rao lower bounds on the achievable localization accuracy of the Gaussian, the Airy pattern and the Gibson and Lanni models (Ober *et al.*, 2004; Aguet *et al.*, 2005). Many of the currently available localization algorithms utilize the Gaussian model (Bobroff, 1986; Betzig *et al.*, 2006; Hess *et al.*, 2006; Rust *et al.*, 2006; de Moraes Marim *et al.*, 2008; Hedde *et al.*, 2009; Henriques *et al.*, 2010; Wolter *et al.*, 2010).

The Gaussian function provides a reasonable approx-imation of the main lobe of the Airy pattern while introducing relatively low computational complexity. Such approximation, however, discards the side-lobes of the PSF, which are particularly important in 3-D PSF modelling (Zhang *et al.*, 2007). The trade-off between choosing realistic and simplified PSF models is execution time, and we propose here to apply a two-stage approach: fast algorithms that rely on simplified PSF models can be used to obtain preliminary results as well as immediate feedback about the quality of the experiment whereas more realistic 3-D PSF models can be used for a more accurate analysis, performed at a later stage.

In this work we introduce a least-squares PSF fitting framework that utilizes realistic 3-D PSF models. In particular, the Gibson and Lanni model was shown to be very useful for restoration problems in microscopy (Markham & Conchello, 2001; Preza & Conchello, 2004), and we demonstrate its usefulness for particle localization and for defocus estimation, too. The least-squares localization approach is likely to yield less accurate results than the maximum-likelihood approach in the presence of non-Gaussian noise sources (Aguet, 2009), and a quantitative comparison of these two criteria was carried out in Abraham *et al.* (2009) for the Gaussian and for the Airy disc patterns. It was shown there that in terms of performance, the least-squares fitting method follows the maximum-likelihood method quite closely, introducing standard deviations that are larger by no more than 2 (nm) for the estimated lateral position of a particle. An exception to that is the case of relatively strong mismatch between the width values of the simulated and the fitted PSFs. This can, however, be taken into account by estimating this parameter from the data itself, or by optimizing for it, too.

These findings make the least-squares criterion an attrac-tive and nearly optimal method for PSF fitting tasks. It is a simple yet powerful tool that depends on the fitted model only. Its additional advantage is that it lends itself to a fast minimization using the Levenberg–Marquardt algorithm. The maximum-likelihood criterion, by contrast, requires additional knowledge on the noise sources and relies on optimization procedures that are in many cases more involved in terms of the cost function and in terms of the numerical implementation of the minimization procedure (Aguet *et al.*, 2005; Abraham *et al.*, 2009).

The paper is organized as follows: we describe the Gibson and Lanni model and compute its partial derivative functions while taking into account the stage displacement, the particle axial position and the defocus measure of the detector plane. We then introduce an efficient way of evaluating these functions. As an example application, we utilize the Gibson and Lanni 3-D PSF model for localizing particles in a *z*-stack. We fit the data with the 3-D position coordinates and with an amplitude value that accounts for the random nature of the photon emission rate. Our algorithm uses adaptive threshold values for local maxima identification, and an adaptive window size for the least-squares fit. Motivated by multiplane imaging (Prabhat *et al.*, 2004; Ram *et al.*, 2008), we also introduce an algorithm for estimating the defocus distance of the detector plane. All of our algorithms were implemented as ImageJ plugins^{1}; they are briefly described in Appendix B.