Skip to content
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

bug: possibility of writing invalid headers yielding unreadable files #51

Open
alisterburt opened this issue Mar 3, 2023 · 7 comments

Comments

@alisterburt
Copy link
Contributor

Hey @colinpalmer - as per our discussion:

In juglab/cryoCARE_pip#43 we saw that files were being written, copying the original header but not the extended header. The length of the extended header is stored in the header and as such the start of the data is incorrectly specified in the files mrcfile writes.

Proposal: check and update the header entry containing the number of bytes of the extended header when writing a file to avoid this problem in the future

@cyanching
Copy link

We see the same issue in cryoCARE output files as well as mrc files we generated from these output files, @alisterburt do you maybe have more information on a workaround when reading such files with mrcfile? Thank you so much for your help!

@alisterburt
Copy link
Contributor Author

Hey @cyanching ! You could probably open the file with header_only=True and permissive=True then set the number of bytes in the extended header to 0 and save it - haven't tested this but it should work!

@cyanching
Copy link

Hey Alister! Thank you very much for your prompt and helpful reply as always! :) Sorry for the late reply, I somehow did not get a notification earlier. After updating mrcfile to 1.5.0 (released in Jan, 2024), it stopped complaining about header info generated by cryoCARE which was kept for cryoCARE outputs and mrc files we generated from them. I will definitely try your suggestion if we encounter more header issues!

@alisterburt
Copy link
Contributor Author

Thanks @cyanching
@colinpalmer did you push a fix for this? Should we close this issue?

@colinpalmer
Copy link
Member

No, I haven't made any changes to fix this issue yet. I'm guessing that maybe the thing that fixed it for @cyanching was using a version of cryocare that included your fix, rather than the mrcfile version change?

@alisterburt
Copy link
Contributor Author

That would make sense, forgot about that PR

@cyanching
Copy link

Thank you @colinpalmer for the link! Since @alisterburt contributed the header fix for cryoCARE in March, 2023. I indeed used a later version of cryoCARE but believed it was changes in mrcfile that solved this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants