DeconvolutionLab

How to call DeconvolutionLab from a Javascript script or an ImageJ macro?

We provide below a JavaScript script that illustrates how to run DeconvolutionLab in headless mode. To use the script, download it to your computer and drag-and-drop it onto the ImageJ window.

Depending on the algorithm you want to use, you will need to set a certain number of parameters. We refer to the table below for the full list of parameters.

Example

The script can be downloaded here.
// ***************************************************************************
// DeconvolutionLab
//
// Example of a call from a Javascript macro
// Regularized inverse filter with various epsilon
// ***************************************************************************

IJ.open("/Users/sage/Desktop/Test/input.tif");
IJ.open("/Users/sage/Desktop/Test/psf.tif");

var epsilon =-5;
do {
	IJ.selectWindow("input.tif");
	var chrono = System.currentTimeMillis();
	IJ.run("DeconvolutionLab ", 
		" namealgo='Inverse filtering' epsilon=10e" + epsilon +
		" namepsf='psf.tif' normalizepsf=true recenterpsf=true" +
		" usefftw=false logpriority=1 nameoutput='output'"
	);
	while ((imp=WindowManager.getImage('output')) == null);
	imp.setTitle("output/" + epsilon);
	IJ.log( "Deconvolution Time: " + ((System.currentTimeMillis() - chrono)/1000) + " s." ) ;
	epsilon += 1;	

} while(epsilon < -1);

List of the parameters

Biomedical Imaging Group
Parameter Type Description Default value Range
Common Parameters
usemacro Boolean useMacro true
namealgo String Name of the algorithm Should be provided
namepsf String Name of ImageJ window for the PSF Should be provided
normalizepsf Boolean Normalize PSF true
recenterpsf Boolean Flip PSF quadrants (activate if PSF is centered) true
monitorperf Boolean Computation of the Signal-to-Error ratio false
nameref String Ground-truth image
folderperfmon String Folder for performance monitoring
useseed Boolean useSeed false
seed Float seed 0
background Float Background value 0
subtractbackground Boolean Subtract Background false
estimatebackground Boolean estimateBackground true
savevideo Boolean Save the video monitoring false
foldervideo String Folder to save the video monitoring
cropselection Boolean Test on a cropped selection false
usewindowing Boolean Usage of the windowing false
addborders Boolean Add borders for windowing false
percentwindowing Float Percent of the windowing 0
percentborder Float Percent of the border window 0
windowingfunction Integer Windowing function 0 ZEROPADDING=0, HANN=1
processmultifile Boolean Process in batch mode false
folderbatchinput String Folder for the batch input
folderbatchoutput String Folder for the batch output
usefftw Boolean Use FFTW false
logprioritylevel Integer Level of log messages 0 MUTE, SILENT, NORMAL, VERBOSE
nameoutput String Name of the output
Convolution
addpoissonnoise Boolean Add Poisson noise false
addgaussiannoise Boolean Add Gaussian noise false
addbackground Boolean Add background noise false
gamma Float Gain of the Poisson noise 1 0 ... 65535
sigma Float Standard deviation of the Gaussian noise 1 0 ... 10000
mu Float Value of the background 0 0 ... 1e6
Inverse Filtering
epsilon Float Threshold 1e-6 0 ... 1e6
Regularized Inverse Filtering
regparamest Boolean Automatic adjustment of the regularization parameter true
lambda Float Regularization parameter 1 0 ... 1e6
noiseparamest Boolean Automatic estimation of the noise parameters true
gamma Float Gain of the Poisson noise 1 1e-6 ... 1e6
sigma Float Standard deviation of the Gaussian noise 1 0 ... 1e6
Landweber
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations (maximum) 10 1 ... 1e6
tau Float Step size 1 0 ... 1e6
autostepsize Boolean Automatic step size true
onego Boolean Fixed number of iterations false
posconstraint Boolean Positivity constraint false
stopcrit Integer Early-stopping criterion 0 FIXEDNUMITER=0, RESIDUAL=1, UPDATE=2
sigma Float Standard deviation of noise 1 0 ... 1e3
estimatesigma Boolean Estimated standard deviation of noise false
tolerance Float Tolerance 0 ... 1
Thresholded Landweber
lambda Float Regularization parameter 1 0f ... 1e6
wavfamily Integer Wavelet family 0 HAAR=0, DAUBECHIES2=1, DAUBECHIES4=2, DAUBECHIES6=3, FRACT_SPLINE=4
j Integer Number of decomposition levels 3 1 ... 10
threshtype Integer Thresholding method 0 SOFT=0, HARD=1
randomshifts Boolean Usage of the random shifts method true
stopcrit Integer Early-stopping criterion 0 FIXEDNUMITER=0, RESIDUAL=1, UPDATE=2
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations (maximum) 10 1 ... 1e6
tau Float Step size 1 0 ... 1e6
autostepsize Boolean Automatic step size true
sigma Float Standard deviation of noise 0 ... 1e3
estimateSigma Boolean Estimated standard deviation of noise false
tolerance Float Tolerance 1e-3 0 ... 1
FISTA
lambda Float Regularization parameter 1 0 ... 1e6
wavfamily Integer Wavelet family 0 HAAR=0, DAUBECHIES2=1, DAUBECHIES4=2, DAUBECHIES6=3, FRACT_SPLINE=4
J Integer Number of decomposition levels 3 1 ... 10
threshtype Integer Thresholding method 0 SOFT=0, HARD=1
randomshifts Boolean Usage of the random shifts method true
stopcrit Integer Early-stopping criterion 0 FIXEDNUMITER=0, RESIDUAL=1, UPDATE=2
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations (maximum) 10 1 ... 1e6
tau Float Step size 1 0 ... 1e6
autostepsize Boolean Automatic step size true
sigma Float Standard deviation of noise 1 0 ... 1e3
estimatesigma Boolean Estimated standard deviation of noise false
tolerance Float Tolerance 1e-3 0 ... 1
Tikhonov Miller
lambda Float Regularization parameter 1 0 ...1e6
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations (maximum) 10 1 ... 1e6
tau Float Step size 1 0 ... 1e6
autostepsize Boolean Automatic step size true
onego Boolean Fixed number of iterations false
posconstraint Boolean Positivity constraint true
stopcrit Integer Early-stopping criterion 0 FIXEDNUMITER=0, RESIDUAL=1, UPDATE=2
sigma Float Standard deviation of noise 1 0 ... 1e3
estimatesigma Boolean Estimated standard deviation of noise false
tolerance Float Tolerance 1e-3 0 ... 1
Richardson Lucy
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations (maximum) 10 1 ... 1e6
Richardson Lucy TV
lambda Float Regularization parameter 1 0 ... 1e6
initialest String Initial estimate
useinputimg Boolean Use input image true
k Integer Number of iterations 10 1 ... 1e6
posconstraint Boolean Positivity constraint true

© 2016 EPFL • webmaster.big@epfl.ch • 06.09.2016