def to_image_meta_data(img):
if pimms.is_map(img): return img<EOL>try: hdr = img.header<EOL>except Exception: hdr = img<EOL>intype = to_image_type(hdr)<EOL>return intype.meta_data(hdr)<EOL>
to_image_meta_data(img) yields a dictionary of meta-data for the given nibabel image object img.
to_image_meta_data(hdr) yields the equivalent meta-data for the given nibabel image header.

Note that obj may also be a mapping object, in which case it is returned verbatim.