You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is often confusion about the meaning of img.header.get_data_dtype() even from regular users of nibabel. I would propose having an explicit concept of raw (on-disk) and effective dtypes (provisionally, rdtype and edtype).
classDataobjHeader:
@propertydefrdtype(self):
"""Raw type of data object, as stored on disk"""@rdtype.setterdefrdtype(self, dt):
"""Set the type that data should be coerced to when saved to disk"""@propertydefedtype(self):
"""Effective type of data object, when scaled"""@edtype.setterdefedtype(self, dt):
"""Set the type that data should be coerced to when read into a numpy array"""
This would allow for checks like:
ifnp.issubdtype(img.header.edtype, np.integral):
# Probably a label or mask fileelse:
# Probably not intended to be discrete
Currently the easiest way to find out the effective dtype is img.dataobj[0, 0, 0].dtype.
The text was updated successfully, but these errors were encountered:
There is often confusion about the meaning of
img.header.get_data_dtype()
even from regular users of nibabel. I would propose having an explicit concept of raw (on-disk) and effective dtypes (provisionally, rdtype and edtype).This would allow for checks like:
Currently the easiest way to find out the effective dtype is
img.dataobj[0, 0, 0].dtype
.The text was updated successfully, but these errors were encountered: