I agree, Metaimage is not the best format. However, it is used a lot at our institute and we have TB of data in that format… It has simply developed over time. But fortunately, our data is in 99.5% CT volume data, which makes things a bit easier
I wont use the data file name for reading purposes but only for managing files. That is the reason why I want it in addition to the
right now, I have this piece of code:
img = sitk.ReadImage(path)
_, ext = os.path.splitext(path)
if ext in ['.mhd', ]:
with open(path, 'r') as fp:
for line in fp.read().splitlines():
os.path.join(os.path.dirname(path), line.split('=', 1).strip()))
Which is a bit ugly but works for my purposes.
With this I can for example get the size on disk of the file:
But to avoid the XY problem, maybe I should have asked in the first place: Is there a way in SITK to retrieve the size on disk for metaimage files?