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.

```bash
pip install numpy
pip install edt
```

### Recompiling `edt.pyx`

*Requires Cython and a C++ compiler*

```bash
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.

```python
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.1.tar.gz (171.9 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

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

Uploaded CPython 2.7m

File details

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

File metadata

  • Download URL: edt-1.3.1.tar.gz
  • Upload date:
  • Size: 171.9 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.1.tar.gz
Algorithm Hash digest
SHA256 bd4cfc6ab83e658a741eca8fc087c6b18013f5025510784f8a51b4928dced026
MD5 7cfc5f61b8be40eedd78e96afdc85968
BLAKE2b-256 5db33d561fc9c68b67f1db7510c3654a1118eedf433cdc4bf663eabcf2ed8ab9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.1-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.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 db2de92f3e0ba1d901cc79d113066a13a2b4854d2e8d4729eead4a1afac236cc
MD5 437febdaa098685d5a1e70774fb017d8
BLAKE2b-256 9939cd97bc66f8329b3461dfe7e4eddf1f03f69b4a0fa4d54052d78310840838

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.1-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.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 67fe0afdaa3c634eb95d902879cf0bc75895f6a380e454e1e57937e6482176c3
MD5 16abc8d898834aebb3c23892cd5c75d1
BLAKE2b-256 768de588f881b5ce5e6face24056cf3ba28bd61bbf18ab3625335dcb5658ff33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.1-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.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 22bb1400ae4de8a1e433f50df241e9a987a0f82fe20344b47173abbb0fa27333
MD5 d0b4ab370f46f15c52168137054959c3
BLAKE2b-256 42df5ce35ef7b9dca376ae8e262dffd4546d2248ac3ff6a540b6b46f0c8578f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edt-1.3.1-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.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b29070bd93681ed0ac82e90274963818d32e2a53920fedd16ee2b2f6adddf64f
MD5 313a347e8ff6279ec703087bdf6d25b3
BLAKE2b-256 103219fbdc070339973bb505215efcf46fc2422895edf39de7b63840f7e4af5f

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