Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2022 Dec 30.
Published in final edited form as: Opt Lett. 2022 Dec 15;47(24):6333–6336. doi: 10.1364/OL.474604

Correcting sampling bias in speckle contrast imaging

Shuqi Zheng 1,*, Jerome Mertz 2
PMCID: PMC9801309  NIHMSID: NIHMS1856545  PMID: 36538431

Abstract

When performing spatial or temporal laser speckle contrast imaging (LSCI), contrast is generally estimated from localized windows containing limited numbers of independent speckle grains NS. This leads to a systematic bias in the estimated speckle contrast. We describe an approach to determine NS and largely correct for this bias, enabling a more accurate estimation of the speckle decorrelation time without recourse to numerical fitting of data. Validation experiments are presented where measurements are ergodic or non-ergodic, including in-vivo imaging of mouse brain.


When laser light is directed into tissue, it produces speckle patterns that can fluctuate in space and time. These fluctuations are commonly characterized by their contrast. In laser speckle contrast imaging (LSCI), contrast reflects the amount of blurring induced by motion in the tissue. For example, contrast measured locally can provide spatially resolved maps of blood flow or tissue perfusion. However, the accuracy of speckle contrast is confounded by several factors that must be corrected. First, contrast is reduced by spatiotemporal filtering caused by the finite resolution and response time of the camera [1, 2]. Second, detection noise produces a systematic error in the contrast measurement [3]. Third, like any estimator, a bias error occurs between the true contrast and the actual measured contrast obtained with limited statistics. This last error is appreciated by the LSCI community but has not been fully characterized nor described theoretically. For example, in the case of spatial LSCI, sampling error can be corrected based on a phenomenological calibration curve to account for a maximum achievable speckle contrast less than unity [1]. Alternatively, a reference image acquired with static speckle can partially correct for sampling error [4], though with a correction that becomes less accurate with increasing speckle dynamics. An improved estimate can be obtained by considering the correlations between neighboring pixels [5]. In Ref [6], which relies on a property of gamma statistics, the measured contrast can be made independent of window size, though while continuing to deviate from the true contrast. We note that errors caused by insufficient sampling statistics can be substantial [1]. A strategy to robustly correct for these errors can thus be of general utility. To describe such a strategy, we begin with a general description of the method of LSCI itself.

For simplicity, we consider only spatial and temporal degrees of freedom of speckle, and neglect detection noise for now. In the ideal case of a camera of infinitely high spatiotemporal resolution, the intensity fluctuations of fully developed speckle, in the ergodic limit, are known to obey the Siegert relation [7]

I(ρ+δ,t+τ)I(ρ,t)=I2(1+|h(δ)|2|g1(τ)|2) (1)

where ρ and t are spatial and temporal coordinates, 〈.〉 is an ensemble average, h(δ) is the spatial field correlation function (the imaging amplitude point spread function), and g1(τ) is the temporal field correlation function. The goal of LSCI is to infer the time constant τc associated with the decay of g1(τ), which provides information on the sample dynamics of interest. As noted above, this generally involves measuring the speckle contrast (squared), defined by K¯2=σI2/I2, where σI2 is the intensity variance. From Eq. 1 we have K¯2=|h(0)|2|g1(0)|2=1. However, in practice, the spatiotemporal resolution of a camera is not infinite owing to the finite area P of its pixels and the finite duration T of its exposure, both of which lead to filtering of the measured intensity fluctuations. In practice, then, we have

K¯2=QP(δ)|h(δ)|2d2δQT(τ)|g1(τ)|2dτ=1MPMT (2)

where QP (δ) and QT (τ) are the autocorrelation functions of the pixel and exposure windows [8]. MP and MT can thus be interpreted as the average number of measured spatiotemporal speckle grains per pixel and per exposure time, respectively (both greater than or equal to 1). Note that MP1 is often written as β in the literature. In the event that MP is known in advance, K¯2 provides a direct measure of MT. In turn, τc can be inferred from MT either by fitting to a numerical model for g1(τ) [9, 10], or, more generally, by a method of temporal integration [11].

