pyhscore


Namepyhscore JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/IntegratedPathologyUnit-ICR/pyhscore
SummaryCompute H-scores in Python, including the canonical cell-based H-score and a pixel-wise implementation inspired by Ram et al. 2021.
upload_time2024-06-26 10:31:29
maintainerNone
docs_urlNone
authorFerranC96
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python pathology imaging ihc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyhscore


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

![CI](https://github.com/IntegratedPathologyUnit-ICR/pyhscore/actions/workflows/test.yaml/badge.svg)
[![PyPI
version](https://badge.fury.io/py/pyhscore.svg)](https://badge.fury.io/py/pyhscore)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12531732.svg)](https://doi.org/10.5281/zenodo.12531732)

## Install

First set up a new conda environment with some basic dependencies:

``` sh
conda create -n pyhscore python pip ipykernel
```

Then activate the environment and install the package:

``` sh
conda activate pyhscore
```

``` sh
pip install pyhscore
```

## How to use

Always ensure you are using an active environment where the package has
been installed to. If you followed the suggested install instructions
that can be done by running `conda activate pyhscore`.

``` python
from pyhscore import score

help(score.compute_pxlhscore)
```

    Help on function compute_pxlhscore in module pyhscore.score:

    compute_pxlhscore(hed_img, h_threshold=0.05, d_thresholds=[0.12, 0.24, 0.6], verbose=False)
        Computes the pixel H-score for a given HED (Hematoxylin and Eosin-DAB) stained image.

        The H-score is calculated based on the intensity of the DAB stain, which is
        indicative of the presence and quantity of a specific biomarker in IHC images.
        The function allows for automatic thresholding based on the distribution of staining intensities.
        Inspired by the implementation in Ram et al. 2021.

        Parameters:

        - hed_img (numpy.ndarray): The HED-stained image as a NumPy array of shape
            (height, width, channels).

        - h_threshold (str or float): Threshold for Hematoxylin intensity.
            If 'auto', the threshold is set to the mean intensity.

        - d_thresholds (str or list of floats): Thresholds for DAB intensity,
            defining negative, low, medium, and high intensity ranges.
            If 'auto', thresholds are set to the 90th, 94.95th, and 99.9th percentiles.

        - verbose (bool): If True, displays histograms of the distributions of
            Hematoxylin and DAB stain values, and images showing pixels classified
            as high, medium, low, and negative DAB stained.

        Returns:

        - pxlHscore (float): The pixel H-score, a weighted sum of pixels classified
            as having high, medium, or low DAB intensity,
            normalized by the total number of pixels considered.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/IntegratedPathologyUnit-ICR/pyhscore",
    "name": "pyhscore",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python pathology imaging ihc",
    "author": "FerranC96",
    "author_email": "ferran.cardoso@icr.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/de/5b/2ab7e358479220147919c48d1c873ea7adf62ed45bf2288a588072012892/pyhscore-0.0.2.tar.gz",
    "platform": null,
    "description": "# pyhscore\r\n\r\n\r\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\r\n\r\n![CI](https://github.com/IntegratedPathologyUnit-ICR/pyhscore/actions/workflows/test.yaml/badge.svg)\r\n[![PyPI\r\nversion](https://badge.fury.io/py/pyhscore.svg)](https://badge.fury.io/py/pyhscore)\r\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12531732.svg)](https://doi.org/10.5281/zenodo.12531732)\r\n\r\n## Install\r\n\r\nFirst set up a new conda environment with some basic dependencies:\r\n\r\n``` sh\r\nconda create -n pyhscore python pip ipykernel\r\n```\r\n\r\nThen activate the environment and install the package:\r\n\r\n``` sh\r\nconda activate pyhscore\r\n```\r\n\r\n``` sh\r\npip install pyhscore\r\n```\r\n\r\n## How to use\r\n\r\nAlways ensure you are using an active environment where the package has\r\nbeen installed to. If you followed the suggested install instructions\r\nthat can be done by running `conda activate pyhscore`.\r\n\r\n``` python\r\nfrom pyhscore import score\r\n\r\nhelp(score.compute_pxlhscore)\r\n```\r\n\r\n    Help on function compute_pxlhscore in module pyhscore.score:\r\n\r\n    compute_pxlhscore(hed_img, h_threshold=0.05, d_thresholds=[0.12, 0.24, 0.6], verbose=False)\r\n        Computes the pixel H-score for a given HED (Hematoxylin and Eosin-DAB) stained image.\r\n\r\n        The H-score is calculated based on the intensity of the DAB stain, which is\r\n        indicative of the presence and quantity of a specific biomarker in IHC images.\r\n        The function allows for automatic thresholding based on the distribution of staining intensities.\r\n        Inspired by the implementation in Ram et al. 2021.\r\n\r\n        Parameters:\r\n\r\n        - hed_img (numpy.ndarray): The HED-stained image as a NumPy array of shape\r\n            (height, width, channels).\r\n\r\n        - h_threshold (str or float): Threshold for Hematoxylin intensity.\r\n            If 'auto', the threshold is set to the mean intensity.\r\n\r\n        - d_thresholds (str or list of floats): Thresholds for DAB intensity,\r\n            defining negative, low, medium, and high intensity ranges.\r\n            If 'auto', thresholds are set to the 90th, 94.95th, and 99.9th percentiles.\r\n\r\n        - verbose (bool): If True, displays histograms of the distributions of\r\n            Hematoxylin and DAB stain values, and images showing pixels classified\r\n            as high, medium, low, and negative DAB stained.\r\n\r\n        Returns:\r\n\r\n        - pxlHscore (float): The pixel H-score, a weighted sum of pixels classified\r\n            as having high, medium, or low DAB intensity,\r\n            normalized by the total number of pixels considered.\r\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Compute H-scores in Python, including the canonical cell-based H-score and a pixel-wise implementation inspired by Ram et al. 2021.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/IntegratedPathologyUnit-ICR/pyhscore"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python",
        "pathology",
        "imaging",
        "ihc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47d7faf83b72a9ccf5f22782bce0164860d611cb0b1efee50da73953cbe6a98b",
                "md5": "d7b2be4f55dc768ac85124a166ac6217",
                "sha256": "a753bfc2f840278ca662ff3eed2b2e75519cee66ff80474c625e3603f6c742c1"
            },
            "downloads": -1,
            "filename": "pyhscore-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d7b2be4f55dc768ac85124a166ac6217",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9096,
            "upload_time": "2024-06-26T10:31:28",
            "upload_time_iso_8601": "2024-06-26T10:31:28.245586Z",
            "url": "https://files.pythonhosted.org/packages/47/d7/faf83b72a9ccf5f22782bce0164860d611cb0b1efee50da73953cbe6a98b/pyhscore-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de5b2ab7e358479220147919c48d1c873ea7adf62ed45bf2288a588072012892",
                "md5": "3da785adb136b56734d969012d4fe4c7",
                "sha256": "83d4e3c6e1748acbdc76242dc51002024ba7712576cd16db4fb80cde1dd0a2a1"
            },
            "downloads": -1,
            "filename": "pyhscore-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3da785adb136b56734d969012d4fe4c7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9323,
            "upload_time": "2024-06-26T10:31:29",
            "upload_time_iso_8601": "2024-06-26T10:31:29.578560Z",
            "url": "https://files.pythonhosted.org/packages/de/5b/2ab7e358479220147919c48d1c873ea7adf62ed45bf2288a588072012892/pyhscore-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-26 10:31:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IntegratedPathologyUnit-ICR",
    "github_project": "pyhscore",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyhscore"
}
        
Elapsed time: 0.33239s