Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimenting with xarray / Array API compatibility #3

Open
effigies opened this issue Sep 7, 2024 · 1 comment
Open

Experimenting with xarray / Array API compatibility #3

effigies opened this issue Sep 7, 2024 · 1 comment

Comments

@effigies
Copy link

effigies commented Sep 7, 2024

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.

@TomNicholas
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants