//Note these macros are old and may require updating for the new version of DeconvolutionLab macro Deconvolve { setBatchMode(true); input = getTitle(); psf = "PSF BW"; Dialog.create("Deconvolution"); Dialog.addMessage("The Richardson-Lucy algorithm will be used.\nPlease enter the following information:"); listImages = getList("image.titles"); if (listImages.length==1) exit ("Need both Input and PSF Images open!"); Dialog.addChoice("Input image: ",listImages,input); Dialog.addChoice("PSF: ",listImages,psf); Dialog.addNumber("Iterations: ",20); Dialog.show(); input=Dialog.getChoice(); psf=Dialog.getChoice(); iterations = Dialog.getNumber(); selectWindow(input); getPixelSize(unit,pX,pY,pZ); Zsize = nSlices; output = replace(input,".tif","") + " Deconvolved.tif"; tempOutput = "DeconvolvedTemp$" + random(); selectWindow(input); run("DeconvolutionLab ", " namealgo='Richardson-Lucy with TV regularization' lambda=0.01" + " namepsf='"+psf+"' normalizepsf=true recenterpsf=true" + " k=" + iterations + " nameoutput=" + tempOutput); while (isOpen(tempOutput)==0); //Waits until Deconvolution is done wait(1000); selectWindow(tempOutput); rename(output); selectWindow(output); run("Properties...", "channels=1 slices=" + Zsize + " frames=1 unit=micron pixel_width=" + pX + " pixel_height=" + pY + " voxel_depth=" + pZ); run("8-bit"); run("Median 3D...", "x=2 y=2 z=2"); print("Deconvolution Done!\n"); setBatchMode(false); }