PGURE-SVT (Poisson-Gaussian Unbiased Risk Estimator - Singular Value Thresholding) is an algorithm designed to denoise image sequences acquired in microscopy. It exploits the correlations between consecutive frames to form low-rank matrices, which are then recovered using a technique known as nuclear norm minimization. An unbiased risk estimator for mixed Poisson-Gaussian noise is used to automate the selection of the regularization parameter, while robust noise and motion estimation maintain broad applicability to many different types of microscopy.
More information on the algorithm can be found in our paper in Ultramicroscopy.
If you use this code in a publication, please cite our work:
T. Furnival, R. K. Leary and P. A. Midgley, "Denoising time-resolved microscopy sequences with singular value thresholding", Ultramicroscopy, vol. 178, pp. 112–124, 2017. DOI:10.1016/j.ultramic.2016.05.005
PGURE-SVT is released free of charge under the GNU General Public License (GPLv3).
To successfully compile the C++ code, PGURE-SVT requires the following packages and libraries to be installed on your machine first.
When installing the Armadillo linear algebra library, it is recommended that you also install a high-speed BLAS replacement such as OpenBLAS or MKL; more information can be found in the Armadillo documentation.
To build the Python package from source:
$ git clone https://github.com/tjof2/pgure-svt.git
$ cd pgure-svt
$ pip install -e .
PGURE-SVT has been tested on Ubuntu 12.04+. For OSX users, you may need to use the GCC compiler rather than the default.
Use CMake to compile and install PGURE-SVT. Note that it requires LibTIFF to be available on your system. To install the PGURE-SVT executable into /usr/bin
, use:
$ git clone https://github.com/tjof2/pgure-svt.git
$ cd pgure-svt
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
To change the install location, type cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
, and recompile with make && sudo make install
.
PGURE-SVT can be used either from Python, or as a standalone executable.
PGURE-SVT comes with a simple Python wrapper that accepts any NumPy array with dimensions (nx, ny, T)
for denoising.
import numpy as np
from pguresvt import pguresvt
# Example dataset has dimensions (nx, ny, T),
# in this case a 128x128px video with 25 frames
X = np.random.randn(128, 128, 25)
# Initialize the algorithm
# with default parameters
svt = pguresvt.SVT()
# Run the algorithm on the data X
svt.denoise(X)
# Get the denoised data Y
Y = svt.Y
For more information on the effects of the parameters, users are referred to the publication.
patchsize
- Dimensions of spatial patches in pixelspatchoverlap
- Step size in pixels by which successive spatial patches are displaced with respect to one anotherlength
- Length in frames of a temporal block (must be odd integer)optimize
- Turn on (True
) or off (False
) optimization of lambda with PGURE (ifFalse
, threshold must be specified)threshold
- Option to specify lambda when PGURE is not used (ignored when optimize=True)estimatenoise
- Turn automated noise estimation on (True
) or off (False
) (ifFalse
,alpha
,mu
andsigma
must be specified)alpha
- Option to specify detector gain (ignored whenestimatenoise=True
)mu
- Option to specify detector offset (ignored whenestimatenoise=True
)sigma
- Option to specify Gaussian noise component (ignored whenestimatenoise=True
)arpssize
- Size in pixels of ARPS motion estimation neighbourhoodtol
- PGURE optimization terminates after relative change is below tolerancemedian
- Size of median filter window in pixelshotpixelthreshold
-n
* median absolute deviation above the image median, wheren
is the user value. Any hot pixels are replaced by the median of their immediate neighbours.numthreads
- Number of threads to use on a multicore computer
PGURE-SVT can be integrated with the HyperSpy multi-dimensional data analysis toolbox, which provides a number of useful features including data visualization and data import from a number of microscopy file formats. An example Jupyter notebook is provided here.
The PGURE-SVT standalone executable uses a simple command-line interface along with a separate parameter file. It is convenient to use on remote computing clusters. The parameter file allows the user to customize various options of the PGURE-SVT algorithm. Note that the standalone executable currently only supports 8-bit and 16-bit TIFF sequences.
./PGURE-SVT param.svt
An example file, param.svt is provided.
##### Example parameter file for PGURE-SVT program #####
##### REQUIRED #####
# Specify the file name of the TIFF stack to be denoised
filename : ../test/examplesequence.tif
# The start and end frames of the sequence to be denoised
start_image : 1
end_image : 50
Copyright (C) 2015-2020 Tom Furnival.