BBQuercus/deepBlink

Calling deepblink from jupyter notebook

Closed this issue · 3 comments

Hi,
I started using deepblink recently and I'm very excited how well it performs on our data!
I was wondering whether there would be an easy way to run deepblink on images which are saved in a numpy array (in a jupyter notebook), instead of calling it from the command line on a directory of tiffs.

Currently I would write the tiffs from a numpy array into a new directory, call deepblink through the command line and then load the output csv files again into a numpy array. If the prediction could just be called directly on the numpy array this would save me all these steps.

Would this be feasible?

Thank you very much for your help!
Micha

Hi Micha,

Thanks for the feedback and I'm glad it's working. What you're describing is basically what the CLI is doing behind the scenes. I planned to release a set of jupyter notebooks as examples shortly. For now though, you can use the following snippet:

import deepblink as pink
import skimage.io

image = skimage.io.imread(image_path)
model = pink.io.load_model(model_path)
coords = pink.inference.predict(image, model)

Note that if you also want intensities you can use pink.inference.get_intensities(image, coords, radius, method).

Let me know if that solved your problem.
Bastian

Hi Bastian,

This is exactly what I needed, works flawlessly!
Thanks a lot again!

Best,
Micha

👍