The above analysis neglects a crucial source of error. In particular, we have assumed that the averages, denoted by 〈.〉, are ensemble averages measured over all possible speckle realizations. In practice, the measurements are over only a finite number of samples. The sampled speckle intensity variance and mean are defined to be

σ^I2=1Ni=1N(IiI^)2   and   I^=1Ni=1NIi (3)

where N denotes the number of independent speckle grains in each measurement. The sampled contrast is then defined by K^2=σ^I2/I^2. However, both the numerator and denominator are biased in this definition, and no amount of averaging corrects for this bias. That is, the true (unbiased) contrast K¯2 is given by neither σ^I2/I^2 nor σ^I2/I^2. To correct for bias, we correct σ^I2 and I^2 individually. In particular, from Eqs. 3 we find

σI2=NN1σ^I2 (4)
I2=I^21N1σ^I2 (5)

The variance correction [Eq. (4)] is the well known Bessel correction, which is generally applied in LSCI. The mean-squared correction [Eq. (5)], however, does not appear to be as generally applied. The above equations lead to

K¯2=σI2I2=σ^I2I^21NI^2+σ^I2 (6)

Equation 6 describes the exact relation between the true (unbiased) contrast and the sampled (biased) contrast in the case of infinite speckle realizations. In the case of finite speckle realizations, the brackets on the r.h.s. of Eq. 6 become replaced by finite averages (or omitted for single realizations), and Eq. 6 becomes a sampling-error-corrected estimate rather than an exact relation. Note that in all cases the numerator and denominator should be corrected prior to taking their ratio.

There remains yet another source of error which must be accounted for, namely the detection noise that comes from shot noise and camera readout noise. Assuming these are independent, they produce a total noise variance given by σn2=σSn2+σrn2, where σsn2=I^ (in units of number of photons) and σrn2 is assumed known a priori. We note that the number of independent speckle and noise samples may differ in general. For example, for spatial LSCI with sampling windows comprising NP pixels, the number of independent speckle samples is NS = NP if the grains are smaller than the pixels, and NS < NP if they are larger than the pixels. On the other hand, the number of independent noise samples is always given by NP. We thus have

σ^I2=NS1NSσI2+NP1NPσn2 (7)
I^2=I2+1NSσI2+1NPσn2 (8)

leading finally to

K¯2=σ^I2σn2+1NPσn2I^21NSI^2+σ^I2+(1NS1NP)σn2 (9)

Equation 9 is the main finding of this work. It relates the true (unbaised) speckle contrast to the measured intensity and noise contrasts. The parameters that must be known in advance are NP and NS. While the former is unambiguous, the latter requires an extra measurement step. For example, let us again consider spatial LSCI with a sampling window of area W (comprising NP pixels). If the average area of the speckle grains AS is somehow known to be greater than the pixel area P, then NSW/AS. While this estimate is acceptable, there is a simpler and more accurate method to determine NS. Consider measuring the speckle variance across a large area where the average intensity is broadly uniform. Because the area contains many speckle grains, we may assume K^2K¯2=1/MpMT. Next, consider measuring the sample variance over the same large area but where the pixels are first binned into super-pixels of area equal to the sampling window area, i.e. W. The measured contrast becomes reduced and is now given by K^W2=1/MWMT. The average number of independent speckle measurements per sampling window is then determined directly from NS=MW/MP=K^2/K^W2.

We first verify our correction approach numerically. Speckle images of known g1(t) are simulated following the method described in Ref. [12], using a generally-applied model g1(t)=et/τc, τc = 0.3 ms. Spatiotemporal integration (i.e. MP and MT) are controlled by varying speckle size and exposure time T respectively. We consider sampling windows of different sizes NP to evaluate spatial speckle contrast for the case T/τc = 1. In Fig. 1(a) we show that the measured contrast deviates more and more significantly from the known true contrast as the sampling window size decreases. This sampling error is well known in the LSCI community. Our approach to correcting this error involves first determining the average number of independent speckle samples NS per window, as prescribed by the binning calibration procedure described above (Fig. 1(b)). In turn, this enables us to correct for sampling bias in the measured contrast according to Eq. 6 (N = NS in the absence of noise). We observe that our correction is substantial, even in the case of single speckle realizations. In particular, we verify that NS is the key parameter that influences the accuracy of the contrast estimator and that our proposed correction successfully reduces error to below 5% for single speckle realizations with as few as 5 speckle grains per sampling window in the case T/τc = 1.

