Metadata-Version: 2.1
Name: pyhscore
Version: 0.0.2
Summary: Compute H-scores in Python, including the canonical cell-based H-score and a pixel-wise implementation inspired by Ram et al. 2021.
Home-page: https://github.com/IntegratedPathologyUnit-ICR/pyhscore
Author: FerranC96
Author-email: ferran.cardoso@icr.ac.uk
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python pathology imaging ihc
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastcore
Requires-Dist: numpy
Requires-Dist: matplotlib
Provides-Extra: dev
Requires-Dist: fastcore ; extra == 'dev'
Requires-Dist: numpy ; extra == 'dev'
Requires-Dist: matplotlib ; extra == 'dev'
Requires-Dist: scikit-image ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'

# 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.
