Skip to content

Commit 5df8121

Browse files
authored
Merge branch 'develop' into fix-dicom-reader
2 parents 9bf5951 + 6ecb9e9 commit 5df8121

File tree

9 files changed

+742
-48
lines changed

9 files changed

+742
-48
lines changed

.github/workflows/pip-install.yml

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ 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:
@@ -19,16 +21,16 @@ jobs:
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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
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
3333
python -m pip install ruff==0.11.8 pytest pytest-cov pytest-runner
3434
pip install -r requirements/requirements.txt
@@ -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---"

docs/installation.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ On Linux, the prerequisite software can be installed using the following command
1717

1818
.. code-block:: console
1919
20-
$ apt-get -y install libopenjp2-7-dev libopenjp2-tools openslide-tools
20+
$ apt-get -y install libopenjp2-7-dev libopenjp2-tools
2121
2222
The same command is used when working on the Colab or Kaggle platforms. When working on Google Colab, we remove the packages ``datascience`` and ``albumentations`` because they conflict and produce an error message.
2323

2424
Windows (10+)
2525
-------------
2626

27-
1. Download OpenSlide binaries from `this page <https://openslide.org/download/>`_. Extract the folder and add the ``bin`` and ``lib`` subdirectories to the Windows `system path <https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v=office.14)>`_. If you are using a conda environment, you can also copy the ``bin`` and ``lib`` subdirectories to ``[Anaconda Installation Path]/envs/[tiatoolbox-environment]/Library/``.
28-
29-
2. Install OpenJPEG. The easiest way to install OpenJPEG is through conda:
27+
On Windows, ``OpenJPEG`` can be installed using the following ``conda`` command:
3028

3129
.. code-block:: console
3230
@@ -45,14 +43,14 @@ Homebrew
4543

4644
.. code-block:: console
4745
48-
$ brew install openjpeg openslide
46+
$ brew install openjpeg
4947
5048
MacPorts
5149
^^^^^^^^
5250

5351
.. code-block:: console
5452
55-
$ port install openjpeg openslide
53+
$ port install openjpeg
5654
5755
Installing Stable Release
5856
=========================

requirements/requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
aiohttp>=3.8.1
44
albumentations>=1.3.0
55
bokeh>=3.1.1, <3.6.0
6-
Click>=8.1.3
6+
Click>=8.1.3, <8.2.0
77
defusedxml>=0.7.1
88
filelock>=3.9.0
99
flask>=2.2.2
@@ -16,7 +16,8 @@ matplotlib>=3.6.2
1616
numba>=0.57.0
1717
numpy>=1.23.5, <2.0.0
1818
opencv-python>=4.6.0
19-
openslide-python>=1.2.0
19+
openslide-bin>=4.0.0.2
20+
openslide-python>=1.4.0
2021
pandas>=2.0.0
2122
pillow>=9.3.0
2223
pydicom>=2.3.1 # Used by wsidicom
@@ -28,7 +29,7 @@ scipy>=1.8
2829
shapely>=2.0.0
2930
SimpleITK>=2.2.1
3031
sphinx>=5.3.0
31-
tifffile>=2022.10.10
32+
tifffile>=2022.10.10, <=2025.5.10
3233
timm>=1.0.3
3334
torch>=2.1.0
3435
torchvision>=0.15.0

tests/test_tileserver.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,3 +734,44 @@ def test_prop_range(app: TileServer) -> None:
734734
assert response.status_code == 200
735735
# should be back to no scaling
736736
assert layer.renderer.score_fn(0.5) == 0.5
737+
738+
739+
def test_healthcheck(empty_app: TileServer) -> None:
740+
"""Test the /tileserver/healthcheck endpoint."""
741+
with empty_app.test_client() as client:
742+
response = client.get("/tileserver/healthcheck")
743+
assert response.status_code == 200
744+
assert response.content_type == "application/json"
745+
assert response.get_json() == {"status": "OK"}
746+
747+
748+
def test_sessions_no_slide_loaded(empty_app: TileServer) -> None:
749+
"""Test /tileserver/sessions when no slides are loaded."""
750+
with empty_app.test_client() as client:
751+
setup_app(client)
752+
response = client.get("/tileserver/sessions")
753+
assert response.status_code == 200
754+
assert response.is_json
755+
assert response.get_json() == {}
756+
757+
758+
def test_sessions_one_slide_loaded(
759+
empty_app: TileServer, remote_sample: Callable
760+
) -> None:
761+
"""Test /tileserver/sessions after loading one slide."""
762+
with empty_app.test_client() as client:
763+
setup_app(client)
764+
slide_path = safe_str(remote_sample("svs-1-small"))
765+
766+
response = client.put(
767+
"/tileserver/slide",
768+
data={"slide_path": slide_path},
769+
)
770+
assert response.status_code == 200
771+
772+
response = client.get("/tileserver/sessions")
773+
assert response.status_code == 200
774+
sessions = response.get_json()
775+
776+
assert isinstance(sessions, dict)
777+
assert len(sessions) == 1

0 commit comments

Comments
 (0)