-
Notifications
You must be signed in to change notification settings - Fork 8
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
"free(): invalid size" crash trying to call CziFile.read_mosaic() #70
Comments
Is there any chance you can share the file you are trying to read solely for the purpose of debugging? |
So I just did a few local sanity checks with a mosaic file I have. The output
suggests that The If that's the case then you are on the right track: If you would try: The other thing to try would be |
@heeler Thanks, that got me further. I believe you're correct about it running out of memory. However I ran into another issue. I changed it to:
The resulting image looks like a bunch of tiles overlaid on each other. I exported to tiff using bioformat's bfconvert and I can confirm that in the exported tiff it doesn't look like that. Any advice? |
So the code for stitching together the mosaic files is from Zeiss, specifically libCZI. My understanding is that Mosaic files can be acquired in various ways with gaps between the image acquisitions and imaging settings can be changed across the image. That may be what you're seeing but it's hard for me to know. You can use
|
@markemus Can you share the image file with me that is causing this or was this resolved? |
@heeler Unfortunately I can't share the file- it's proprietary data and we don't currently have a way to anonymize czis. The version I was using was 2.7.7. I haven't had a chance to test another file, but I will try to do so and report back- feel free to remind me. |
@markemus Thanks for letting me know. Details wise
I doubt upgrading to 2.8.0 will fix it but it might be worth trying. If you are able to create a file that you can share I would really appreciate it. If you don't have time to create a file if you could explain acquisition settings I can ask our microscopy team to attempt to reproduce it for me. Thanks |
Any updates on this? I have the same issues as reported above. |
Hey @rg314 can you answer the above questions:
It may be that your machine simply doesn't have enough memory to fit the whole mosaic in memory. |
And re above, we dont have any test data ourselves to work on the issue. We cant debug something we cant reproduce. Can you share your file somehow? |
Hey @JacksonMaxfield Pixel type:
Shape:
The following code works
In terms of memory I think things are fine as I can get the image into an np.array and manipulate given I use the
If I run:
Then I get the following error
Running the following code works fine.
When I try aicspylibczi/_aicspylibczi/Reader.cpp Line 438 in 96110fd
However, I have to calculate the pos from Let me know if this help. I will need to check with client if I can send over an example image. |
Thanks for all the info! Hmmm. I think it may be indexed by the overall stage position? But that is a good question. cc @toloudis any ideas? |
Cheers @JacksonMaxfield that was also my guess ;) |
I'm rusty on this but if I remember correctly it's the format that Zeiss's libczi takes. It could possibly translate into a more sensible system but I was hesitant to depart from what Zeiss used and in their system (-138240,16503) is the origin of the image. |
Having any image to repro with would help. I'm not sure what's going on with these coordinates or how a user would know what coordinates to use. I'm prepared to do a deep dive when we can repro. |
@toloudis, the documentation |
Okay, I'm going to get the client in on the thread. I’m sure we can get something sorted. |
Hey! I have a czi mosaic that shows the error and that I'm happy to share :)
|
Wow, I completely forgot about this issue, so sorry! As a backup for @r03ert0 I will try to find an image I can send you as well. Roberto, do not depend on me, clearly I am unreliable. Let's get these people some examples. |
Excellent thanks @r03ert0. We weren't able to get shareable data from our client. |
Hi @r03ert0 If you can share the file on Zenodo I'll have a look and see if I can figure out what's going wrong. |
here's the link: loading the whole image doesn't work, but loading subregions does: from matplotlib import pyplot as plt
from aicspylibczi import CziFile
from pathlib import Path
pth = Path("ferret-slices-mosaic-encoding.czi")
czi = CziFile(pth)
d = czi.get_dims_shape()
bbox = czi.get_mosaic_bounding_box()
plt.figure(figsize=(20,15))
for row in range(0, 5):
for col in range(0, 5):
x = bbox.x + int(col*bbox.w/5)
y = bbox.y + int(row*bbox.h/5)
w = int(bbox.w/5)-1000 # -1000 just to make sure the region is well inside...
h = int(bbox.h/5)-1000 # ... it doesn't really work, because the last tile throws an error anyway
img = czi.read_mosaic(
C=0,
scale_factor=1/8,
region=(x, y, w, h)
)
plt.subplot(5, 5, row*5 + col + 1)
plt.imshow(img[0,:,:,:]) The result is this (the last tile throws an error): What I would like to do is to convert the image to bigtiff, or to deepzoom (dzi) format. thank you for your help! |
I'm trying to read a mosaic czi file but it crashes consistently when I call img.read_mosaic(). img.read_image() works, but returns a stack of (overlapping?) mosaic tiles so I would prefer to get read_mosaic working.
results:
I tried specifying S=0, but the program told me that S is not used for mosaic images.
I tried again reading only a subregion:
This looks like an integer overflow problem? I searched previous issues but couldn't find anyone who had this before. Is there a bug or am I doing something incorrect?
The text was updated successfully, but these errors were encountered: