NiBabel was written in the times of Python 2.4 or 2.5 and the world has changed. Nowadays we would probably write our images as a dataclass:
@dataclass
class Neuroimage:
data: npt.ArrayLike
affine: np.ndarray
header: Mapping[str, np.ndarray]
A data array tagged with metadata and spatial axis information is the basic idea of xarray. I plan to spend some time experimenting with how much logic we can push back into xarray and how much we can remain agnostic to the kind of array we wrap. We have some initial work in https://github.com/matthew-brett/xibabel.
I expect others have similar problems and this could be a collaborative affair.
Xarray dev here - anyone else who has questions about using xarray with your package (or anything to do with named/dimensional arrays) please reach out!
NiBabel was written in the times of Python 2.4 or 2.5 and the world has changed. Nowadays we would probably write our images as a dataclass:
A data array tagged with metadata and spatial axis information is the basic idea of xarray. I plan to spend some time experimenting with how much logic we can push back into xarray and how much we can remain agnostic to the kind of array we wrap. We have some initial work in https://github.com/matthew-brett/xibabel.
I expect others have similar problems and this could be a collaborative affair.