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.
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 = numpy.from_numpy(image).unsqueeze(0).unsqueeze(0)
prob = np.asarray(Image.open('data/image2d_prob.png'), np.float32)
prob = numpy.from_numpy(prob).unsqueeze(0)
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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4998c0b0043d92c0a1af393925525b7f609f95f902778639ea2b7e5aca59187a |
|
MD5 | 95c2031f2e6f9696803f16598100712a |
|
BLAKE2b-256 | 0f91f2dc62e98846cca07a012090dafa0c34d2f9bed081a9f7aad6a462189216 |
Hashes for numpymaxflow-0.0.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5597e08b06d6000ad7a18c3cfff7a270a113e1d8b3d608d7671f0100e9e8053 |
|
MD5 | d91e910af65219d5f2db154c8b7a9ba0 |
|
BLAKE2b-256 | 0b8486cdad3cc6f731966344aeec328a96f15f06c91f41b31ef4f520f137e613 |
Hashes for numpymaxflow-0.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f2cd3e29696ec29c85a0fa7140af2f4d1289717392a4534fd429df5402584f |
|
MD5 | a11ecda5d431602a4bdd33e549d6a777 |
|
BLAKE2b-256 | 5a2c6a2e035428907ed0996cd73e75a8d1929697f86690a8592160859e8b5f09 |
Hashes for numpymaxflow-0.0.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48f67944aa8190452400fbf56b96251323ac13880c4f5afd9341cd103bb010dd |
|
MD5 | 457ead89ddb57644034171c49e5ce43e |
|
BLAKE2b-256 | c06352b15cf840d75258365c5cadded83a88fd6ef01a50584f5d5693a918697e |
Hashes for numpymaxflow-0.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 203d38d3d60c5967f7a1ae97231fe3d04ca3a463009e2e7e802d4a2736510a6c |
|
MD5 | d4c468036f7327d10dc98d4d81f1e5cd |
|
BLAKE2b-256 | 6e932bb7a0cd0480970f15e6f26ca526ed506d4b4551cc6d8bdd4cb63873d6e6 |
Hashes for numpymaxflow-0.0.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a4ff713b441a991b86200917e0a469063f297bdb076121fd85190a31546d2f2 |
|
MD5 | e15ba5071f64a9d3dcb113d44399c4d6 |
|
BLAKE2b-256 | c6b8116a4bb9ef55ba0103e6f9a73403c0b0eeb7800a1b83ed664a73a20f3c6a |
Hashes for numpymaxflow-0.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc5ae252827ed2a200b2aedf83c465dc8acc96ce2b01528e43e0887ea4c6ef4 |
|
MD5 | 1bdf36d0b4e9cd95efd657a1bfb7d249 |
|
BLAKE2b-256 | 0941025a61438a68cf9e3d7fda54433b02d619fb6f033096e6fdd1e99f273a81 |
Hashes for numpymaxflow-0.0.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82b499ca6cd1b863eab78bac83b772f27bd5ca72f48048bfebc1e86a6c4afda5 |
|
MD5 | f86a989d3ddbb90ff8ea0066a58968a8 |
|
BLAKE2b-256 | c2fa5ab38792db391b0e3b4ddb9fbe306f38075dbef415b77390d1fb32bc0dc9 |