AllenCellModeling/aicspylibczi

MemoryError: std::bad_alloc for read_mosaic in versions > 2.6.0

djdt opened this issue · 8 comments

djdt commented

The read_mosaic function throws a 'MemoryError: std::bad_alloc' when called. This can be fixed by reverting to version 2.6.0.

I think I have traced this back to a bug in libCZI but I think I have a workaround. I hope to have a fix out for you tomorrow.

2.7.3 should be on pypi now. If you wouldn't mind giving that a try I'd really appreciate it.
There is a subtle bug in libCZI but I haven't been able to rule out that it might be in my code that causes, a skew in the image for certain scale factors. I'll work on this but it will be a different PR. The segfault you were encountering should be addressed by 2.7.3. Thanks for reporting this. Cheers!

PS: if you could comment here if it worked for your purposes that would be great.

djdt commented

It no longer segfaults but the image is corrupted in some way. The top image is 2.7.3 and the bottom with version 2.6.0.

image
image

That's the skew I mentioned. I'll work on that today. It seemed only to happen for certain scalefactors. IE: 1.0, 0.1, 0.2 might all work fine but 0.3, .... could be skewed. Thanks for the feedback I'll post here again when I have a fix together.

Hi @djdt, So I think this is now working. There's a new aicspylibczi 2.7.5 which works for all scalefactor <= 1.0 at least with the files I was able to test against. If you would please give the new version a try and let me know if it's performing satisfactorily for you. I really appreciate your posts! Thanks!

djdt commented

Hey, it works great now and is much faster than before! Thanks for all the work on this!

Great work @heeler!

Thanks @djdt! Thanks @JacksonMaxfield! Much appreciated.