skillfed

spatial_image

A multi-dimensional spatial image data structure for scientific Python.

spatial-image v1.2.3 93.9K downloads/30d#13,358 on PyPI
Permissive 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) AGING released

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-image

uv

uv add spatial-image

poetry

poetry add spatial-image

Installing 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

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

spatial image data structuremulti-dimensional image metadataxarray-based image processinganisotropic image samplinglabeled array image datascientific image coordinatesimage registration and resampling
image-processingscientific-computingxarray-ecosystem

More Scientific/Engineering packages