Skip to content

Commit b1d92b0

Browse files
committed
Merge branch 'develop' of https://github.com/TissueImageAnalytics/tiatoolbox into sam-viz-fix
2 parents 660a118 + 1614a1f commit b1d92b0

File tree

108 files changed

+3428
-1246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+3428
-1246
lines changed

.github/workflows/docker-publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ jobs:
1515
fail-fast: true
1616
matrix:
1717
include:
18-
- dockerfile: ./docker/3.9/Debian/Dockerfile
19-
mtag: py3.9-debian
20-
- dockerfile: ./docker/3.9/Ubuntu/Dockerfile
21-
mtag: py3.9-ubuntu
2218
- dockerfile: ./docker/3.10/Debian/Dockerfile
2319
mtag: py3.10-debian
2420
- dockerfile: ./docker/3.10/Ubuntu/Dockerfile
@@ -31,7 +27,11 @@ jobs:
3127
mtag: py3.12-debian
3228
- dockerfile: ./docker/3.12/Ubuntu/Dockerfile
3329
mtag: py3.12-ubuntu
34-
- dockerfile: ./docker/3.12/Ubuntu/Dockerfile
30+
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
31+
mtag: py3.13-debian
32+
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
33+
mtag: py3.13-ubuntu
34+
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
3535
mtag: latest
3636
permissions:
3737
contents: read

