MATLAB functions for calculating spatial and temporal speckle contrast for performing laser speckle contrast imaging. Code developed for the Functional Optical Imaging Laboratory (FOIL) at the University of Texas at Austin.
spatial_speckle_contrast(raw,w)- Calculate spatial speckle contrasttemporal_speckle_contrast(raw,w)- Calculate temporal speckle contrast
raw- Raw data in the form of anMxNxnmatrix whereMxNis the dimension of a single raw image andnis the number of raw images to be processed. Note: Processing large quantities of images may require splitting the data into batches to avoid memory issues.w- Size of the sliding window (wxw) used during spatial speckle contrast calculation or the number of raw frames (w) used during temporal speckle contrast calcuation.
(___,'mode','gpu')- Enable GPU processing on compatible hardware. Defaults to CPU processing ('cpu').(___,'debug',true)- Enable verbose diagnostic information about the processing. Disabled by default (false).
sc- Matrix containing the calculated speckle contrast.- The output of
spatial_speckle_contrastwill be anMxNxnmatrix. Note: The outerw/2edge of pixels will contain unreliable information due to padding. - The output of
temporal_speckle_contrastwill be anMxNx(n-w+1)matrix.
- The output of
Tested performance on PC running Windows 10 with Intel i7-9700K CPU and NVIDIA GeForce RTX 2060 GPU with 1200x1000x1000 dataset.
| w | CPU | GPU | |
|---|---|---|---|
spatial_speckle_contrast |
7 | 39 fps | 106 fps |
temporal_speckle_contrast |
49 | 8.6 fps | 10 fps |
Colin Sullender. Calculate Speckle Contrast. (2022) doi:10.5281/zenodo.6657812.
BibTeX
@software{sullender:10.5281/zenodo.6657812,
author = {Colin Sullender},
title = {Calculate Speckle Contrast},
month = jun,
year = 2022,
publisher = {Zenodo},
version = {v1},
doi = {10.5281/zenodo.6657812},
url = {https://doi.org/10.5281/zenodo.6657812}
}