connected-components-3d
Connected components on discrete and continuous multilabel 3D and 2D images. Handles 26, 18, and 6 connected variants; periodic boundaries (4, 8, & 6).
Decision gist · record as of 2026-08-14
Yes, if you work with 2D/3D image segmentation or multilabel volumetric data. The single-pass multilabel algorithm offers genuine performance and convenience advantages over masking-based approaches. The copyleft license (LGPL-3.0-or-later) requires careful review if you plan proprietary distribution. Install friction is moderate due to C++ compilation, but prebuilt wheels cover most platforms. No known security vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires C++ compiler if prebuilt wheels unavailable for your platform; occasional numpy binary incompatibility may require source compilation or numpy upgrade.
- Medium install friction due to compiled C++ extension, but prebuilt wheels are available for Python 3.10–3.13 across macOS, Windows, and Linux.
- Requires numpy.
License · maintenance · safety
LGPL-3.0-or-later (copyleft) — Licensed under LGPL-3.0-or-later (copyleft). Derivative works and modifications must be released under compatible terms; proprietary use requires careful licensing review or source code disclosure.
last release 2026-06-05 (70 days) · last repo commit 2026-08-06 · 457 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 219,951 downloads/mo, #9,317 on PyPI
Alternatives
Verify before relying
pip install connected-components-3d
import connected_components_3d
import numpy as np
labels_in = np.ones((512, 512, 512), dtype=np.int32)
labels_out = connected_components_3d.connected_components(labels_in)- Performance improvement magnitude over scipy on multilabel images (description claims 'one or more orders of magnitude' but provides no quantified benchmark data).
- Memory efficiency gains for very large volumes (description mentions memmap and stack processing but no concrete memory savings are documented).
- Whether binary image optimizations mentioned as 'not implemented yet' have been added in version 4.0.0.
What it is and what it does
connected-components-3d is a fast connected-components labeling library for 2D and 3D images that handles multilabel, binary, and continuous-valued data in a single pass. Unlike typical implementations that require masking and relabeling each label separately, this package labels all connected components simultaneously, making it particularly suited for densely labeled biomedical images where hundreds to thousands of labels may be present. It uses a 3D variant of the two-pass Rosenfeld-Pflatz method augmented with Union-Find and decision trees, supporting 26, 18, or 6-connected neighborhoods in 3D and 4 or 8-connected in 2D.
The package depends only on numpy and provides functions for component extraction, centroid and bounding-box calculation, small-object removal, contact-surface-area computation, and per-voxel connectivity graphs. It handles edge cases like periodic boundaries, memory-mapped files for images larger than RAM, and compressed output formats. The implementation supports Python 3.9 through 3.14 and is actively maintained.
Use it for
- Segment densely labeled 3D biomedical images where each voxel may belong to a different instance or semantic label.
- Extract and analyze individual connected components from instance segmentation outputs without repeated masking and relabeling.
- Process continuous-valued grayscale images by grouping nearby voxel values into components using a delta threshold.
- Handle very large volumetric datasets that exceed available RAM using memory-mapped files or stack-based compressed output.
- Compute component statistics (centroids, bounding boxes, voxel counts, contact networks) in a single operation after labeling.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with 2D/3D image segmentation or multilabel volumetric data.
The single-pass multilabel algorithm offers genuine performance and convenience advantages over masking-based approaches. The copyleft license (LGPL-3.0-or-later) requires careful review if you plan proprietary distribution. Install friction is moderate due to C++ compilation, but prebuilt wheels cover most platforms. No known security vulnerabilities.
Install
connected-components-3d on PyPI
Before you install
Medium install friction due to compiled C++ extension, but prebuilt wheels are available for Python 3.10–3.13 across macOS, Windows, and Linux. Requires numpy. Occasional binary incompatibility with numpy can force source compilation, which requires a C++ compiler.
Requires C++ compiler if prebuilt wheels unavailable for your platform; occasional numpy binary incompatibility may require source compilation or numpy upgrade.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). Derivative works and modifications must be released under compatible terms; proprietary use requires careful licensing review or source code disclosure.
Quickstart
pip install connected-components-3d
import connected_components_3d
import numpy as np
labels_in = np.ones((512, 512, 512), dtype=np.int32)
labels_out = connected_components_3d.connected_components(labels_in)
Verify before relying
- Performance improvement magnitude over scipy on multilabel images (description claims 'one or more orders of magnitude' but provides no quantified benchmark data).
- Memory efficiency gains for very large volumes (description mentions memmap and stack processing but no concrete memory savings are documented).
- Whether binary image optimizations mentioned as 'not implemented yet' have been added in version 4.0.0.
Package facts
| License | LGPL-3.0-or-later copyleft |
| Python support | Supports the current Python release <4.0,>=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 70 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 219,951 / month, #9,317 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: Windows :: Windows 10Operating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering |
Evidence: connected_components_3d-4.0.0-cp310-cp310-macosx_10_9_x86_64.whl; connected_components_3d-4.0.0-cp310-cp310-macosx_11_0_arm64.whl; connected_components_3d-4.0.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; connected_components_3d-4.0.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; connected_components_3d-4.0.0-cp310-cp310-win32.whl; connected_components_3d-4.0.0-cp310-cp310-win_amd64.whl; connected_components_3d-4.0.0-cp311-cp311-macosx_10_9_x86_64.whl; connected_components_3d-4.0.0-cp311-cp311-macosx_11_0_arm64.whl; connected_components_3d-4.0.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; connected_components_3d-4.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; connected_components_3d-4.0.0-cp311-cp311-win32.whl; connected_components_3d-4.0.0-cp311-cp311-win_amd64.whl; connected_components_3d-4.0.0-cp312-cp312-macosx_10_13_x86_64.whl; connected_components_3d-4.0.0-cp312-cp312-macosx_11_0_arm64.whl; connected_components_3d-4.0.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; connected_components_3d-4.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; connected_components_3d-4.0.0-cp312-cp312-win32.whl; connected_components_3d-4.0.0-cp312-cp312-win_amd64.whl; connected_components_3d-4.0.0-cp313-cp313-macosx_10_13_x86_64.whl; connected_components_3d-4.0.0-cp313-cp313-macosx_11_0_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “connected components labeling 3d”
- connected-components-3dLabels connected components in 2D and 3D images with support for…
- trimeshTrimesh loads, manipulates, and analyzes triangular mesh geometry in…
- PyGEL3DPyGEL3D provides Python bindings for a C++ geometry processing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also edt · fill-voids · nnunetv2 · opensimplex · labelbox · label-studio · skan · face-alignment · batchgenerators · cellpose