numpymaxflow: Max-flow/Min-cut in Numpy for 2D images and 3D volumes
Project description
numpymaxflow: Max-flow/Min-cut in numpy for 2D images and 3D volumes
Numpy-based implementation of Max-flow/Min-cut based on the following paper:
- Boykov, Yuri, and Vladimir Kolmogorov. "An experimental comparison of min-cut/max-flow algorithms for energy minimization in vision." IEEE transactions on pattern analysis and machine intelligence 26.9 (2004): 1124-1137.
If you want same functionality in PyTorch, then consider PyTorch-based implementation
Citation
If you use this code in your research, then please consider citing:
Asad, Muhammad, Lucas Fidon, and Tom Vercauteren. "ECONet: Efficient Convolutional Online Likelihood Network for Scribble-based Interactive Segmentation." Medical Imaging with Deep Learning (MIDL), 2022.
Installation instructions
pip install numpymaxflow
or
# Clone and install from github repo
$ git clone https://github.com/masadcv/numpymaxflow
$ cd numpymaxflow
$ pip install -r requirements.txt
$ python setup.py install
Example outputs
Maxflow2d
Interactive maxflow2d
Example usage
The following demonstrates a simple example showing numpymaxflow usage:
image = np.asarray(Image.open('data/image2d.png').convert('L'), np.float32)
image = np.expand_dims(image, axis=0)
prob = np.asarray(Image.open('data/image2d_prob.png'), np.float32)
lamda = 20.0
sigma = 10.0
post_proc_label = numpymaxflow.maxflow(image, prob, lamda, sigma)
For more usage examples see:
2D and 3D maxflow and interactive maxflow examples: demo_maxflow.py
References
This repository depends on the code for maxflow from latest version of OpenCV, which has been included.
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
Built Distributions
Hashes for numpymaxflow-0.0.6-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50a0e50f71d44963f5a6bf9ec09e07e997108f25e9f37160eee997fcc857663c |
|
MD5 | 69b67c0ee5a2310a7146e0e549830e96 |
|
BLAKE2b-256 | 12e73d30c3037eee39117828ffdabe879caa8104dc187e31200aaf2c63f1bc7d |
Hashes for numpymaxflow-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9e8c86956481db05bdceb1b1f23d1f50fdbecb81808b9e5643cd0c377fa5d90 |
|
MD5 | f2bec253a78c004f4b416f79ebea445a |
|
BLAKE2b-256 | 0540ca69b2368b2f90c0cd71ef57905d8f05b324937d515d7228140f7cfbde62 |
Hashes for numpymaxflow-0.0.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5d1773fe6bc8607920417ad6e82f7fb536d39c7c2f5fbf634cdc25e628b5bd |
|
MD5 | 7906b72aff5cdf057f86c645d1496a85 |
|
BLAKE2b-256 | f444f373511d7e194ffd0119dd972dbd0ecbafb65e1f6bbc3dc6f61ea2a74a25 |
Hashes for numpymaxflow-0.0.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f1c04ce0883d44bb8fa39ec9c86be69c99b1098eaf1e1c05dbbd0852cbbd0e7 |
|
MD5 | 558d5ce58525d3c0e428f5bd3a4843be |
|
BLAKE2b-256 | b5cffcd81f3a0bc9be64deaad554d8b7bfa32436041634fd80a4e13d38301715 |
Hashes for numpymaxflow-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6f9224b07a930c36b7745a317ad2ef0aafb9f517344f9ed431ce92390f7de32 |
|
MD5 | fd25882a784db8daa2d599b3238e09f5 |
|
BLAKE2b-256 | fb0f9a0365d76a688dec693ba65745564bc66294388c54c24a6bf69f4d2abb30 |
Hashes for numpymaxflow-0.0.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4412af0e6f08f040d73250806331cfee25e2e3308ac21fa058fafc0541ee9203 |
|
MD5 | 06737590048988e36cd4060f80f35b23 |
|
BLAKE2b-256 | 9865c3f8ac186155fbdb8942815c54cb2d491b5b879508655e84340cf9d28e4d |
Hashes for numpymaxflow-0.0.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666aa45307837d944f3d36c9fa56fc9b90bdd61cbacd742814e5ee0b8dae63a1 |
|
MD5 | d8b335c08650b4a0d587ebeb720a4b4a |
|
BLAKE2b-256 | 200c17d6746f7b1220248eec93fe6aaf5832c7947742755b40909e5689ac0e8c |
Hashes for numpymaxflow-0.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f9bcb5c0957429dabffc92a242767bdacdee44dee9f66668f1cc82bf5a6289 |
|
MD5 | 4d1d16ae9d903d4ecc6c7c48ac67381e |
|
BLAKE2b-256 | e75cd2ec079607b03614b772f3516dd0f50f9788db946e4ea3beb78d0b0fc918 |
Hashes for numpymaxflow-0.0.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32c424eb169d26ec57bc7f698ba1b603d1d5b549afefa0be7e3632b9d681b161 |
|
MD5 | 8983a94145de50e998ae77a680b04b9a |
|
BLAKE2b-256 | b2b5105ea7655e88fc967a17f7bc05f49cdae594576f1af033d6f369ac721600 |
Hashes for numpymaxflow-0.0.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d581d75acd4a8a6fef181bbf649d044ab5beb536babbb1290339243da6a3bc2 |
|
MD5 | 431c7a0a0291c0e758227bc673df0db1 |
|
BLAKE2b-256 | 03eaf172743fe5f78bbf352fecb1045f25affae2a019d08ec7cb59a4e3e39ecd |
Hashes for numpymaxflow-0.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 454b617ad98678bba0d0381339bab1b4dcd7085bd5719f43d0c63eb182cf0858 |
|
MD5 | 2e3dd06fdbeef21c786e8a92b834c83f |
|
BLAKE2b-256 | f71271319adbbacdf10e988c806db7a443734c5a46c1901c51e2958b202eca9d |
Hashes for numpymaxflow-0.0.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb27caa05cc2ce56290d851716408abb45c7b88e3a559dd1d73f211f6468094b |
|
MD5 | 26edbecc316542115de146944590e5a1 |
|
BLAKE2b-256 | d32f3f6cc0aa7a056c59c9a6c436c8b08d3a327c53ac3b010388adcc28b28c65 |