clij / clij2-fft

21 stars 6 forks source link

Out of bounds exception #31

Open NicoKiaru opened 6 months ago

NicoKiaru commented 6 months ago

Hello!

I'm getting out of bounds exception:

Deconvolve cell SingleCellArrayImg [(512, 256, 256) -- (767, 449, 319) = 256x194x64]
min/max source 0.0 1025.0
min/max cell 512 767
min/max source 0.0 449.0
min/max cell 256 449
min/max source 0.0 600.0
min/max cell 256 319
java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 461700

It looks like in y the cell goes to 449, and maybe it should stop at 448 ?

I can solve this by adding a Views.extendZero, but that should be avoidable.

NicoKiaru commented 6 months ago

Sorry for being not so informative, I'm being a bit in a rush

bnorthan commented 6 months ago

Hi @NicoKiaru

I'll have to sleuth more this week. So this is a 1025 by 449 by 600 image? I can make a phantom on my side of that size and try it.

I hope I'm not forgetting something I did, but I think the cell dimensions are calculated in the CellCachedImg.

Clij2RichardsonLucyImgLib2Cache implements an accept function which receives the cell dimensions. I had thought the cell dimensions were guaranteed to be in bounds, but maybe I need to add a check. (I do check if the cell is at the boundary, and if so don't add overlap).

NicoKiaru commented 6 months ago

Well yeah, this is weird, maybe the issue is on my side.

The overlap is [10 10 10], the block is [256 256 64],

PSF: 45x68x128

image

Image: 1026450601

image

NicoKiaru commented 6 months ago

(And no rush: I have a fix with Views.extendZero for the moment)

bnorthan commented 5 months ago

Hi @NicoKiaru

I tried to create a test image of the same size to replicate the error. You can find the test image and psf here

I setup the interactive test with the new image set. See here

It seemed to run OK, but I am sure I am just missing something as to how to replicate the error. Let me know if you have any suggestions.

As an aside I recently had to change the call to Lazy.generate slightly to be compatible with the latest version of Fiji and imglib2cache. See here. Let me know if you see any issues with that.

bnorthan commented 5 months ago

Also python notebook to create test image of the right size can be found here.

You would need to pip install tnia-python to run it.

NicoKiaru commented 5 months ago

Thanks!

FYI I've uploaded the dataset in here: https://zenodo.org/records/11396388

There's an example czi file and the file psf-200nm.tif can be used to deconvolve it directly in the skewed space (psf and dataset are skewed). I'll try to see if I can replicate - maybe in a few weeks... it could really be that the issue is on my side, with a specific reader I use