spatial_image
A multi-dimensional spatial image data structure for scientific Python.
What it is and what it does
spatial-image wraps xarray.DataArray to create a standardized data structure for scientific images that are typically multi-dimensional and anisotropic. It enforces a consistent schema: dimensions from the set {c, x, y, z, t}, uniform spacing per axis, and spatial metadata (origin, units, axis names) stored as coordinates and attributes. This allows pixel values and their spatial context to move together through processing pipelines without manual bookkeeping.
The package is designed for workflows involving registration, resampling, multi-scale analysis, and coupling with meshes or annotations. It integrates with the broader scientific Python ecosystem through numpy, xarray, and related tools, so that standard slicing operations preserve both data and metadata correctly.
Use it for:
- Medical imaging: carry voxel spacing and anatomical axis labels through registration and resampling workflows.
- Multi-scale image analysis: track origin and spacing metadata as images are processed at different resolutions.
- Subregion parallel processing: slice spatial images with xarray and maintain valid coordinates for each chunk.
- Image-to-mesh coupling: preserve spatial coordinates when linking pixel data to mesh or point-cloud annotations.
- Distributed image processing: pass spatial images to Dask-based pipelines without losing spatial metadata.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
spatial-image provides an N-dimensional spatial image data structure built on xarray that carries pixel values alongside spatial metadata—origin, spacing, and dimension labels—through image processing pipelines.
Yes, if you work with multi-dimensional scientific images and need spatial metadata (origin, spacing, axis labels) to persist through processing pipelines. The low install friction and permissive license make adoption straightforward. However, the aging maintenance status (371 days since last release) means you should accept slower bug fixes and check that the package's current dependencies remain compatible with your environment before committing to it for new projects.
Install
spatial-image on PyPI
pip
pip install spatial-imageuv
uv add spatial-imagepoetry
poetry add spatial-imageInstalling spatial_image
Before you install
Low install friction; pure Python wheel. Maintenance status is aging—last release 371 days ago—so expect slower bug fixes and feature updates, though the package remains functional for current Python versions.
License in practice
MIT license (permissive); you may use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install spatial-image
import numpy as np
from spatial_image import to_spatial_image
array = np.random.rand(10, 10, 10)
img = to_spatial_image(array)
Requires Python 3.10 or later.
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode given the 371-day gap since last release.
- Performance characteristics when working with very large multi-dimensional arrays or distributed computing via Dask.
- Compatibility with specific downstream libraries beyond what the description claims.
Package facts
| License | The MIT License (MIT) Copyright (c) 2020 NumFOCUS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — numpy, xarray-dataclass, xarray |
| Maintenance | aging — 371 days since the last release |
| First released | |
| Downloads | 93,920/month — #13,358 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: spatial_image-1.2.3-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
multiscale-spatial-imageGenerates multiscale image pyramids organized…
permissive · top 15,000 on PyPI
xarrayxarray adds dimension, coordinate, and…
permissive · top 5,000 on PyPI
xarray-dataclassDefines typed xarray DataArray and Dataset…
permissive · top 15,000 on PyPI
rtreeRtree wraps libspatialindex to provide spatial…
permissive · top 5,000 on PyPI
odc-loaderConstructs xarray objects from parsed…
permissive · top 15,000 on PyPI
pint-xarrayAdds physical units support to xarray datasets…
permissive · top 15,000 on PyPI
cf-xarraycf-xarray adds a `.cf` accessor to xarray…
permissive · top 15,000 on PyPI
xeeXee is an Xarray backend that lets you open…
permissive · top 15,000 on PyPI
edtComputes Euclidean distance transforms for 1D,…
copyleft · top 15,000 on PyPI
ndcubendcube manipulates, inspects, and visualizes…
unclear · top 15,000 on PyPI