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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8

edt-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl (197.6 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

edt-1.3.2-cp37-cp37m-win_amd64.whl (245.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7m

edt-1.3.2-cp37-cp37m-macosx_10_9_x86_64.whl (196.1 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

edt-1.3.2-cp36-cp36m-win_amd64.whl (235.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6m

edt-1.3.2-cp36-cp36m-macosx_10_13_x86_64.whl (200.3 kB view details)

Uploaded CPython 3.6mmacOS 10.13+ x86-64

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

Uploaded CPython 3.5m

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

Uploaded CPython 2.7m

edt-1.3.2-cp27-cp27m-macosx_10_14_intel.whl (193.7 kB view details)

Uploaded CPython 2.7mmacOS 10.14+ Intel (x86-64, i386)

File details

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

File metadata

  • Download URL: edt-1.3.2.tar.gz
  • Upload date:
  • Size: 172.2 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.3.2.tar.gz
Algorithm Hash digest
SHA256 accf53fab874c714398ba851e4886e41be98316adaa8b9af6963d4b6ea86b7f0
MD5 7aff3252f1d71cb24f2f000f2edbd198
BLAKE2b-256 4c8bef3f7f4c9f627452eba5522ed0da30e904a5c8511c6ab8016b3287cefc7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-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.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.3.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 24fc87545c89007ed9c89bdfec8e9ca69613b927720228fec0ce049cc199242c
MD5 1b94974151bd48aaa71efdf5eb8fd0d1
BLAKE2b-256 925f6cd0f78a669c090f4f104d4ae5e0817c3a911eace4fd7b873a1c678c2e14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 197.6 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-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93fb8da864d19fec165d45ec53977131ca1e09e7379558fb6b87e3a28d4ca851
MD5 bdfa3757abc9b1bda0bf5489933e970d
BLAKE2b-256 b741ca0f0997e8c36846841edf7aa051e4f97e438bea1ce0b091c0457423bee9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 245.1 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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4rc2

File hashes

Hashes for edt-1.3.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0731d28e54194049417447a8b88f6a03cb903fbcbfd60652fd03d06efbf9a429
MD5 4b6a05fe60f3d347a6e1938245c57930
BLAKE2b-256 8e5103f5e34317a0ffde4e435301b713cf15b58345083890c89151c92aa1fbca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-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.3.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 556c72dab835b020c502617f0c7aa32e79c36bd32d9928afcc7959a4b82bcb3d
MD5 d97a195e905fc1b2ac30d49f76c62af2
BLAKE2b-256 b157b971f9255dcda9ed5cfe43679b8aeb2799a2cf3089c6363d0dba58b11846

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 196.1 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/2.7.10

File hashes

Hashes for edt-1.3.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 093881fb7aa9d3bf1cc421bb3e0ac104c4a428e7c419d28dc5a755a5cac8fcc7
MD5 09bc1810314468507b8346f92147e1d0
BLAKE2b-256 c4a1599097841fa42de3e1ae5501f26e7ec67ceec697cbe4ddb15c184e68fe29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 235.2 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/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for edt-1.3.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f839a956a7de1f7fb87a16688b898489ee969058363a69daf556cbb4a8f4a539
MD5 562104f10b6d51232cfb12e10649f948
BLAKE2b-256 4178c51ee8fc531402fe6daa73e49ab0e849f55a27896a351fb7e0d330b7c4a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-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.3.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 de07cfe132f17636e8595b31095c7466473a7344be3564bb23f2bd549b260a59
MD5 aa933f0d2c815a4e23d1bf736365ab30
BLAKE2b-256 086abb7c5c1b720dbd84da59649e9fc175c991f2cb1a42df1a84b87a947556d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 200.3 kB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • 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.5

File hashes

Hashes for edt-1.3.2-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3d23f148cb156314ed092148fff6984f9c63e77f158dbe344adf3942d16bf39b
MD5 6779da401582c924cbaabf0526e7ad89
BLAKE2b-256 e843567047e7512bc4b414c0df24b09faa52c4f744c6dd5fe39daed7b5c72b41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-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.3.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f2321626c628fb015a70a939f1dac6b883444eae0997f11c2eccb70165653e84
MD5 48c898957d51160ba47b74c54493b978
BLAKE2b-256 07ecb1b8fdb18636f19f90cdb8316fabb7030e19c5c2a9f5a9cc49541dd3c6fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-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.3.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 648f0db69c93fbd1d75d99dc750ecfd0b8a44b84bcbde125bc93fb4fcb02e560
MD5 1a76c899ae3bb5440ff90f2935678820
BLAKE2b-256 980c67eb5aac2e03970d02c5f70e5336b9795f6adf81cabc5587eebe93bf639b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.2-cp27-cp27m-macosx_10_14_intel.whl
  • Upload date:
  • Size: 193.7 kB
  • Tags: CPython 2.7m, macOS 10.14+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/2.7.10

File hashes

Hashes for edt-1.3.2-cp27-cp27m-macosx_10_14_intel.whl
Algorithm Hash digest
SHA256 71f7b25a2fbd2036ff31280507075cc56185b50d7a9fc518350fd9819fa08928
MD5 fac4c54e5369ea60e539697649922437
BLAKE2b-256 725dd3197fa0f42f2154bff494a6db8d5d100c2ca7232c6f07a94a005322febd

See more details on using hashes here.

Supported by

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