Fig. 1.

Fig. 1.

Simulation of uncorrected and corrected spatial K^2. (a) Ensemble average uncorrected K^2 as a function of sampling window size NP for different speckle sizes (from purple-yellow-red-blue: increasing speckle-to-pixel size with MP = 1.75, 1.47, 1.23, 1.12). (b) Calibrated NS as a function of NP. (c) Corresponding bias-corrected K^2 as a function of NP for both single (solid triangle) and multiple (empty triangle, average number 5) speckle realizations. Dotted lines: true K¯2. (d) Percent errors for uncorrected (circle) and corrected (triangle) K^2 in the case of single-speckle-realizations.

We next make allowances for detection noise by including shot noise and readout noise in our simulation. The camera gain was set to 0.1 ADU/e and readout noise was 11 e, for the case MP = 1.23 and T/τc = 10. In Fig. 2, we compare the sampling-corrected contrast obtained from a speckle image with (empty triangle, black) and without detection noise (solid triangle, blue), for single speckle realizations. As expected, noise correction prevents the overestimation of contrast. The overall error remains below 2% (Fig.2(b)). For comparison, the measured K^2 uncorrected for sampling bias is also plotted in circles, showing substantial error (15%) for small NS.

Fig. 2.

Fig. 2.

Simulation of sampling bias and detection noise correction. (a) Uncorrected (circle) and corrected (triangle) K^2 as a function of NS, for single speckle realizations. Solid circles and triangles are K^2 from a clean measurement (noise-free). Empty circles and triangles are K^2 from a noisy measurement before (blue/red) and after (black) noise correction. Dashed line: true K¯2. (b) Percent error of uncorrected and corrected K^2 compared to true K¯2 from noisy/clean measurement.

We proceed to demonstrate the effectiveness of sampling-bias correction with experimental data. For all experiments, the laser was monochromatic (Newport HeNe N-LHP-925) and a crossed polarizer was placed in front of the camera (Basler acA2040–180km/kc). NS was determined using the binning procedure described above, with a static reference sample made of Teflon (MT = 1), and with long enough exposure time (large enough accumulated power) that detection noise could be neglected.

An ergodic measurement [13] was first conducted, wherein speckle was considered dynamic throughout the imaging field of view. The sample was made of a 250 μm capillary (mimicking a vessel) embedded within a scattering liquid (mimicking dynamic tissue). Milk was pumped through the capillary at 1μL/min (equivalently 0.34 mm/s, see details in Ref. [11]). We recorded a sequence of 100 images at 33 Hz frame rate (T = 30 ms). The temporal contrast K¯T2 was measured at each pixel across the 100 frames (enough frames to be considered an ensemble average). The spatial contrast K^S2 was measured in local windows of NP pixels, corrected for sampling bias (Eq. 9), with averaging across the 100 frames. Detection noise correction for both made use of the known camera gain and readout noise. Figure 3 compares MT = 1/K2MP (MP = 1.85) obtained from three measures of contrast. Temporal contrast here provides a true measure of MT and is considered to represent ground truth. An example image of the capillary is shown in Fig.3(a) and line profiles of this true MT are shown in green in Fig.3(c). We then gradually increased the sampling window size (NP = 25, 49, 121) and plotted MT obtained from the spatial (as opposed to temporal) contrast, both before (blue) and after sampling-bias correction (red). In the former case, MT is systematically overestimated owing to inadequate sampling, though with reduced error as NP increases (i.e. at the cost of spatial resolution). On the contrary, the corrected MT remains accurate even for the smallest sampling window (~4 speckle grains per window). We note that for the example shown in Fig. 3 we have MT ≫ 1, meaning that Tτc. In this specific case, τc can be extracted directly from contrast in a simple manner without knowledge of the exact model for g1(t) or any numerical fitting [14], obtaining

τc=TMT1=TK¯S2MP (10)

Fig. 3.

Fig. 3.

