SegSpy
Headless, backend-pluggable EM image segmentation library for HyperSpy.
SegSpy turns a HyperSpy Signal2D into a list of particle objects. It is
microscope-generic (TEM/SEM) and particle-type-agnostic, shipping multiple
interchangeable segmentation backends behind a uniform registry:
traditional_cv— CLAHE → black-hat → threshold → morphology → GrabCut refinementsam— Meta SAM Auto-Mask Generator with a 5-stage post-filter
Installation
pip install SegSpy
For the SAM backend, install the optional extra:
pip install "SegSpy[sam]" # adds segment-anything + torch
For development:
git clone https://github.com/VANvonZHANG/SegSpy.git
cd SegSpy
pip install -e ".[dev]"
pre-commit install
Quick start
import hyperspy.api as hs
from SegSpy import SegConfig, SegmentationRegistry, measure_morphology
signal = hs.load("image.dm4")
backend = SegmentationRegistry.get("traditional_cv")
mask = backend.segment(signal, SegConfig())
objects = backend.extract_objects(signal, mask, SegConfig())
for obj in objects:
measure_morphology(obj, scale_nm=1.0)
CLI
SegSpy run image.dm4 --backend traditional_cv --output ./out
Writes <stem>_particles.csv (per-particle morphology metrics) and
<stem>_labeled.png (a labelled mask) to the output directory.
Status
v0.1 — pure library + CLI, no GUI (deferred to a later release). See the CHANGELOG for details. Contributions welcome — see CONTRIBUTING.md.
Metadata
Release files for SegSpy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| segspy-0.1.0.tar.gz | 23.1 kB | Without provenance | Details for segspy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| segspy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for segspy-0.1.0-py3-none-any.whl |
Total release size: 41.5 kB
Release files / segspy-0.1.0.tar.gz
| Download URL | segspy-0.1.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cfacdc25415ff1a3585fc75dbb1114ffd7693058dc797607041f50d47fb3b60
|
|
BLAKE2b-256 checksum How to use checksums |
b0d0f0170862187d7f6a9eac9461ff44b0b12b564a89f41de9faf1ff82b539ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / segspy-0.1.0-py3-none-any.whl
| Download URL | segspy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bb46816e2317e87e1d03d651f9314396c3918bc598a1a02b72cc02bdebc9dd0
|
|
BLAKE2b-256 checksum How to use checksums |
d4cd94905d8fd94812297a481b0d8764c8cb08bbb16e22bcbbe0587b76665df4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for SegSpy 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.