I want to read only the header from a .mha
file. Ideally it would give me the same as if reading .mhd
file with metadata only.
I am using SimpleITK for reading and while it reads the image fine, I specifically want to create a metadata dictionary.
.mha
is basically .mhd
with the raw image combined but I can't find any specification as to how to separate them. I found in ITK docs here:
To skip the header bytes in the image data file, use
HeaderSize = X
where X is the number of bytes to skip at the beginning of the file before reading image data. If you know there are no trailing bytes (extra bytes at the end of the file) you can specify
HeaderSize = -1
and MetaImage will automatically calculate the number of extract bytes in the data file, assume they those bytes are at the head of the data file, and automatically skip them before beginning to read the image data.
but I can't find this functionality in SimpleITK.