fill-voids
Fill voids in 3D binary images fast.
What it is and what it does
fill-voids is a Python library that fills interior holes in binary images using a fast scan-line flood-fill algorithm. It works on both 2D and 3D arrays and is designed to be significantly faster and more memory-efficient than scipy's binary_fill_holes, which uses slower serial dilations. The library is written in C++ with Python bindings, and it exposes both a Python API and a C++ header for direct use.
The algorithm marks foreground pixels, scans from image boundaries to identify background regions connected to the exterior, then flood-fills those regions. Everything not visited by the flood fill is marked as foreground, effectively filling all interior voids. It uses performance tricks like libdivide for coordinate computation and directional scanning to exploit memory locality. The package is actively maintained, supports Python 3.10, 3.11, and 3.12 with prebuilt wheels, and has no known security vulnerabilities.
Use it for:
- Cleaning up connectomics segmentation masks by filling small holes in labeled regions before downstream analysis.
- Preprocessing binary medical images to remove noise artifacts before feature extraction or registration.
- Morphological post-processing in computer vision pipelines where speed matters on large 3D volumetric data.
- Filling voids in 2D binary masks for image segmentation refinement in scientific imaging workflows.
- Real-time or batch processing of densely labeled 3D datasets where scipy's performance is a bottleneck.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Fills interior voids in 2D and 3D binary images using a fast flood-fill algorithm, designed as a higher-performance alternative to scipy.ndimage.binary_fill_holes.
Yes, if you work with binary image morphology and need better performance than scipy.ndimage.binary_fill_holes. The package is actively maintained, has no vulnerabilities, and offers prebuilt wheels for common platforms. The LGPL-3.0-or-later license is permissive for research and open-source use but requires derivative works to remain open; verify compatibility with your project's licensing model. Medium install friction is acceptable for the performance gain in image processing workflows.
Install
fill-voids on PyPI
pip
pip install fill-voidsuv
uv add fill-voidspoetry
poetry add fill-voidsInstalling fill-voids
Before you install
Medium install friction due to compiled C++ components; prebuilt wheels available for Python 3.10, 3.11, and 3.12 on macOS, Linux (manylinux, musllinux), and Windows. Falls back to source build if no wheel matches your platform, requiring a C++ compiler and python3-dev headers.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). Derivative works and modifications must be released under compatible terms; static linking or closed-source use requires explicit permission or relicensing.
Quickstart
import fill_voids
import numpy as np
img = np.zeros((512, 512), dtype=np.uint8)
filled = fill_voids.fill(img, in_place=False)
filled, N = fill_voids.fill(img, return_fill_count=True)
Requires numpy and fastremap as runtime dependencies; C++ compiler needed if installing from source on unsupported platforms.
Verify before relying
- Performance improvement magnitude vs. scipy.ndimage.binary_fill_holes on typical workloads
- Memory overhead of in_place=False mode on large images
- Whether Python 3.9 and 3.13 are supported at runtime despite classifier presence
Package facts
| License | LGPL-3.0-or-later (copyleft) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 2 — numpy, fastremap |
| Maintenance | actively maintained — 106 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 113,036/month — #12,353 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fill_voids-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl; fill_voids-2.1.2-cp310-cp310-macosx_11_0_arm64.whl; fill_voids-2.1.2-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; fill_voids-2.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; fill_voids-2.1.2-cp310-cp310-musllinux_1_2_aarch64.whl; fill_voids-2.1.2-cp310-cp310-musllinux_1_2_x86_64.whl; fill_voids-2.1.2-cp310-cp310-win_amd64.whl; fill_voids-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl; fill_voids-2.1.2-cp311-cp311-macosx_11_0_arm64.whl; fill_voids-2.1.2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; fill_voids-2.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; fill_voids-2.1.2-cp311-cp311-musllinux_1_2_aarch64.whl; fill_voids-2.1.2-cp311-cp311-musllinux_1_2_x86_64.whl; fill_voids-2.1.2-cp311-cp311-win_amd64.whl; fill_voids-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl; fill_voids-2.1.2-cp312-cp312-macosx_11_0_arm64.whl; fill_voids-2.1.2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; fill_voids-2.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; fill_voids-2.1.2-cp312-cp312-musllinux_1_2_aarch64.whl; fill_voids-2.1.2-cp312-cp312-musllinux_1_2_x86_64.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
connected-components-3dLabels connected components in 2D and 3D images…
copyleft · top 15,000 on PyPI
simple-lama-inpaintingPerforms image inpainting using the LaMa model,…
unclear · top 15,000 on PyPI
pixeloeConverts standard images into pixel art using…
permissive · top 15,000 on PyPI
isosurfacesConstructs isolines and isosurfaces of 2D and…
permissive · top 15,000 on PyPI
fastremapRemap, renumber, and relabel NumPy arrays at…
copyleft · top 15,000 on PyPI
batchgeneratorsbatchgenerators provides data augmentation…
permissive · top 15,000 on PyPI
PyMattingPyMatting solves the alpha matting…
permissive · top 5,000 on PyPI
opensimplexGenerates OpenSimplex noise across 2D, 3D, and…
permissive · top 15,000 on PyPI
blendmodesApplies a range of blending modes to composite…
permissive · top 15,000 on PyPI
empty-filesCreates minimal valid empty files of various…
permissive · top 15,000 on PyPI