Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Damping feature request #17

Open
k1moradi opened this issue Oct 8, 2021 · 0 comments
Open

Damping feature request #17

k1moradi opened this issue Oct 8, 2021 · 0 comments

Comments

@k1moradi
Copy link

k1moradi commented Oct 8, 2021

Hi,

I am testing using this amazing software for the deconvolution of light-sheet microscope images. Recently, a paper is published in this regard. I managed to port the PSF generation part from Matlab to python. However, porting the deconvolution method to python will be very GPU inefficient if it is done on the python side and using CPU. (Since the image stack should be moved to GPU memory and back to CPU memory several times).

The deconvolution function has a damping component to allow the deconvolution of low-resolution images.

function deconvolved = deconGPU(stack, psf, niter, damping)     
    deconvolved = stack;        
    psf_inv = psf(end:-1:1, end:-1:1, end:-1:1); % spatially reversed psf 
    
    R = 1/26 * ones(3, 3, 3, 'single'); 
    R(2,2,2) = single(0);
  
    for i = 1 : niter 
        denom = convGPU(deconvolved, psf);
        denom(denom < eps('single')) = eps('single'); % protect against division by zero
        
        if damping == 0                       
            deconvolved_new = convGPU(stack ./ denom, psf_inv) .* deconvolved;
        else           
            deconvolved_new = (1 - damping) .* convGPU(stack ./ denom, psf_inv) .* deconvolved ...
                + damping .* convn(deconvolved, R, 'same');
        end
end

The damping parameter is a ratio between 0 and 1. I was wondering will you be able to implement this with Cuda directly and make it available in both cudaDecon and pycudaDecon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant