I'm using SimpleITK to read MetaImage data.
Sometimes I need to access only the metadata (which is stored in a key=value .mhd file) but the only way I found to do it is to call ReadImage
which is pretty slow as it loads the whole array into memory.
import SimpleITK as sitk
mhd = sitk.ReadImage(filename)
origin = mhd.GetOrigin()
spacing = mhd.GetSpacing()
direction = mhd.GetDirection()
Is there a way to access origin spacing and direction without loading the full image?