.github/workflows/mypy-type-check.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
python-version: ["3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
2222

@@ -51,3 +51,6 @@ jobs:
5151
tiatoolbox/models/models_abc.py \
5252
tiatoolbox/models/architecture/__init__.py \
5353
tiatoolbox/models/architecture/utils.py \
54+
tiatoolbox/wsicore/__init__.py \
55+
tiatoolbox/wsicore/wsimeta.py \
56+
tiatoolbox/wsicore/metadata/

.github/workflows/pip-install.yml

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,32 @@ name: pip Install
55
on:
66
push:
77
paths: [ "requirements*.yml", "conda-env-create.yml", "requirements/requirement*.txt", "setup*py", "setup*cfg", "pytproject*toml", "MANIFEST*in"]
8+
pull_request:
9+
paths: [ "requirements*.yml", "conda-env-create.yml", "requirements/requirement*.txt", "setup*py", "setup*cfg", "pytproject*toml", "MANIFEST*in"]
810

911
jobs:
1012
build:
1113
runs-on: ${{ matrix.os }}
1214
strategy:
1315
fail-fast: true
1416
matrix:
15-
python-version: ["3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1618
os: [ubuntu-24.04, windows-latest, macos-latest]
1719
steps:
1820
- name: Set up Python ${{ matrix.python-version }}
1921
uses: actions/setup-python@v3
2022
with:
2123
python-version: ${{ matrix.python-version }}
22-
- name: 🐧 Install OpenSlide & OpenJPEG
24+
- name: 🐧 Install OpenJPEG
2325
if: runner.os == 'Linux'
2426
run: |
2527
sudo apt update
26-
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
28+
sudo apt-get install -y libopenjp2-7 libopenjp2-tools
2729
python -m pip install --upgrade pip
28-
- name: 🍎 Install OpenSlide & OpenJPEG
30+
- name: 🍎 Install OpenJPEG
2931
if: runner.os == 'macOS'
3032
run: |
31-
brew install openslide openjpeg
33+
brew install openjpeg
3234
python -m pip install --upgrade pip
3335
- name: 🪟 Install OpenJPEG
3436
if: runner.os == 'Windows'
@@ -43,47 +45,28 @@ jobs:
4345
make -j4
4446
make install
4547
make clean
46-
- name: 🪟 Install OpenSlide
47-
if: runner.os == 'Windows'
48-
run: |
49-
choco install wget --no-progress
50-
wget https://github.com/openslide/openslide-winbuild/releases/download/v20220811/openslide-win64-20220811.zip
51-
7z x openslide-win64-20220811.zip
52-
ls openslide-win64-20220811
53-
# Add to PATH
54-
echo "$(realpath ./openslide-win64-20220811/bin)" >> $GITHUB_PATH
55-
echo "$(realpath ./openslide-win64-20220811/lib)" >> $GITHUB_PATH
56-
# Install
57-
mkdir "C:\Program Files\openslide"
58-
Copy-Item -Path ".\openslide-win64-20220811\*" -Destination "C:\Program Files\openslide" -Recurse
59-
ls "C:/Program Files/openslide"
6048
- name: 🪟 Install SQLite Shell
6149
if: runner.os == 'Windows'
6250
run: choco install sqlite.shell --no-progress
6351
- name: SQLite Version Information
6452
run: |
6553
sqlite3 --version
6654
sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
67-
- name: OpenSlide Version Information
68-
if: runner.os == 'Linux'
69-
run: openslide-quickhash1sum --version
7055
- name: OpenJPEG Version Information
7156
continue-on-error: true # This -h option has exit code 1 for some reason
7257
run: opj_dump -h
7358
- name: pip Install From GitHub Repo on Linux and macOS
7459
if: runner.os != 'Windows'
75-
run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_REF_NAME}
60+
run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA}
7661
- name: pip Install From GitHub on Windows
7762
if: runner.os == 'Windows'
78-
run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_REF_NAME
79-
- name: Test TIAToolbox Import
63+
run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_SHA
64+
- name: Test Imports
8065
shell: python
8166
run: |
82-
import os
83-
if hasattr(os, "add_dll_directory"):
84-
# Required for Python>=3.8 on Windows
85-
with os.add_dll_directory(r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin"):
86-
import tiatoolbox
87-
else:
88-
os.environ["PATH"] = r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin;"
89-
import tiatoolbox
67+
import tiatoolbox
68+
print(tiatoolbox.__version__)
69+
import openslide
70+
print(openslide.__version__)
71+
import torch
72+
print(torch.__version__)

.github/workflows/python-package.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ jobs:
1717
strategy:
1818
fail-fast: true
1919
matrix:
20-
python-version: ["3.9", "3.10", "3.11", "3.12"]
20+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
25+
uses: actions/setup-python@v4
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies
2929
run: |
3030
sudo apt update
31-
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
31+
sudo apt-get install -y libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.11.8 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.14.3 pytest pytest-cov pytest-runner
3434
pip install -r requirements/requirements.txt
3535
- name: Cache tiatoolbox static assets
36-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3737
with:
3838
key: tiatoolbox-home-static
3939
path: ~/.tiatoolbox
@@ -42,8 +42,6 @@ jobs:
4242
echo "---SQlite---"
4343
sqlite3 --version
4444
sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
45-
echo "---Openslide---"
46-
openslide-quickhash1sum --version
4745
echo "---OpenJPEG---"
4846
opj_dump -h | head -n 5
4947
echo "---Python---"
@@ -78,6 +76,17 @@ jobs:
7876
coverage-file: coverage.xml
7977
dsn: ${{ secrets.DEEPSOURCE_DSN }}
8078
fail-ci-on-error: false
79+
- name: List tiatoolbox contents
80+
run: ls -lahR ~/.tiatoolbox
81+
- name: Delete Hugging Face cache for large models
82+
run: |
83+
find ~/.tiatoolbox/models -type f -size +250M -exec bash -c '
84+
for model_path; do
85+
model_name=$(basename "$model_path")
86+
cache_dir="$HOME/.tiatoolbox/models/.cache/huggingface/download"
87+
rm -vf "$cache_dir/${model_name}.lock" "$cache_dir/${model_name}.metadata"
88+
done
89+
' bash {} +
8190
8291
release:
8392
runs-on: ubuntu-24.04
@@ -86,10 +95,10 @@ jobs:
8695
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-release' || startsWith(github.ref, 'refs/tags/v')
8796

8897
steps:
89-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
9099

91100
- name: Set up Python 3.10
92-
uses: actions/setup-python@v3
101+
uses: actions/setup-python@v4
93102
with:
94103
python-version: '3.10'
95104
cache: 'pip'

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ repos:
2323
- mdformat-black
2424
- mdformat-myst
2525
- repo: https://github.com/executablebooks/mdformat
26-
rev: 0.7.22
26+
rev: 1.0.0
2727
hooks:
2828
- id: mdformat
2929
# Optionally add plugins
3030
additional_dependencies:
3131
- mdformat-gfm # GitHub flavoured markdown
3232
- mdformat-black # Black formatting for python verbatim blocks
3333
- repo: https://github.com/pre-commit/pre-commit-hooks
34-
rev: v5.0.0
34+
rev: v6.0.0
3535
hooks:
3636
- id: check-ast # Simply checks whether the files parse as valid Python.
3737
- id: fix-byte-order-marker # Removes utf-8 byte order marker.
@@ -60,7 +60,7 @@ repos:
6060
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst.
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
6262
# Ruff version.
63-
rev: v0.11.8
63+
rev: v0.14.3
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Before you submit a pull request, check that it meets these guidelines:
9898

9999
1. The pull request should include tests.
100100
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the pull request description.
101-
3. The pull request should work for Python 3.9, 3.10, 3.11, and 3.12, and for PyPy. Check https://github.com/TissueImageAnalytics/tiatoolbox/actions/workflows/python-package.yml and make sure that the tests pass for all supported Python versions.
101+
3. The pull request should work for Python 3.10, 3.11, 3.12 and 3.13, and for PyPy. Check https://github.com/TissueImageAnalytics/tiatoolbox/actions/workflows/python-package.yml and make sure that the tests pass for all supported Python versions.
102102

103103
Tips
104104
----

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Prepare a computer as a convenient platform for further development of the Pytho
106106
5. Create virtual environment for TIAToolbox using
107107

108108
```sh
109-
$ conda create -n tiatoolbox-dev python=3.9 # select version of your choice
109+
$ conda create -n tiatoolbox-dev python=3.10 # select version of your choice
110110
$ conda activate tiatoolbox-dev
111111
$ pip install -r requirements/requirements_dev.txt
112112
```

benchmarks/annotation_store.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
" capsize=capsize,\n",
356356
" **kwargs,\n",
357357
" )\n",
358-
" for i, (runs, c) in enumerate(zip(experiments, color)):\n",
358+
" for i, (runs, c) in enumerate(zip(experiments, color, strict=False)):\n",
359359
" plt.text(\n",
360360
" i,\n",
361361
" min(runs),\n",
@@ -2418,7 +2418,7 @@
24182418
" )\n",
24192419
" total = np.sum(counts)\n",
24202420
" frequencies = dict.fromkeys(range(256), 0)\n",
2421-
" for v, x in zip(values, counts):\n",
2421+
" for v, x in zip(values, counts, strict=False):\n",
24222422
" frequencies[v] = x / total\n",
24232423
" frequency_array = np.array(list(frequencies.values()))\n",
24242424
" epsilon = 1e-16\n",

benchmarks/annotation_store_alloc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def __exit__(self: memray, *args: object) -> None:
141141

142142
import numpy as np
143143
import psutil
144+
from shapely import affinity
144145
from shapely.geometry import Polygon
145146
from tqdm import tqdm
146147

@@ -188,8 +189,6 @@ def cell_polygon(
188189
round_coords (bool): Round coordinates to integers. Defaults to False.
189190
190191
"""
191-
from shapely import affinity
192-
193192
rand_state = np.random.default_rng().__getstate__()
194193
rng = np.random.default_rng(seed)
195194
if repeat_first:

docs/images/dual_win_reg.png

3.23 MB
Loading

0 commit comments

Comments
 (0)