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 two optional parameters are `anisotropy` and `black_border`. 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).
```python
import edt
import numpy as np
labels = np.ones(shape=(512, 512, 512), dtype=np.uint32)
dt = edt.edt(labels, anisotropy=(6, 6, 30), black_border=True) # e.g. for the S1 dataset by Kasthuri et al., 2014
```
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 two optional parameters are `anisotropy` and `black_border`. 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).
```python
import edt
import numpy as np
labels = np.ones(shape=(512, 512, 512), dtype=np.uint32)
dt = edt.edt(labels, anisotropy=(6, 6, 30), black_border=True) # e.g. for the S1 dataset by Kasthuri et al., 2014
```
Project details
Release history Release notifications | RSS feed
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.1.1.tar.gz
(164.7 kB
view details)
File details
Details for the file edt-1.1.1.tar.gz
.
File metadata
- Download URL: edt-1.1.1.tar.gz
- Upload date:
- Size: 164.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7e49c12c02775f951dbd2de8ce0f416cbe0deaaf336b3e56d2e6116771c0cbc |
|
MD5 | 61dea37a9098f4986f2cf6cf2dd2076a |
|
BLAKE2b-256 | 78fda1cd27190252a6b8e722b1447825ff8a66a6eb1e4743d86329c97eddf1eb |