rw-noise


Namerw-noise JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://zivgitlab.uni-muenster.de/ag-pria/rw-noise-model
SummaryA library for random walker image segmentation under known noise models
upload_time2023-04-06 15:36:58
maintainer
docs_urlNone
authorDominik Drees
requires_python
licenseMIT
keywords random-walker image-segmentation noise-model
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Random Walker Image Segmentation for Python

This is an implementation of the Random Walker for image segmentation method by Grady [1] with implementations of dynamic, noise modeling-based weight functions [2,3,4].

If you use this code in your research, please cite the following as a reference.

```
A Bhattacharyya Coefficient-Based Framework for Noise Model-Aware Random Walker Image Segmentation
Dominik Drees, Florian Eilers, Ang Bian and Xiaoyi Jiang
CoRR abs/2206.00947 (2022)
```
# Installation
Install from pypi using `pip install rw_noise`.

# Building
The library itself is implemented in c++ and requires a modern compiler that supports the C++20 standard.
Further, the following libraries have to be available:
 * Boost (with python and numpy support)
 * OpenMP
 * Python3
 * Eigen3
 * Magma, Cuda (optionally, for the GPU solver)

To build the library, invoke `pythom -m build`.
Then, to install use `pip install <path_to_wheel>` where `<path_to_wheel>` is likely a file in the created `dist` subfolder with extension `.whl`.

# Usage
The API is very simple and mostly consists of the two functions `weights` and `solve`.
For weight definition, a method has to be supplied which can be constructed via the following functions:
 * `fixed` (Grady [1]) 
 * `global_gaussian_bian` (Bian et al. [2])
 * `ttest` (Bian et al. [3])
 * `poisson` (Drees et al. [4]),
 * `variable_gaussian` (Drees et al. [4]),
 * `global_gaussian` (Drees et al. [4]),

Of those, only `fixed` and `global_gaussian` are suitable for non-scalar pixel data.

A minimal example program using the library could look like the following:
```python
import rw_noise as rw
import numpy as np
import matplotlib.pyplot as plt

# Load a two-dimensional single-channel image from a file. (Multi-channel
# images are also supported, but only for methods "global_gaussian" and
# "fixed")
image = np.load('/path/to/some/image/file.npy').astype(np.float32)

# Create a seed map. 0 means unlabeled, i>0 means pixel has class i
seeds = np.zeros(image.shape, dtype=np.uint32)
# Mark top left pixel as class 1
seeds[0,0] = 1
# Mark bottom right pixel as class 2
seeds[-1,-1] = 2

# Methods are specified as dictionaries.
# Choose one of the following and change parameters as needed:
method = rw.variable_gaussian(filter_extent=2)
#method = rw.global_gaussian(filter_extent=2)
#method = rw.poisson(filter_extent=2)
#method = rw.ttest(filter_extent=2)
#method = rw.global_gaussian_bian(filter_extent=2)
#method = rw.fixed(beta=100)

# Calculate weights
weights_h, weights_v = rw.weights(image, method)

# Solve RW problem using the previously calculated weights and seeds.
# 'classes' then contains an integer map specifying the final class per pixel
# 'probabilities' is a list of class probabilies for all specified classes
classes, probabilities = rw.solve(weights_h, weights_v, seeds)
plt.imshow(classes)
plt.show()
for probs in probabilities:
    plt.imshow(probs)
    plt.show()
```

# References

[1] Leo J. Grady: Random Walks for Image Segmentation. IEEE Trans. Pattern Anal. Mach. Intell. (2006)

[2] Ang Bian and Xiaoyi Jiang: Statistical Modeling Based Adaptive Parameter Setting for Random Walk Segmentation. ACIVS (2016)

[3] Ang Bian and Xiaoyi Jiang: T-Test Based Adaptive Random Walk Segmentation Under Multiplicative Speckle Noise Model. ACCV Workshops (2016)

