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.2rc1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae63ba64c56d4cba81d2b2f0beb2b1aa04619864f86ba8690f45682f131e6e45 |
|
MD5 | ffed3b150158377c734e0f2ddc915de6 |
|
BLAKE2b-256 | a613c12570c5fd3c45b3dd1503a450c264699130c97d3e2abd163b2722659aac |
Hashes for numpymaxflow-0.0.2rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6edc6dd7238b89923b04afccb6e0ec0e1a97cf6df8cb85c6f65061321450d4a |
|
MD5 | e2fef5a9cda9d6dae38d16cb97084413 |
|
BLAKE2b-256 | 03a177718a5686b9c5f07377c27d636b8a37d0dedf76ab71c08f26d617d79750 |
Hashes for numpymaxflow-0.0.2rc1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f64aa167c2c73700b1713873f7e346cf95e5c8107910067e19844a72b10a5057 |
|
MD5 | 3f703507cf45e1c029e95ab7472234a4 |
|
BLAKE2b-256 | 187f927cad00ea0499cad7024d10b5360ea995a65d2d8930442262b442cff8b3 |
Hashes for numpymaxflow-0.0.2rc1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cf4e41102fc03e9fa0aa638931200604136e9f955a5004cfff587264e64415f |
|
MD5 | a9dfd02ad3ded64db7564eb00c5042de |
|
BLAKE2b-256 | 4c1857691ed067ced20de1faa29508680e2d3b469b0f6394e09720e95a2512f8 |
Hashes for numpymaxflow-0.0.2rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e74a4e55ccf8476ffebbbfa438f3394a6b0b3994e79a035dbd73ae3ae7cf0d42 |
|
MD5 | 55d18d013784014f3f961e1d533448fc |
|
BLAKE2b-256 | 08c31fcdce90de9c53a480cc3b9bc78d530829097a528c3ae2b6affad68455ba |
Hashes for numpymaxflow-0.0.2rc1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b6a0562413d1bede4785594b841367a84205e112668d169ab5c5fb4ad63b84d |
|
MD5 | c9a2ecddd4e3b2b1213a31b1a29e0bf1 |
|
BLAKE2b-256 | 6b940331084020d2768b926bda59eb9bcd15f5f8fef6b7058da7e387b403a1c7 |
Hashes for numpymaxflow-0.0.2rc1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb09e47f197584f9b7c7ef024660c073147807fb4cf88285ad212c2507362d24 |
|
MD5 | 7debabaa7094ed782e2de6af4cf3ddf1 |
|
BLAKE2b-256 | 602dd6417b470b39994698f70a92d7443181de33092cb49bb179247b9168b142 |
Hashes for numpymaxflow-0.0.2rc1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 494921e61194b4f9d38cf6aca74683deea302549fa559a493ac1db4121f1e20c |
|
MD5 | 70b86690b261e321ab5aa2d71fff745f |
|
BLAKE2b-256 | e05a8c87c659a71e8dbac06a405f9e18ab856930e458389372297e10b27b51bd |
Hashes for numpymaxflow-0.0.2rc1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 781879d0756495045495182cdfd11a8999e3a3282a132d975767aff88bac52f3 |
|
MD5 | 0e47e0db2b48a96d75b025237de607b6 |
|
BLAKE2b-256 | 8ffa2940e02fd7ca40c84475a044f85975571812cecb5c737885f73837611c2d |
Hashes for numpymaxflow-0.0.2rc1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2a32d31d0b495a3715c195a62576f2f54ae1e71720ef0fa12319e046aa39b7c |
|
MD5 | d68f251867fd8e0e6bd05720c9ecdb18 |
|
BLAKE2b-256 | 4ebed3306ce372c1f250f7142b528d97747013e65fa47d4197fd65c770d143ba |
Hashes for numpymaxflow-0.0.2rc1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 172c53471b137289a1f033e93073c9135b73785be729a7ac4a1ca79a112a17f0 |
|
MD5 | a814f717189a8949ac20d5e309cf9486 |
|
BLAKE2b-256 | 0c4ab245dd39dca7ab371eb4f2d74decabaa90a25963fa06cac095462eb9fc7e |
Hashes for numpymaxflow-0.0.2rc1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2e8a21ee6c3203379ad3a873a1fa84ddcc7f4cc285141260eb276e4739608c7 |
|
MD5 | 20e5cabddc71edbdc14a52e2b2f72aa0 |
|
BLAKE2b-256 | 904158dd0c572140f7e7fc38e01e32260c942a4d35dc8678312f2700669242fb |