maweigert / spimagine

GPU accelerated volume rendering / processing in Python
BSD 3-Clause "New" or "Revised" License
117 stars 17 forks source link

Can this tool work with an NVIDA GPU? #32

Closed WeisongZhao closed 5 years ago

WeisongZhao commented 5 years ago

Can this tool work with an NVIDA GPU? Because I have no AMD GPU. By the way, the video (i.e. 2) of this paper 'Content-aware image restoration: pushing the limits of fluorescence microscopy' is really amazing! Could you tell me how you made these awesome videos?

maweigert commented 5 years ago

Hi Weison,

Sure, it works on Nvidia GPUs too! (In fact, most of my machines have only a Nvidia GPU). You have to make sure that OpenCL is working, though, see https://github.com/maweigert/spimagine#verify-the-availability-of-opencl-1

And glad you like the video! The one you mention uses the OverlayData class that comes with spimagine, which creates overlay stacks from two given 3D volumes. A simple example demonstrating this is the following:

import numpy as np
from spimagine import volshow
from spimagine import OverlayData

# create two example stacks - a sphere in the middle and a noisy version 
N = 256
Xs = np.mgrid[:N,N//4:3*N//4,:N]-N/2
R = np.sqrt(np.sum(Xs**2, axis= 0))
img_clean = 100.*((np.exp(-20*R**2/N**2))+(R<N/4))
img_noisy = .8*img_clean + 40*np.random.normal(0,1,img_clean.shape)

# display it as an overlay (i.e. slipping through time changes the overlap) 
volshow(OverlayData(img_noisy, img_clean))

which should result in this:

output Hope this helps!

Martin

maweigert commented 5 years ago

Btw, I just created a new version for pypi, so you need to reinstall the latest version (0.2.6) for the example above.

WeisongZhao commented 5 years ago

Many thanks for your reply, it helps a lot! I will have a try for my Titan Xp. I didn't know the OpenCL supports the NVIDIA GPUs before😀.

maweigert commented 5 years ago

Sure, OpenCL support should be included via the normal Nvidia drivers https://developer.nvidia.com/opencl Best is to check with clinfo (which you might have to install first). Let me know if something doesn't work!

WeisongZhao commented 5 years ago

Many thanks.