[4] Dominik Drees, Florian Eilers, Ang Bian and Xiaoyi Jiang: A Bhattacharyya Coefficient-Based Framework for Noise Model-Aware Random Walker Image Segmentation. [CoRR abs/2206.00947](https://arxiv.org/abs/2206.00947) (2022)

            

Raw data

            {
    "_id": null,
    "home_page": "https://zivgitlab.uni-muenster.de/ag-pria/rw-noise-model",
    "name": "rw-noise",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "random-walker image-segmentation noise-model",
    "author": "Dominik Drees",
    "author_email": "dominik.drees@uni-muenster.de",
    "download_url": "https://files.pythonhosted.org/packages/21/e8/6b817d9c83ee4f3f3c12167af0c19c3273664adf35b634ec48d09bdae6b9/rw_noise-0.1.2.tar.gz",
    "platform": "any",
    "description": "# Random Walker Image Segmentation for Python\n\nThis is an implementation of the Random Walker for image segmentation method by Grady [1] with implementations of dynamic, noise modeling-based weight functions [2,3,4].\n\nIf you use this code in your research, please cite the following as a reference.\n\n```\nA Bhattacharyya Coefficient-Based Framework for Noise Model-Aware Random Walker Image Segmentation\nDominik Drees, Florian Eilers, Ang Bian and Xiaoyi Jiang\nCoRR abs/2206.00947 (2022)\n```\n# Installation\nInstall from pypi using `pip install rw_noise`.\n\n# Building\nThe library itself is implemented in c++ and requires a modern compiler that supports the C++20 standard.\nFurther, the following libraries have to be available:\n * Boost (with python and numpy support)\n * OpenMP\n * Python3\n * Eigen3\n * Magma, Cuda (optionally, for the GPU solver)\n\nTo build the library, invoke `pythom -m build`.\nThen, to install use `pip install <path_to_wheel>` where `<path_to_wheel>` is likely a file in the created `dist` subfolder with extension `.whl`.\n\n# Usage\nThe API is very simple and mostly consists of the two functions `weights` and `solve`.\nFor weight definition, a method has to be supplied which can be constructed via the following functions:\n * `fixed` (Grady [1]) \n * `global_gaussian_bian` (Bian et al. [2])\n * `ttest` (Bian et al. [3])\n * `poisson` (Drees et al. [4]),\n * `variable_gaussian` (Drees et al. [4]),\n * `global_gaussian` (Drees et al. [4]),\n\nOf those, only `fixed` and `global_gaussian` are suitable for non-scalar pixel data.\n\nA minimal example program using the library could look like the following:\n```python\nimport rw_noise as rw\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# Load a two-dimensional single-channel image from a file. (Multi-channel\n# images are also supported, but only for methods \"global_gaussian\" and\n# \"fixed\")\nimage = np.load('/path/to/some/image/file.npy').astype(np.float32)\n\n# Create a seed map. 0 means unlabeled, i>0 means pixel has class i\nseeds = np.zeros(image.shape, dtype=np.uint32)\n# Mark top left pixel as class 1\nseeds[0,0] = 1\n# Mark bottom right pixel as class 2\nseeds[-1,-1] = 2\n\n# Methods are specified as dictionaries.\n# Choose one of the following and change parameters as needed:\nmethod = rw.variable_gaussian(filter_extent=2)\n#method = rw.global_gaussian(filter_extent=2)\n#method = rw.poisson(filter_extent=2)\n#method = rw.ttest(filter_extent=2)\n#method = rw.global_gaussian_bian(filter_extent=2)\n#method = rw.fixed(beta=100)\n\n# Calculate weights\nweights_h, weights_v = rw.weights(image, method)\n\n# Solve RW problem using the previously calculated weights and seeds.\n# 'classes' then contains an integer map specifying the final class per pixel\n# 'probabilities' is a list of class probabilies for all specified classes\nclasses, probabilities = rw.solve(weights_h, weights_v, seeds)\nplt.imshow(classes)\nplt.show()\nfor probs in probabilities:\n    plt.imshow(probs)\n    plt.show()\n```\n\n# References\n\n[1] Leo J. Grady: Random Walks for Image Segmentation. IEEE Trans. Pattern Anal. Mach. Intell. (2006)\n\n[2] Ang Bian and Xiaoyi Jiang: Statistical Modeling Based Adaptive Parameter Setting for Random Walk Segmentation. ACIVS (2016)\n\n[3] Ang Bian and Xiaoyi Jiang: T-Test Based Adaptive Random Walk Segmentation Under Multiplicative Speckle Noise Model. ACCV Workshops (2016)\n\n[4] Dominik Drees, Florian Eilers, Ang Bian and Xiaoyi Jiang: A Bhattacharyya Coefficient-Based Framework for Noise Model-Aware Random Walker Image Segmentation. [CoRR abs/2206.00947](https://arxiv.org/abs/2206.00947) (2022)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library for random walker image segmentation under known noise models",
    "version": "0.1.2",
    "split_keywords": [
        "random-walker",
        "image-segmentation",
        "noise-model"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21e86b817d9c83ee4f3f3c12167af0c19c3273664adf35b634ec48d09bdae6b9",
                "md5": "7bf7bbbef14498bfe4bcd6da2a726c4d",
                "sha256": "b5e5f5c92059aac9ac76dbc3fc522726eb1d605a099577a7bf0c4a9a8854d5db"
            },
            "downloads": -1,
            "filename": "rw_noise-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7bf7bbbef14498bfe4bcd6da2a726c4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 36704,
            "upload_time": "2023-04-06T15:36:58",
            "upload_time_iso_8601": "2023-04-06T15:36:58.184423Z",
            "url": "https://files.pythonhosted.org/packages/21/e8/6b817d9c83ee4f3f3c12167af0c19c3273664adf35b634ec48d09bdae6b9/rw_noise-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-06 15:36:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "rw-noise"
}
        
Elapsed time: 0.08954s