Registry / analytics / spatial-image

spatial-image

JSON →
library1.2.3pypypi✓ verified 88d ago

A multi-dimensional spatial image data structure for scientific Python, providing SpatialImage class with coordinate metadata. Current version 1.2.3. Released approximately monthly.

pip install spatial-image
INSTALL
IMPORT
SIG · SPATIAL-IMAGE
S
spatial-image
analyticspythonv1.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SpatialImage
✓ from spatial_image import SpatialImage
✗ from spatialimage import SpatialImage
Package name uses dash, not underscore
to_spatial_image
✓ from spatial_image import to_spatial_image
✗ from spatial_image import to_spatial
Function renamed in older versions

Create a spatial image from a numpy array and inspect its coordinates.

import numpy as np from spatial_image import SpatialImage, to_spatial_image # Create a simple 2D image array = np.random.rand(64, 64) spatial = to_spatial_image(array, dims=('y', 'x')) print(spatial) # Access coordinates print(spatial.coords) # xarray coordinates # Convert back to numpy output = np.array(spatial.data)
Debug
Known issues
breakingVersion 1.0 removed the `spatial_image.spatial_image` module and replaced it with `spatial_image.SpatialImage`. Code importing from the old path will fail.
fix
Use `from spatial_image import SpatialImage` instead of `from spatial_image.spatial_image import SpatialImage`.
affects: <1.0.0
gotchaThe `dims` parameter in `to_spatial_image` must match the number of axes. Passing incorrect dimension names (e.g., 'x' for a 3D array) will raise a ValueError.
fix
Ensure the length of `dims` tuple equals the number of array dimensions.
affects: >=0.1.0
deprecatedThe `SpatialImage.to_xarray()` method is deprecated in favor of `SpatialImage.to_xarray_dataarray()` (note the 'dataarray' suffix).
fix
Replace `spatial_image.to_xarray()` with `spatial_image.to_xarray_dataarray()`.
affects: >=1.2.0
Errors
Common errors & fixes
ImportError: cannot import name 'SpatialImage' from 'spatial_image.spatial_image'
Old import path from versions <1.0.0
fix
Use `from spatial_image import SpatialImage`
ValueError: dims length (2) does not match array dimensions (3)
Mismatch between number of dimension names and array axes
fix
Ensure `dims` tuple has the same length as the number of axes in the input array.
AttributeError: 'SpatialImage' object has no attribute 'to_xarray'
Using deprecated method in newer version
fix
Use `spatial_image.to_xarray_dataarray()` instead.
Upgrade
Version history
1.2.3latest on PyPI · released Aug 8, 2025
Audit
Dependencies
numpyrequiredArray operations
xarrayoptionalOptional integration for labeled arrays
Agent activity
27 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources

No resource links recorded.

spatial-image — pip install spatial-image · libregistry