Skip to main content

Multi-Label Anisotropic Euclidean Distance Transform 3D

Project description

Python Instructions for MLAEDT-3D

Compute the Euclidean Distance Transform of a 1d, 2d, or 3d labeled image containing multiple labels in a single pass with support for anisotropic dimensions.

Python Installation

Requires a C++ compiler

The installation process depends on edt.cpp for the Python bindings derived from edt.pyx. edt.hpp contains the algorithm implementation.

pip install numpy
pip install edt

Recompiling edt.pyx

Requires Cython and a C++ compiler

cd python
cython -3 --cplus edt.pyx # generates edt.cpp
python setup.py develop # compiles edt.cpp and edt.hpp 
                        # together into a shared binary e.g. edt.cpython-36m-x86_64-linux-gnu.so

Python Usage

Consult help(edt) after importing. The edt module contains: edt and edtsq which compute the euclidean and squared euclidean distance respectively. Both functions select dimension based on the shape of the numpy array fed to them. 1D, 2D, and 3D volumes are supported. 1D processing is extremely fast. Numpy boolean arrays are handled specially for faster processing.

If for some reason you'd like to use a specific 'D' function, edt1d, edt1dsq, edt2d, edt2dsq, edt3d, and edt3dsq are available.

The three optional parameters are anisotropy, black_border, and order. Anisotropy is used to correct for distortions in voxel space, e.g. if X and Y were acquired with a microscope, but the Z axis was cut more corsely.

