rosalindfranklininstitute / RedLionfish

Apache License 2.0
29 stars 4 forks source link

Resulting image range from 0 to 255 #6

Closed haesleinhuepf closed 2 years ago

haesleinhuepf commented 2 years ago

Hi @perdigao1 ,

first of all thank you very much for programming this amazing napari plugin! It's fantastic to see OpenCL-based GPU-accelerated image deconvolution in napari.

I have a question about how to use it properly. While playing with the API from within a notebook, I noticed that the result image always is within the range [0 ... 255]. I'm using this code:

rl.doRLDeconvolutionFromNpArrays(image, 
                                 psf, 
                                 niter=iterations, 
                                 method='gpu', 
                                 resAsUint8=False )

copied from here. But independent from passing True or False, the result appears always in uint8 range.

I'm wondering is this a bug or am I using it the wrong way?

You can reproduce my whole experiment in this notebook: https://github.com/haesleinhuepf/BioImageAnalysisNotebooks/blob/main/docs/18a_deconvolution/richardson_lucy_deconvolution.ipynb

Any hint is appreciated! Thanks in advance.

Best, Robert

perdigao1 commented 2 years ago

Hi Robert,

Thank you for your interest. Actually this is a known issue that I have fixed it in upcoming version 0.6.

This uint8 problem only happens if you use the CPU version and not the OpenCL. By default, if you try to use the gpu version and it fails for some reason, it will fallback to CPU (scipy fft's for convolutions).

It was updated in the LMAP branch. https://github.com/rosalindfranklininstitute/RedLionfish/commit/1e8c28af2c8dcc5bcc15966e7b5fdeff46442012

I will update main, and all other pip and conda packages soon.

haesleinhuepf commented 2 years ago

Awesome, thanks for the instant feedback! 😃

haesleinhuepf commented 2 years ago

Hi @perdigao1 ,

just to let you know, my problem is gone in version 0.6. Thanks for fixing this! :-)

Robert