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.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 017c724bf0ac9f3a2b1f2f2398b6e84c1144035f1c729a0e83938cd0c0d384c2 |
|
MD5 | bc5253916249a1770cafc73a4f6387d9 |
|
BLAKE2b-256 | bf685f85de005f19a5018bb23cd04a71d1cdf93a9aa418ac4b29b4cc9f4ae727 |
Hashes for numpymaxflow-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8efc9ca0c3e20c433c5508f981c336942c6d528877b477a3e86035617dff0ede |
|
MD5 | e2e8e3ca56d5aa26298723f19fdd6f82 |
|
BLAKE2b-256 | 69279e9db770bf0889b858703fe28f5147490eac2083d6791fc955f257acc7d4 |
Hashes for numpymaxflow-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b485ad7489edd4fc71f8590d936f173c588f2e60e7ec262e6b9a3e6ce7580315 |
|
MD5 | e9b38556c570f4b2a81b49c9bdfbbc1b |
|
BLAKE2b-256 | 7a12c9d90220f6eb3e24dac1cdd6d6835f9657c91b47f47ce221a18bd20b772c |
Hashes for numpymaxflow-0.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87bd12f8da907646aa3a4a0bd50f80ba347155b74d48e6a0edca16787527b391 |
|
MD5 | 2f12939e79a7325dbbf8c3748ba13575 |
|
BLAKE2b-256 | fcc34abdbc48049009aa27e1d5d5e7ee679fbc252bfa7824bddfd222ea452519 |
Hashes for numpymaxflow-0.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 080d91a15cc49c6c5a781bfbc11c2f68d1e113fe14d1e2ff8f8a44092d56a5a2 |
|
MD5 | fdc6533ad6610891ea2cd960a693934e |
|
BLAKE2b-256 | e7a9bf31ba86798c2ffc62c5f4578b1fa19e8e22ed75148d3b741393e73cca61 |
Hashes for numpymaxflow-0.0.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6a0d3a93a84e87006ae018742743217be4dd5034a8eaf3cf3b01c4f71de6133 |
|
MD5 | 63cdc5e453b4c75ecf2c3bac14217813 |
|
BLAKE2b-256 | 53c5fb738299941c3cdc5fc29c54422bf5cb912b8dc6f763694e4605db3f16ac |
Hashes for numpymaxflow-0.0.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 749dba675fc0d7dd46d4788d43b47f7a5a6d6ddda5e52e7d2231c6906b8df11d |
|
MD5 | 6c72ae5063d7da0ba89f3edc5ae9e40a |
|
BLAKE2b-256 | 07b1bcce4c57459d6d7933a6b7a381a0c50b76e53ee2d925f6f85a2f46450e6c |
Hashes for numpymaxflow-0.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b651794d8e0f21c8082204e6948e452a07a34285ea824b8323b8c244cf94b8e6 |
|
MD5 | 80636391ae4a94007f56e2f733add6e1 |
|
BLAKE2b-256 | 2dcc7529de02a185e636efb30b45173eebabb343eb67a4f36fc2065603d8b0b5 |
Hashes for numpymaxflow-0.0.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e27412ed8487ecdc28d20aea4ac6933ceb4d9aee5174f029926ea506f6c6609c |
|
MD5 | 9b3545d24701e5c314f502a5d7db5bfb |
|
BLAKE2b-256 | 8b5f41332bc4f9344528590ebc2e09cf1d1818ab030d0b0eb2fa442b56ba4445 |
Hashes for numpymaxflow-0.0.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1de3bb0e2bed9be87a3eb6c4978d0caa555e9fa4a01ac580d0c67d9e56171eb |
|
MD5 | e1a72ccae28b92ccdc34d3ba3f620405 |
|
BLAKE2b-256 | 17c8975092069da55b472cb6fbe64d9e5f198cfe2b7a58d2c3fa69291736e2c5 |
Hashes for numpymaxflow-0.0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7922fc763b51e404c03e2caa5cab42b08eeec811f8124e97709380840c3ff2d |
|
MD5 | cbf07b0ee44fdfef74df475cf9fbd995 |
|
BLAKE2b-256 | 886bb276a5f2ce83f315a12f2a937858661344e46b778cb6e5c6bddd6ad62fa5 |
Hashes for numpymaxflow-0.0.3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2f2750a28993cd88e54f2d2f2934be032b77d80c1083066d6f189ae74243f51 |
|
MD5 | 4aad91c20b188d658f4e9134688d68b1 |
|
BLAKE2b-256 | aac339bce1a34b3806321cfbe6cd61f742ca745a468cbcf9471e1b3b65e4082f |