-
Notifications
You must be signed in to change notification settings - Fork 26
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
Command Line Deconvolution Troubleshooting #23
Comments
Hi @naureeng , to your points:
from flowdec import data as fd_data
from flowdec import restoration as fd_restoration
img, psf = # ... however you'd like to load the image arrays, perhaps skimage.io.imread
assert img.ndim == 3 # should be (2048 x 2048 x 54)
assert psf.ndim == 3 # should be (100 x 100 x 100)
algo = fd_restoration.RichardsonLucyDeconvolver(3, pad_mode='none').initialize()
res = algo.run(fd_data.Acquisition(img, psf), niter=25).data # Run deconvolution
files = glob.glob('/some/path/*.tif')
img = np.stack([ skimage.io.imread(f) for f in files ]) If you have multi-channel images, then the # Assuming img and psf have shape (x, y, z, channels):
res = np.stack([
algo.run(fd_data.Acquisition(img[..., i], psf[..., i])).data
for i in range(img.shape[-1])
]) Hope that helps, but I don't imagine anything in fd_data would be very helpful for loading images since they're probably just following the patterns in one of those examples above. |
Awesome, thank you so much for your quick reply @eczech! I really appreciate it. I got your code snippet working but I get this error for padding: tensorflow.python.framework.errors_impl.InvalidArgumentError: Paddings must be non-negative: -37 -37 Any ideas? |
Could you post the code you used (one of my snippets has pad_mode='none' and I'm not sure which you're talking about) and the results of |
Ah right, the image extent has to be greater than or equal to the psf extent in all dimensions. There's supposed to be a better error for that (will get fixed in #24). In other words, it's ok to use a PSF that's a lot smaller than the image but not the other way around. I'd suggest padding the image with zeros out to 100 z slices or better yet, cropping the PSF or regenerating it with different dimensions if it was theoretical, assuming that 27 z-planes is still enough to fit the PSF. |
Awesome 👍 I got memory errors when I used a smaller PSF with less z-slices and solved the issue by making a PSF image scaled to be identical to the target image (2048 x 2048). |
I have a flowdec virtual environment set up on our Cluster and look forward to using it! I am having trouble setting up deconvolution with the command line:
(1) I have multi-channel images similar to the C. elegans example. My file is:
2048 x 2048 x 54 (2 color channels with 27 slices each)
I get:
File "/nfs/nhome/live/naureeng/.conda/envs/flowdec/lib/python3.7/site-packages/flowdec/data.py", line 24, in init
raise ValueError('Number of data and kernel dimensions must be 1, 2, or 3')
ValueError: Number of data and kernel dimensions must be 1, 2, or 3
The PSF file I have was done with a bead and is:
100 x 100 x 100
(2) Can we use the fd_data function to load our own datasets?
Thanks!
The text was updated successfully, but these errors were encountered: