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.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c94ead20f1ee38aceb2953ea07272cf3ce2cca6a20e75b773b34982cb76590 |
|
MD5 | c4519a6e5edc2a5472e6b13dd7360ada |
|
BLAKE2b-256 | 5389677047203a429aa080901dbb96babe07528ec0d091b6b52f7075e2db7422 |
Hashes for numpymaxflow-0.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c557b5a31e4400d058fbbcaafd23397a1f0414f0527f4fe079e7ff260ec149a4 |
|
MD5 | 0d5a9b156f6471bdb3d5faa376a388ea |
|
BLAKE2b-256 | 011768f360b8dc4baf6ad6d8aa38fcfb4d75a2f2eb676d35ba020eb4b0273fe3 |
Hashes for numpymaxflow-0.0.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f724f77e66f45845ee456c54b04658f5bc8e92157dc3fbf4cbc841b58d453565 |
|
MD5 | 36a95b05d11dcb3b09149c3005501bd3 |
|
BLAKE2b-256 | 593736847277d4887cec7d9071f18238631c08173cd9a46fdcb484bbfde302b2 |
Hashes for numpymaxflow-0.0.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e468de136d7021099efd9a91133d102cadaa8fd1578efcd664ecdbac82a9dbb5 |
|
MD5 | df73970f2f56709b779a8f234938825f |
|
BLAKE2b-256 | 6b9c137a58c3a20e5f00141b1a9cd4651beed6c74e7a72915ca977daa73bb6a4 |
Hashes for numpymaxflow-0.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 621854e7f0c57fa9461f5f53df754b0873ac18d0c4f5ed8646c5b7ad8da99bb2 |
|
MD5 | 1b4d3f3d35a958bef9bdac0534bf2691 |
|
BLAKE2b-256 | 0eb3a938144e2fc01e8964199fa2c58fa1120845590679aaae97098a53bbda06 |
Hashes for numpymaxflow-0.0.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3bff1a96ee9388c13f53b7b4fa958ef6b1569969965752ef68b0495107c5fd |
|
MD5 | d13677e3c781191cd91470dfe2890d6d |
|
BLAKE2b-256 | 116f10f1a04bf866cb3ce0660ffded42d430f3a46e8ee4bd9df1e53a2093d7d0 |
Hashes for numpymaxflow-0.0.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c116d00a71bbf7e29740e271d69d179f67d275f0739ac7ed144e1ce31e0b89 |
|
MD5 | 1f999353efaadf738d235abfefdf288e |
|
BLAKE2b-256 | cdb6b020534911694dd54482526c3b615b4a5930681f5cd0268a7e9685c13466 |
Hashes for numpymaxflow-0.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25b2dbeded022bc62503092d07b4b688f0e7f3d7248f83c2556951193fee344c |
|
MD5 | 3618e8164557d27fd6c0214aa7576132 |
|
BLAKE2b-256 | 7096b260fee3b8c023b7b77f1bed0257dfeee82ce9f342f28ca52ca0a955e5ea |
Hashes for numpymaxflow-0.0.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504597a325cc7868511973463782bb2bbdcbccc57bfb3a847ec202125c68eeb3 |
|
MD5 | 422ff6bafb5d36e2c58fc9041fbc5ca5 |
|
BLAKE2b-256 | 0d695077ced93fd5c96c7030b12dcc57987baf2a3d09226b8457c2c91e2aa594 |
Hashes for numpymaxflow-0.0.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e3049d91df53e56ae83fdfb833db6a81bca694d8e7195aeb67833577e79d6c |
|
MD5 | 098de2cb9b3c91365cf017b0f9ff0846 |
|
BLAKE2b-256 | 856bf9a3501f182c3a3cea5704c0b563597630c0a959689f707b8b8aa2e0c61c |
Hashes for numpymaxflow-0.0.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eea8af79e480c8c8f2716a1d6cbfa432d00a625243a088d2ff8c4796c1841c4 |
|
MD5 | 0ceaa965c472230a5bc303e76c78219e |
|
BLAKE2b-256 | 7a27135a550915c5380857cb7cae1bfdd922b4e303371fa396f793bbdcb04e0b |
Hashes for numpymaxflow-0.0.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cdc16850915686fcf83c3cb5e168be47e4fd7691ae82a482208f86354b42aba |
|
MD5 | c162c04dfaa492ebe80266972fae1c14 |
|
BLAKE2b-256 | 1951d45090fab475ddb5801f16258e1f41f7a1ad5a635ecd6ca949c7f782da68 |