{"id":23653,"library":"edt","title":"Euclidean Distance Transform 3D","description":"Computes the Euclidean distance transform of 3D and 2D label fields. Supports anisotropic voxels (non-cubic) and multi-label segmentation. v3.1.1, updated June 2024, active development with irregular releases.","status":"active","version":"3.1.1","language":"python","source_language":"en","source_url":"https://github.com/seung-lab/euclidean-distance-transform-3d","tags":["distance-transform","label-field","anisotropic","3d","segmentation"],"install":[{"cmd":"pip install edt","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"edt is a module, not a function within edt; top-level import is correct.","wrong":"from edt import edt","symbol":"edt","correct":"import edt"}],"quickstart":{"code":"import edt\nimport numpy as np\n\nlabels = np.array([[[0, 1, 0], [1, 0, 0], [0, 0, 2]]], dtype=np.uint32)\ndist = edt.edt(labels, anisotropic=(1.0, 1.0, 1.0))\nprint(dist)\n# Output: 3D distance transform (x, y, z axes)\n","lang":"python","description":"Compute Euclidean distance transform for a 3D label array. Use anisotropic parameter to set voxel size."},"warnings":[{"fix":"Convert labels to np.uint32 or np.uint64 before calling edt.edt.","message":"edt.edt expects uint32 or uint64 labels by default. Passing int32 or float labels will silently produce incorrect results.","severity":"gotcha","affected_versions":"all"},{"fix":"Always provide anisotropic as (sx, sy, sz) tuple for 3D, or (sx, sy) for 2D.","message":"Anisotropic parameter must be a tuple of three floats (for 3D) or two floats (for 2D). Omitting or using wrong shape leads to undefined behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"If you need to preserve the original array, set in_place=False (the default) or pass a copy.","message":"edt.edt modifies the input array in-place if the 'in_place' parameter is True (default False). Unexpected side effects may occur.","severity":"gotcha","affected_versions":"all"},{"fix":"Use num_threads=N instead of parallel=N.","message":"The 'parallel' parameter (int) was deprecated in 3.0.0 and removed in 3.1.0. Use 'num_threads' instead.","severity":"deprecated","affected_versions":">=3.0.0 <3.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use just 'import edt' then call 'edt.edt()'.","cause":"Trying to import edt as from edt import edt, but edt is the module itself.","error":"ImportError: cannot import name 'edt' from 'edt'"},{"fix":"For 2D arrays, use edt.edt(..., ndim=2) or call edt.edt2d() if available (not in current version).","cause":"Passed a 2D array to edt.edt without specifying ndim=2 or using the 2D variant.","error":"ValueError: ndim is 2 but expected 3"},{"fix":"Pass anisotropic as a tuple of three floats, e.g., (0.5, 0.5, 1.0).","cause":"Anisotropic parameter passed as list or wrong type.","error":"TypeError: anisotropic must be a tuple of floats"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}