Imaging of capillary embedded in scattering liquid. (a) MT1 (capillary oriented vertically). (b) Model-independent map of τc1. (c) Cross-section along dashed line in (a) of true MT=1/K¯T2MP (green), corrected MT (red) and uncorrected MT (blue) from K^S2MP. Note agreement between green and red traces. Scale bar: 50 μm.

Finally, we apply our correction procedure to in-vivo mouse brain imaging (setup described in detail in Ref.[11]). Here we chose an imaging region close to the edge of the cranial window and recorded 100 frames with frame rate 33 Hz (T = 30 ms). K^S2 and K^T2 were measured and corrected as described above. The thinned-skull region outside the cranial window can be easily identified from the artifact apparent in the contrast images (Fig. 4(a,b)), indicating the presence of static scattering. This case is more difficult to analyze because it can no longer be considered ergodic and Eq. 2 no longer applies. Indeed, the temporal component of this equation must be modified based on a modified Siegert relation, leading to [11]

MT1=K¯S2MP=QT(τ)|ξ1g1(τ)+ξ0|2dτ (11)

where ξ0 and ξ1 = 1 − ξ0 are the intensity fractions of static and dynamic scattering respectively, which can be determined from the single-exposure quantitative LSCI prescription [15]

ξ0=(K¯S2K¯T2)MP (12)

Fig. 4.

Fig. 4.

In-vivo mouse brain imaging. (a) Spatial contrast KS2. (b) Temporal contrast KT2. (c-f) Inverse correlation time (τc1) obtained from corrected (c,d) and uncorrected (e,f) K^2 with different sampling window sizes: (c,e) NP = 25; (d,f) NP = 121. For (c-f), top: τc1; bottom left: (K^S2K^T2)MP; bottom right: fraction of static scattering ξ0 (negativities set to 0). Scale bar: 50 μm.

In the regime of Tτc and noting that QT(τ) ≈ T−1 for small τ, Eq. 11 reduces to

MT1τc(ξ12+2ξ1ξ0η)/T+ξ02 (13)

where we have applied the definition of τc = ∫ |g1(τ)|2 from Ref. [11]. The parameter η = ∫ Re [g1(τ)] / ∫ |g1(τ)|2 accounts for the general sharpness of g1(τ). Therefore, the expression for τc in the presence of static scattering becomes

τc=T(MT1ξ02)/(ξ12+2ξ1ξ0η) (14)

We emphasize that Eq. 14 allows for the calculation of τc directly from MT1=K¯S2MP without any numerical fitting. However, unlike Eq. 10 which is model independent, Eq. 14 requires a model parameter η depending on the form of g1(τ).

Figure 4 shows quantitative imaging results. The top panels in Fig. 4(c,d) display τc1 obtained from the corrected K^S2 with different sampling window sizes (NP = 25, 121), illustrating good agreement between two maps. Here we used η = 4 as an example, since the static scattering occurred mostly in parenchymal tissue regions [14]. The corresponding (K^S2K^T2)MP and ξ0 are shown in Fig. 4(c,d) bottom left and right, where (K^S2K^T2)MP is always non-negative. The static scattering contribution was found to be about 5% in parenchymal regions and ~ 2% in blood vessels, regardless of the sampling window size. For comparison, the same processing was performed with uncorrected K^S2 and the results are shown in Fig. 4(e,f). In Fig. 4(e), large bias error was present due to insufficient sampling, leading to erroneous negativities in K^S2K^T2, and an underestimation of ξ0 (bottom right). The resulting τc1 is significantly overestimated for small window size (NP = 25). This overestimate is reduced for larger window size (Fig. 4(f)) where τc1 approaches that in Fig. 4(c,d), but at the cost of spatial resolution.

In summary, we present a procedure to substantially correct for sampling bias when evaluating speckle contrast, with or without detection noise, leading to more accurate measures of τc. We verified our approach with simulated data and applied it to experimental LSCI. In the case of ergodic measurements, our correction provides accurate contrast values, enabling a model-free reconstruction of τc from spatial measurements only. In the case of non-ergodic measurements, our method enables a more accurate estimate of the contribution of static scattering, facilitating single-exposure quantitative LSCI with no recourse to numerical fitting. While we only considered spatiotemporal degrees of freedom in our analysis here, more degrees of freedom (e.g. polarization, spectral) can be readily included as multipliers in Eq. 2, or, alternatively, directly incorporated into MP (or β). In closing, our correction approach can be of broad utility for other contrast based modalities, including speckle contrast optical spectroscopy [3] and diffusing wave spectroscopy[16].

