Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (40 sloc) 1.88 KB
import requests, zipfile, io
from import imread
import napari
from deconv_gputools import Deconvolver_RL_gputools
from decon_volker_gpu import _prep_img_and_psf, fft_pad
import time
download_samples = False
url_bars = ""
url_microtubules = ""
url_droso = ""
for url in (url_droso, url_logo, url_microtubules):
print(f"Downloading {url}")
headers = headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
r = requests.get(url,stream=True, headers = headers)
z = zipfile.ZipFile(io.BytesIO(r.content))
examples = [{'vol':'./bars/bars-g10-p30.tif', 'psf':'./bars/psf.tif'},
{'vol':'./Drosophila/Drosophila.tif', 'psf':'./Drosophila/PSF BWz=100nm.tif'},
{'vol':'./microtubules-challenge/data.tif', 'psf':'./microtubules-challenge/psf.tif'}
def decon_example(ex, n_iter):
vol = imread(ex['vol'])
psf = imread(ex['psf'])
vol, psf = _prep_img_and_psf(vol, psf)
psf = fft_pad(psf, vol.shape, mode='constant')
print(psf.shape, vol.shape)
print(f"deconvolving {ex['vol']}")
start = time.time()
deconGPU = Deconvolver_RL_gputools(psf, n_iter=n_iter)
deconvolved =
end = time.time()
print(f"finished deconvolving. time: {end-start} s")
with napari.gui_qt():
viewer = napari.Viewer()
viewer.add_image(deconvolved, name="deconvolved")
viewer.add_image(vol, name='original')
decon_example(examples[0], 12)
decon_example(examples[1], 12)
decon_example(examples[2], 12)
You can’t perform that action at this time.