Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: EIDOSLAB/torchstain
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.0-rc1
Choose a base ref
...
head repository: EIDOSLAB/torchstain
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 11 commits
  • 5 files changed
  • 1 contributor

Commits on Aug 9, 2022

  1. update README

    carloalbertobarbano committed Aug 9, 2022
    Copy the full SHA
    3bcbd72 View commit details
  2. fix docstring

    carloalbertobarbano committed Aug 9, 2022
    Copy the full SHA
    cb99e5e View commit details
  3. Copy the full SHA
    a4246c2 View commit details
  4. add python 3.6

    carloalbertobarbano committed Aug 9, 2022
    Copy the full SHA
    7298fc4 View commit details
  5. Copy the full SHA
    899e41f View commit details
  6. Copy the full SHA
    036d1ee View commit details
  7. Copy the full SHA
    78e42aa View commit details
  8. Copy the full SHA
    803c014 View commit details
  9. Copy the full SHA
    8560513 View commit details
  10. 1
    Copy the full SHA
    1282a02 View commit details
  11. Copy the full SHA
    365a494 View commit details
Showing with 120 additions and 9 deletions.
  1. +10 −7 .github/workflows/{tests.yml → tests_full.yml}
  2. +86 −0 .github/workflows/tests_quick.yml
  3. +23 −0 README.md
  4. +1 −1 setup.py
  5. +0 −1 torchstain/tf/utils/percentile.py
17 changes: 10 additions & 7 deletions .github/workflows/tests.yml → .github/workflows/tests_full.yml
Original file line number Diff line number Diff line change
@@ -3,10 +3,10 @@ name: tests
on:
push:
branches:
- '*'
- main
pull_request:
branches:
- '*'
- main

jobs:
build:
@@ -36,8 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ windows-2019, ubuntu-18.04, macos-11 ]
os: [ubuntu-18.04, ubuntu-20.04]
os: [ windows-2019, ubuntu-18.04, macos-11 ]
python-version: [ 3.7, 3.8, 3.9 ]
tf-version: [2.7.0, 2.8.0, 2.9.0]

@@ -69,10 +68,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ windows-2019, ubuntu-18.04, macos-11 ]
os: [ubuntu-18.04, ubuntu-20.04]
python-version: [ 3.7, 3.8, 3.9 ]
os: [ windows-2019, ubuntu-18.04, macos-11 ]
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
pytorch-version: [1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0]
exclude:
- python-version: 3.6
pytorch-version: 1.11.0
- python-version: 3.6
pytorch-version: 1.12.0

steps:
- uses: actions/checkout@v1
86 changes: 86 additions & 0 deletions .github/workflows/tests_quick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: tests

on:
push:
branches-ignore:
- main
pull_request:
branches-ignore:
- main

jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Install dependencies
run: pip install wheel setuptools

- name: Build wheel
run: python setup.py bdist_wheel

- name: Upload Python wheel
uses: actions/upload-artifact@v2
with:
name: Python wheel
path: ${{github.workspace}}/dist/torchstain-*.whl
if-no-files-found: error

test-tf:
needs: build
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Download artifact
uses: actions/download-artifact@master
with:
name: "Python wheel"

- name: Install dependencies
run: |
pip install tensorflow protobuf==3.20.* opencv-python-headless scikit-image
pip install pytest
- name: Install wheel
run: pip install --find-links=${{github.workspace}} torchstain

- name: Run tests
run: pytest -vs tests/test_tf.py

test-torch:
needs: build
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Download artifact
uses: actions/download-artifact@master
with:
name: "Python wheel"

- name: Install dependencies
run: |
pip install torch torchvision opencv-python-headless scikit-image
pip install pytest
- name: Install wheel
run: pip install --find-links=${{github.workspace}} torchstain

- name: Run tests
run: pytest -vs tests/test_torch.py
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@
[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![tests](https://github.com/EIDOSLAB/torchstain/workflows/tests/badge.svg)](https://github.com/EIDOSLAB/torchstain/actions)
[![Pip Downloads](https://img.shields.io/pypi/dm/torchstain?label=pip%20downloads&logo=python)](https://pypi.org/project/torchstain/)
[![DOI](https://zenodo.org/badge/323590093.svg)](https://zenodo.org/badge/latestdoi/323590093)



GPU-accelerated stain normalization tools for histopathological images. Compatible with PyTorch, TensorFlow, and Numpy.
Normalization algorithms currently implemented:
@@ -69,3 +72,23 @@ Results with 10 runs per size on a Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz
## Reference

- [1] Macenko, Marc, et al. "A method for normalizing histology slides for quantitative analysis." 2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro. IEEE, 2009.


## Citing

If you find this software useful for your research, please cite it as:


```bibtex
@software{barbano2022torchstain,
author = {Carlo Alberto Barbano and
André Pedersen},
title = {EIDOSLAB/torchstain: v1.2.0-rc1},
month = aug,
year = 2022,
publisher = {Zenodo},
version = {v1.2.0-rc1},
doi = {10.5281/zenodo.6976410},
url = {https://doi.org/10.5281/zenodo.6976410}
}
```
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
setup(
name='torchstain',
version='1.2.0',
description='Pytorch stain normalization utils',
description='Stain normalization tools for histological analysis and computational pathology',
long_description=README,
long_description_content_type='text/markdown',
url='https://github.com/EIDOSlab/torchstain',
1 change: 0 additions & 1 deletion torchstain/tf/utils/percentile.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ def percentile(t: tf.Tensor, q: float) -> Union[int, float]:
Return the ``q``-th percentile of the flattened input tensor's data.
CAUTION:
* Needs PyTorch >= 1.1.0, as ``torch.kthvalue()`` is used.
* Values are not interpolated, which corresponds to
``numpy.percentile(..., interpolation="nearest")``.