ccpem/mrcfile

Issue reading files with an FEI2 extended header including unused space

dagewa opened this issue · 0 comments

According to the FEI extended header specification, the extended header may have unused space after the NZ sequential metadata blocks. I have come across a file like this that was apparently produced by Velox, where it looks like this space is used as padding to bring the total size of the extended header, NSYMBT, up to the nearest multiple of 512 bytes.

At the moment, such files cannot be read by mrcfile, because an attempt is made to coerce the full NSYMBT-long bytearray into an array of elements with data type of each metadata block:

self._extended_header.dtype = dtype

The specification document states:

Image reading and processing software can use the Metadata Size value from the first Metadata Block to index the blocks for the other frames in the MRC file.

I'm happy to try to (eventually!) put in a PR to add that behaviour, noting this warning, as discussed by email:

We might need a new attribute or method to get the indexed part of the extended header, since elsewhere we assume that header + extended header + data = file size, and we wouldn’t want to leave part of the file un-allocated.