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.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1dfb5b15c7e009f1b6c1a1950b487b8629af030232bb4c9626b4b12518aefef |
|
MD5 | 8044b551380be559ca4f1c278db0a13e |
|
BLAKE2b-256 | fc34185af6280dd9fba1eabfb40914ba2a773cf01b5608994abb61c2995055f9 |
Hashes for numpymaxflow-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48d7eea1a6901fad3325b380a0d9781adf7ec2ffc2333f9f3dae612c1bcdc234 |
|
MD5 | ed4c3f24191a18d5fbdb21e8e28f7d37 |
|
BLAKE2b-256 | 692bf442b8bcf1014822fcb069668dbf6a7b1cfe5b8a2a5943677d153b8a2ab0 |
Hashes for numpymaxflow-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 876425da1887fac29c3512b7f6b61876703729b0a9888b464f00445ec8577b48 |
|
MD5 | 402cc86c7b3b5a964f1efa4b21f91ab0 |
|
BLAKE2b-256 | 6d801b1989968bc46cea2c96385e40f0cb339bbf61ec18faa7b4c8b4e3af044b |
Hashes for numpymaxflow-0.0.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e59be4e6515908ef18fd770838886d2a5276ab9531f1da6b3eacd4843267d678 |
|
MD5 | c9bf00be432cf35b0cf96189cff1e425 |
|
BLAKE2b-256 | 2d3152ccca73f83bdeb693e46549eaf8a72dae0c89c9031d2c31a0f1e501f710 |
Hashes for numpymaxflow-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfc88d071071995063bcedeaf1c22916b5019c07e78eff267d48ac0427806458 |
|
MD5 | f2a1d0852d68fa764a0ec9186b80881d |
|
BLAKE2b-256 | 29b8d0f247890cda163a509474a514998a253e6b027bcaeabc6466c4ba01e1d8 |
Hashes for numpymaxflow-0.0.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f7fa176543f135d5565a1381ec3073f19b4273e2bb7d5efc4cd622d801ffa4 |
|
MD5 | 541be7b31606793f48cb6535150e376b |
|
BLAKE2b-256 | e67820d5b82fecf54c0d64e313ebcb2fa3bf50f42b0e086c20d0635a5e851762 |
Hashes for numpymaxflow-0.0.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7355d3eca770dfbc8022efbff31527c766a2efde71b1c88b7e070ef07d547678 |
|
MD5 | c250347f2df55536f3a7552fb1f00a4c |
|
BLAKE2b-256 | 3ed70179c843b54d04d619b6a3a6fe052940b326cad87523ba4555fa305d2205 |
Hashes for numpymaxflow-0.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2153f038c2258a6bf8216028a5a6219884a8b005c9ea053f97f32e8798dd7242 |
|
MD5 | 5e90fdf0aabdd597543c813ef1529e24 |
|
BLAKE2b-256 | 70f0c3a11a06c4c41e7e5316f5e1eeb0718ebc564a66eef0eabff1368851e04b |
Hashes for numpymaxflow-0.0.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e9eac9853cbf5a9b41744dbd707680b57ecea5d9efcffc00c8bc959badfeee |
|
MD5 | 19d915b44bf0f3d8c96e698f3ba6284c |
|
BLAKE2b-256 | 319e423764d5df7c3b257e48eaaf5dad39d8dce6bc3695e498354501b1399963 |
Hashes for numpymaxflow-0.0.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c71ec00b8d39dac4c5edeb1c083a7cf94011fad1e7a96e4a45af91052ab9d667 |
|
MD5 | 9485a8e85991c4041c41ebfa29cbe843 |
|
BLAKE2b-256 | 38f111fd73ccd2c175dcf36ac2362b0ad0d201c2573acccc7755e5ef68bcd618 |
Hashes for numpymaxflow-0.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa18c5121ffaa7cdd933f0bf7dbff83aef654555ceeec8af7dd8e11f9cdce986 |
|
MD5 | eaf1363b9f4bc1973c8caee764e141c8 |
|
BLAKE2b-256 | fd4af82dcc9213cb4342f30579bcd73b8c8249f28e5e90826740b07eb4824094 |
Hashes for numpymaxflow-0.0.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fc43bff86a9782525960bf7d90b4fe482dd2de2bf649aba994ad46f8dd57024 |
|
MD5 | 029995f6935827f2d24a2b4da177e076 |
|
BLAKE2b-256 | 58b031594a39423d69ecdeb15b319845ae48710bc64e1067ed9b3939251edc7a |