black_border allows you to specify that the edges of the image should be considered in computing pixel distances (it's also slightly faster).

order allows the programmer to determine how the underlying array should be interpreted. 'C' (C-order, XYZ, row-major) and 'F' (Fortran-order, ZYX, column major) are supported. 'C' order is the default.

parallel controls the number of threads. Set it <= 0 to automatically determine your CPU count.

import edt
import numpy as np

# e.g. 6nm x 6nm x 30nm for the S1 dataset by Kasthuri et al., 2014
labels = np.ones(shape=(512, 512, 512), dtype=np.uint32, order='F')
dt = edt.edt(labels, anisotropy=(6, 6, 30), black_border=True, order='F', parallel=1) 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edt-1.4.0.tar.gz (172.5 kB view details)

Uploaded Source

Built Distributions

edt-1.4.0-cp38-cp38-win_amd64.whl (149.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

edt-1.4.0-cp38-cp38-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8

edt-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl (196.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

edt-1.4.0-cp37-cp37m-win_amd64.whl (244.9 kB view details)

Uploaded CPython 3.7m Windows x86-64

edt-1.4.0-cp37-cp37m-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m

edt-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl (195.2 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

edt-1.4.0-cp36-cp36m-win_amd64.whl (244.9 kB view details)

Uploaded CPython 3.6m Windows x86-64

edt-1.4.0-cp36-cp36m-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6m

edt-1.4.0-cp36-cp36m-macosx_10_13_x86_64.whl (198.0 kB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

edt-1.4.0-cp35-cp35m-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.5m

edt-1.4.0-cp27-cp27m-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 2.7m

edt-1.4.0-cp27-cp27m-macosx_10_14_intel.whl (192.2 kB view details)

Uploaded CPython 2.7m macOS 10.14+ intel

File details

Details for the file edt-1.4.0.tar.gz.

File metadata

  • Download URL: edt-1.4.0.tar.gz
  • Upload date:
  • Size: 172.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0.tar.gz
Algorithm Hash digest
SHA256 d0a76220cfcec4bc2c6b1f48460903d7044ad7e6e86fb68d4b63949ffbaa612d
MD5 adf2e1aa1e1a8868ee3c5f42ab616429
BLAKE2b-256 29a3cff36231bb7003cbb539747cb547044a097c3f731d6de47878972f554458

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: edt-1.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 149.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for edt-1.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f13a3ca80f981a0c4a0d67c86a240e578f05090975086e050cc817e17c66ce35
MD5 6b1b6652be394e073478d77e8327b6cf
BLAKE2b-256 f1460b104570e023a025a16e79b0f69922bb44ef9e9a675907dc88791b256e86

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8b4d9ab1ba53740bcffbb3f3e045c51451f7568fc870e5c531d230d705b83476
MD5 01aed9a99e622ecaffe7210074b5b9a4
BLAKE2b-256 8849c0da54c873fa0f0677db57b2c30856aedf9b4432451ce24c0dd0c2241255

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 196.9 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2

File hashes

Hashes for edt-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed316468839fca86c7ee7626005a86a5eae486ef7ee31fda9dde6a559b0be4fa
MD5 1c895b33ec979854dc0e2c538147596d
BLAKE2b-256 e58543b6fd6d2b63ef884bfe8a042ce4e23f7e8b87523a65bebc8cfceb28104d

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: edt-1.4.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 244.9 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for edt-1.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ece7a356cc2b117eefebbb792650626e0b0a86d906d3bdff23e2c5687e651013
MD5 7e132506b94c82c3398581a0f80f0cd2
BLAKE2b-256 80aa7c33b8a492d0b8ff24c6c39e83e1b046826bf6f947c95c64365706ae294b

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 37cd5b28fb99fa1856503d5242a37b0b2c025f5e491739269bbf8c9b4b5f0f29
MD5 795d42d72bce6ce61d1fa46a719f449c
BLAKE2b-256 b668b30c54761ebb3bf2dd51b3e0f835bf94ff342e57de8d6a750a843a18b29e

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 195.2 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2

File hashes

Hashes for edt-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f51e1cb076f378b45e86f13b68af6d4c5faab6b7e30ea362ddeb901f466975d
MD5 3f409122a4954a41946f5e44829aba56
BLAKE2b-256 976608820bff27b964f172d12ee9d462baa676471d60a7b9d3f292d0ccd252e5

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: edt-1.4.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 244.9 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for edt-1.4.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7eed5ffe361b9a5c3946c882e4394bfbc640a5d4a1689e1a1348683c45886793
MD5 bfbc295a78402e2595fcff5e64c28a83
BLAKE2b-256 08e5b442eb0081ff0b484c04fc6487d2422dfe36f0e63807194494eadc046097

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e4e09f0899f8f29bb26692ec89259b0ce491152a7057457458dbae30731e8392
MD5 4f2abd2feb316fd45f28afa4f78ca414
BLAKE2b-256 1ed15ac30714f37b0ece4622ec510fa0d417b8707b7b7f313fce4f0d52095528

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 198.0 kB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2

File hashes

Hashes for edt-1.4.0-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 090c7ede08ae14a45f6beaef44a774da0a1d38d0cca10d3907b10ca7dba87e44
MD5 8daea02679cde23e3a1c70eec67cdbc1
BLAKE2b-256 1accd0c82dc3f27fbb0e2acd8bf7b5f0954c496c595d945d9d87030b1e7c6c46

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0cefe2f09140d6eb8d5c6c99b1cd593eb4b587a3cc8416fff5a3dbb3bce669f8
MD5 dce029af213f2bf88fedddde02b4d4fd
BLAKE2b-256 46e3f44de00713f8dcd5912a251aec50d82e579b64b651ae0bf0268e5e89f0fe

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

  • Download URL: edt-1.4.0-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for edt-1.4.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0891294f9588c98f001da736a1cab43908265880044284d5c4f5f6ad21ea85a7
MD5 a73feae1021d62903db38682e1700ed5
BLAKE2b-256 42ae809f025413b9e5683bdbbf6a0dbf19b00f61643e0d58388f085a6701fb39

See more details on using hashes here.

File details

Details for the file edt-1.4.0-cp27-cp27m-macosx_10_14_intel.whl.

File metadata

  • Download URL: edt-1.4.0-cp27-cp27m-macosx_10_14_intel.whl
  • Upload date:
  • Size: 192.2 kB
  • Tags: CPython 2.7m, macOS 10.14+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for edt-1.4.0-cp27-cp27m-macosx_10_14_intel.whl
Algorithm Hash digest
SHA256 3a1f901298424a0a2a61433712f0ca06e7822fce04be0f32718ad041e0d21253
MD5 2aab3a2e8788d55ff595d3ee00bec6db
BLAKE2b-256 b07d92e8bd927c43b005a728d556226d686b380c591f7c0da5baf465363b6460

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page