{"id":23726,"library":"fill-voids","title":"fill-voids","description":"Fill voids (holes) in 3D binary images (numpy arrays) using a flood-fill algorithm. Fast and memory-efficient algorithm for hole filling in labeled or binary volumes. Current version 2.1.2, released Oct 2024. Releases are occasional, with breaking changes in the past (e.g., v2.0).","status":"active","version":"2.1.2","language":"python","source_language":"en","source_url":"https://github.com/seung-lab/fill_voids/","tags":["binary-image-processing","hole-filling","3d","numpy","flood-fill"],"install":[{"cmd":"pip install fill-voids","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install fill-voids[all]","lang":"bash","label":"Install with all extras (e.g., for large images)"}],"dependencies":[{"reason":"Core dependency for array manipulation.","package":"numpy","optional":false},{"reason":"Optional; used for some fast watershed operations.","package":"scipy","optional":true},{"reason":"Optional; needed for remapping after filling.","package":"fastremap","optional":true}],"imports":[{"note":"Function name is fill_voids, not fill.","wrong":"from fill_voids import fill","symbol":"fill_voids","correct":"from fill_voids import fill_voids"},{"note":"Must import explicitly or use module prefix.","wrong":"fill_voids.fill_multichannel (wrong if not imported)","symbol":"fill_multichannel","correct":"from fill_voids import fill_multichannel"}],"quickstart":{"code":"import numpy as np\nfrom fill_voids import fill_voids\n\n# Create a binary volume with a hole\nimage = np.ones((5,5,5), dtype=bool)\nimage[2:4, 2:4, 2:4] = False  # hole\n\n# Fill the hole\nfilled = fill_voids(image)\nprint(filled.all())  # Should be True","lang":"python","description":"Fills holes in a 3D binary numpy array."},"warnings":[{"fix":"Update import to 'from fill_voids import fill_voids' and call fill_voids() instead of fill().","message":"In v2.0, the main function was renamed from 'fill' to 'fill_voids'. Code using 'from fill_voids import fill' will break.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Ensure input is 3D (shape (Z, Y, X)). For 2D, reshape: image_3d = image[np.newaxis, ...]; then fill; then squeeze.","message":"In v2.0, the library no longer accepts 2D arrays by default. Use fill_voids with 3D or upgrade to handle 2D via a workaround (e.g., add a dummy axis).","severity":"breaking","affected_versions":"<2.0"},{"fix":"Pad the array with a border of foreground voxels before filling, or use the 'in_place' argument if available.","message":"fill_voids fills fully enclosed background regions only. It does not fill holes touching the image border by default.","severity":"gotcha","affected_versions":"all"},{"fix":"Use in_place=False (default) to preserve input; copy the array first if needed.","message":"The function modifies the input array in place if in_place=True (default False). Setting in_place=True can save memory but alters the original array.","severity":"gotcha","affected_versions":">=2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install fill-voids'. If using a virtual environment, ensure it is activated.","cause":"The package is not installed or is installed in a different environment.","error":"ModuleNotFoundError: No module named 'fill_voids'"},{"fix":"Change import to 'from fill_voids import fill_voids' and call fill_voids().","cause":"In fill-voids v2.0+, the function was renamed from 'fill' to 'fill_voids'.","error":"ImportError: cannot import name 'fill' from 'fill_voids'"},{"fix":"Reshape your 2D data to 3D by adding an axis: image = image[np.newaxis, ...] (or using np.expand_dims).","cause":"fill_voids expects a 3D numpy array (height, width, depth). 2D or other dimensions cause this error.","error":"ValueError: Input array must be 3D"},{"fix":"Ensure you have v2.1+ installed (pip install --upgrade fill-voids) and import it: from fill_voids import fill_multichannel.","cause":"fill_multichannel is available only in v2.1+ and must be imported separately.","error":"AttributeError: module 'fill_voids' has no attribute 'fill_multichannel'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}