Acknowledgments.

We thank Lisa Kretsge, Kelly Wingfield and Alberto Cruz-Martin for providing mouse samples.

Funding.

National Institutes of Health (R01EB029171, R21GM134216).

Footnotes

Disclosures. The authors declare no conflicts of interest.

Data availability.

Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.

FULL REFERENCES

  • 1.Thompson O, Andrews M, and Hirst E, “Correction for spatial averaging in laser speckle contrast analysis,” Biomed. Opt. Express 2, 1021–1029 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Bandyopadhyay R, Gittings A, Suh S, Dixon P, and Durian DJ, “Speckle-visibility spectroscopy: A tool to study time-varying dynamics,” Rev. Sci. Instruments 76, 093110 (2005). [Google Scholar]
  • 3.Valdes CP, Varma HM, Kristoffersen AK, Dragojevic T, Culver JP, and Durduran T, “Speckle contrast optical spectroscopy, a non-invasive, diffuse optical method for measuring microvascular blood flow in tissue,” Biomed. Opt. Express 5, 2769–2784 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Qiu J, Li Y, Huang Q, Wang Y, and Li P, “Correcting speckle contrast at small speckle size to enhance signal to noise ratio for laser speckle contrast imaging,” Opt. Express 21, 28902–28913 (2013). [DOI] [PubMed] [Google Scholar]
  • 5.Skipetrov SE, Peuser J, Cerbino R, Zakharov P, Weber B, and Scheffold F, “Noise in laser speckle correlation and imaging techniques,” Opt. Express 18, 14519–14534 (2010). [DOI] [PubMed] [Google Scholar]
  • 6.Hong J, Shi L, Zhu X, Lu J, and Li P, “Laser speckle auto-inverse covariance imaging for mean-invariant estimation of blood flow,” Opt. Lett 44, 5812–5815 (2019). [DOI] [PubMed] [Google Scholar]
  • 7.Goodman JW, Statistical optics (John Wiley & Sons, 2015). [Google Scholar]
  • 8.Mertz J, Introduction to optical microscopy (Cambridge University Press, 2019). [Google Scholar]
  • 9.Parthasarathy AB, Tom WJ, Gopal A, Zhang X, and Dunn AK, “Robust flow measurement with multi-exposure speckle imaging,” Opt. Express 16, 1975–1989 (2008). [DOI] [PubMed] [Google Scholar]
  • 10.Postnov DD, Tang J, Erdener SE, Kılıç K, and Boas DA, “Dynamic light scattering imaging,” Sci. Adv 6, eabc4628 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Zheng S and Mertz J, “Direct characterization of tissue dynamics with laser speckle contrast imaging,” Biomed. Opt. Express 13, 4118–4133 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.James E, Powell S, and Munro P, “Simulation of statistically accurate time-integrated dynamic speckle patterns in biomedical optics,” Opt. Lett 46, 4390–4393 (2021). [DOI] [PubMed] [Google Scholar]
  • 13.Zakharov P, “Ergodic and non-ergodic regimes in temporal laser speckle imaging,” Opt. Lett 42, 2299–2301 (2017). [DOI] [PubMed] [Google Scholar]
  • 14.Liu C, Kılıç K, Erdener SE, Boas DA, and Postnov DD, “Choosing a model for laser speckle contrast imaging,” Biomed. Opt. Express 12, 3571–3583 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Wang Y, Wen D, Chen X, Huang Q, Chen M, Lu J, and Li P, “Improving the estimation of flow speed for laser speckle imaging with single exposure time,” Opt. Lett 42, 57–60 (2017). [DOI] [PubMed] [Google Scholar]
  • 16.Xu J, Jahromi AK, and Yang C, “Diffusing wave spectroscopy: A unified treatment on temporal sampling and speckle ensemble methods,” APL Photonics 6, 016105 (2021). [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.

RESOURCES