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-2.0.0.tar.gz (173.7 kB view details)

Uploaded Source

Built Distributions

edt-2.0.0-cp38-cp38-win_amd64.whl (150.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

edt-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl (198.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

edt-2.0.0-cp37-cp37m-win_amd64.whl (245.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

edt-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (196.3 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

edt-2.0.0-cp36-cp36m-win_amd64.whl (245.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

edt-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl (199.5 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

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

Uploaded CPython 3.5m

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

Uploaded CPython 2.7m

edt-2.0.0-cp27-cp27m-macosx_10_14_intel.whl (193.2 kB view details)

Uploaded CPython 2.7m macOS 10.14+ intel

File details

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

File metadata

  • Download URL: edt-2.0.0.tar.gz
  • Upload date:
  • Size: 173.7 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-2.0.0.tar.gz
Algorithm Hash digest
SHA256 377aae7f6881c070d9127342e3d36e10cb029e80f80a249ce2b8b901a933916b
MD5 b0fc89ff54efee81e25be28166473d48
BLAKE2b-256 033b277d2806de1ada4a2da998afea20823d1445192ea0309b4e424493e3fe4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 150.0 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-2.0.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 20dceae883baf9d9e3ec2343ecd217922b89bd9da646f989a4ba2d42d857b462
MD5 bbc9256c8549fbc1a3fc4331bc444df2
BLAKE2b-256 0d9bf0fedf235f1ae5cf2c80a03dcf61358ef83902c8994a15a957ac10f42519

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.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-2.0.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 08c8fcac8c59d858008f9fb5fa037d008cad162dbe381021a9706f0619e0b1c2
MD5 839386e1514350c86dcd7f250d836211
BLAKE2b-256 a52f0fa1a7939c8fd51f047e2d009be7ae25376697e58f9a9373c4245351714f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 198.1 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • 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-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 216221532d698709c19e80eb361e8ef6d24e86613eb3721c94e9ffbd0afb7769
MD5 d2c67252c983e8cee2e21a8337ff9073
BLAKE2b-256 855728c03f08ca91f8894965443f5e27daeba7a012724aa30efd623f96a2de36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 245.8 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-2.0.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3ee533f8edddb60cc0c3d16ffbfaffc001ceb5394b15811fc362139e288e1579
MD5 bb3995be3c957b7e0c05ce54b6e8c00c
BLAKE2b-256 815bbe95c43073fd60b99d15a05822936374e13b2659f36fad489417cf122e56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.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-2.0.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 33f5e9a455c6b10238f45614de4a3c37dbdc01cb984294f694f3708185d5f728
MD5 dff15f0c230e250b56a314e7c0d1c818
BLAKE2b-256 04a705fb6f23961a96dfdb94f1383a80491c9becd3a84dada17db2d4b96f4b75

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 196.3 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • 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-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7e2d16a7eb02861919cb7518e8ca2653be651854feca657b7a200c7c7d420ef7
MD5 06ed530b74372a10d7928baa0f197149
BLAKE2b-256 b5cdf38ee61967fa2f9c0eaaa0f13bda50e6a9e979ad0ebe8ea9cea89f524505

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 245.7 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-2.0.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 416c2afd85f75ab42aeaa2d630d36f3ba018378f8cf9c62387af04369855887d
MD5 56585347d3d9325ed8e49d0bf9b94dd4
BLAKE2b-256 3793750a4442d5801c61db149eb964ce9fc526242b9126dfa3d4d057f1e18d29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.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-2.0.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 51951e7b13a3477bcf3b88fb1776e92bbb947ebef622949d678ef5b819a44d91
MD5 e380d7dd34714593c8cdfb4e5dd9c23c
BLAKE2b-256 a71a2c5703ad01f1f7aa800ca8065d24f2d4b953095391c6bffea08dd389442a

See more details on using hashes here.

File details

Details for the file edt-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: edt-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 199.5 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • 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-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 be241e805dc5201ca92ba1b09dc58d30ebe904dbe36f2be9afbd07884ead9e79
MD5 c1d53d10546fa080f261c8d417421a50
BLAKE2b-256 775393b34a3ba56e14aedd3af82689b1bbf5f95102cbbd20965e2e407d85ad9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.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-2.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c0a9b06cb342e9882c5a018c066c00fcceb134233fd8dac46700c05befac6cd2
MD5 1444bf2238194cc7676ddb16f9a79698
BLAKE2b-256 c2c77152a53f1a70f859a7d93e467ca6f62095e79a5d1c7db8d50a221a4a0b7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.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-2.0.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bfb82ac05268f0db4aec117446edc482e007198707c81aa9e69b6b456cc318f6
MD5 ca4272e59efc81751a9c9643824c07a3
BLAKE2b-256 273ee07a1099496160936046f1c132951057c859bcde293097022b3ddb504a7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-2.0.0-cp27-cp27m-macosx_10_14_intel.whl
  • Upload date:
  • Size: 193.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-2.0.0-cp27-cp27m-macosx_10_14_intel.whl
Algorithm Hash digest
SHA256 a149b5689dc873d04941a733afc16e75cbebba3f15b6a695a7763094b7f50d18
MD5 ba14d2a90daf618d03a6832159d711d2
BLAKE2b-256 03e258040e8481f633eac1ed20b6f57bd1f489f465b177a3fac38b1d0d5dc3fb

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