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.
Based on similar 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 = 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.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76395d8e9c8a2b7910a495d2c9c056435b82c7d9a27bd2515f25cb62f2c3c1d5 |
|
MD5 | 86765f739460a1a453f88d98132e8393 |
|
BLAKE2b-256 | 88bf75e72653d014760d1fb270dbb5e226737c0aaa1ff2e4174706926ea5f147 |
Hashes for numpymaxflow-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec3ad64946db4ee0e7ad23a25a340ebe178a788f5df01ce8b84e464d69cc099d |
|
MD5 | 0f1d4f6f67c0f4ba00ffd5a10bb5f25a |
|
BLAKE2b-256 | a288854d15a7e89fe00a1602ffa50ba5562f936c6c5549fd664161d830aa687f |
Hashes for numpymaxflow-0.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503786635046376628ce21b6c16c37feb5cb80b73843d35758a1a74a36781ce7 |
|
MD5 | a2ec5c5dcc96a4dd0d843681cb02b030 |
|
BLAKE2b-256 | adfb22c9752612631c3dbfe32b56bbee368462a7e175bf5ddc0a979182359aa7 |
Hashes for numpymaxflow-0.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0cbcbc59897428de6debc682a814ba159065c32cb473b5d852c12bd5eb5b54 |
|
MD5 | d215f334dd39f1706b6c6ec0cd19bc29 |
|
BLAKE2b-256 | 2fa056d3f9f84fd78920309fc650b2da0b57376450cb6c82a0219380d1fcd6ec |
Hashes for numpymaxflow-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 889a09b973bb4fb43ce4d5a2da590ba77e6d480f41f3f02176de71a1ccec0044 |
|
MD5 | 9f91eacf57cfe15fb8655d7c8bfb4019 |
|
BLAKE2b-256 | af27e5a53cc1d7928d3d97e530a347b970fea6f7b828ad11262745017fe19f6d |
Hashes for numpymaxflow-0.0.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19dd316c6059ef1aa0525b93a650bc223405261faf2384a869ecdf18ebda1cf7 |
|
MD5 | 3f6d16003f02894b025943f72076f89a |
|
BLAKE2b-256 | f2ec4de6e3e268ed759ef82ee26dcf4bdc742769aa8db2bc07fa11fabd3406c0 |
Hashes for numpymaxflow-0.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 825ad7fc150fc7a8c1efb5f7c857130e8220e185c455424a7ffe5330b887d02a |
|
MD5 | 972538977d0c1ae8c3330adf76c03f47 |
|
BLAKE2b-256 | 4a9124203abf8d3580494ae184b1e032af6ac4dc1498e8fb84b0cd380334b299 |
Hashes for numpymaxflow-0.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cc814728fdf02b1015598e4a37e0ec08969fbcb945fee3e1fa5cefa4aaaeb7 |
|
MD5 | 20318966325d07b7a6bf3581bc277867 |
|
BLAKE2b-256 | 425da3180dd606fc229455bf53e8adcb0369dd50eee42923160f26c23cfa52b2 |
Hashes for numpymaxflow-0.0.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b1cf3488b73d7007cbc6766897c15e87f9ea5f4d18d05cdaba625328635106b |
|
MD5 | a74c35eaeafa2349cb08b9829fd07368 |
|
BLAKE2b-256 | 546e90dbe7e83ef4a647dd6aff5d6498d7abc76998447faf01977b3af3965b4f |
Hashes for numpymaxflow-0.0.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac009e0fcce5f1250e9755a51e9f191978d57a48b615602f5636406cf271b374 |
|
MD5 | 859a8b0875800a4bbafe425ad1976d2e |
|
BLAKE2b-256 | 41dcdc0f357ca530935ac202f3c0fa0019c2baf2290d10b4584af2bdc878659d |
Hashes for numpymaxflow-0.0.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fce99dbfd75bdedf3fa94795a0ef1a5f85cb76d272aa688c64f98bad028c7f54 |
|
MD5 | 7866186eaa0db3a650f273de17a5d185 |
|
BLAKE2b-256 | e03e91a2417f93ac7475e93a6a2a8a597ba628be1cfa2de6101526f93df12d0f |
Hashes for numpymaxflow-0.0.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 772d315dc6b7f74806396802745e3cc70838e29ba29c63c1b61c748663b69aa8 |
|
MD5 | cdba0909e6cbbe889872060eca513add |
|
BLAKE2b-256 | bbda47a5f356736f1e5339d8f30e803e6a4ff4478c91bf55a99e63723ee04dc5 |