Skip to content

Commit 6bf3dec

Browse files
authored
Bioimg package dependencies (#153)
* Testing automatic openslide-bin installation for all platforms * Remove unnecessary os conditions and readme * Remove unnecessary CI steps
1 parent 20d9adb commit 6bf3dec

File tree

5 files changed

+10
-72
lines changed

5 files changed

+10
-72
lines changed

.github/workflows/ci.yml

-19
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,6 @@ jobs:
3737
pre-commit
3838
pytest-cov
3939
pytest-mock
40-
41-
- name: Install openslide for non-Win
42-
run: |
43-
sudo apt install openslide-tools
44-
micromamba install openslide
45-
echo ${{ matrix.sys.os }}
46-
if: ${{ matrix.sys.os != 'windows-latest' }}
47-
48-
- name: Install openslide for Win
49-
run: |
50-
choco install wget --no-progress
51-
wget https://github.com/openslide/openslide-winbuild/releases/download/v20221217/openslide-win64-20221217.zip
52-
7z x openslide-win64-20221217.zip -oD:\openslide\
53-
mklink /D C:\openslide-win64\ D:\openslide\openslide-win64-20221217\
54-
cd C:\openslide-win64\
55-
dir
56-
set openslide_path=%cd%
57-
echo %openslide_path%
58-
if: ${{ matrix.sys.os == 'windows-latest' }}
5940
6041
- name: Run pre-commit hooks
6142
run: |

README.md

-22
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ Python package for:
2525
- [TileDB Cloud](https://cloud.tiledb.com) includes a built-in, pyramidal multi-resolution viewer: log in to TileDB Cloud to see an example image preview [here](https://cloud.tiledb.com/biomedical-imaging/TileDB-Inc/dbb7dfcc-28b3-40e5-916f-6509a666d950/preview)
2626
- Napari: https://github.com/TileDB-Inc/napari-tiledb-bioimg
2727

28-
## Installation Prerequisites
29-
30-
OpenSlide Python requires that OpenSlide be installed separately prior to its installation.
31-
32-
Prior to proceeding with the below installation instructions, please [install OpenSlide as recommended by the OpenSlide Python library](https://openslide.org/api/python/#:~:text=OpenSlide%20Python%20requires%20OpenSlide%2C%20which%20must%20be%20installed%20separately).
33-
3428
## Quick Installation
3529

3630
- From PyPI:
@@ -44,22 +38,6 @@ Prior to proceeding with the below installation instructions, please [install Op
4438

4539
pip install -e '.[full]'
4640

47-
## Windows Installation
48-
49-
After installing `Openslide` you should make sure that you create a link between your installation path and
50-
the following default path `C:\openslide-win64\ `.
51-
52-
```cmd
53-
mklink /D C:\openslide-win64\ [your-installation-path]\openslide-win64-20221217\
54-
```
55-
56-
You can install the latest versions of `Openslide` for windows using the pre-built packages
57-
found in the project's github page:
58-
`https://github.com/openslide/openslide-bin/releases`
59-
60-
or in their website:
61-
`https://openslide.org/download/`
62-
6341

6442
## Examples
6543
How to convert imaging data from standard biomedical formats to group of TileDB arrays.

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"write_to": "tiledb/bioimg/version.py",
1515
},
1616
install_requires=[
17+
"openslide-bin",
1718
"pyeditdistance",
1819
"tiledb>=0.19",
1920
"tqdm",
-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
import os
2-
from tiledb.bioimg import WIN_OPENSLIDE_PATH
31

4-
if hasattr(os, "add_dll_directory"):
5-
# Python >= 3.8 on Windows
6-
os.add_dll_directory(WIN_OPENSLIDE_PATH)

tiledb/bioimg/__init__.py

+9-26
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,22 @@
22
WHITE_RGB = 16777215 # FFFFFF in hex
33
WHITE_RGBA = 4294967295 # FFFFFFFF in hex
44
EXPORT_TILE_SIZE = 256
5-
WIN_OPENSLIDE_PATH = r"C:\openslide-win64\bin"
65

76
import importlib.util
8-
import os
97
import warnings
108
from typing import Optional
119
from .types import Converters
1210

1311
_osd_exc: Optional[ImportError]
14-
15-
if hasattr(os, "add_dll_directory"):
16-
# Python >= 3.8 on Windows
17-
with os.add_dll_directory(WIN_OPENSLIDE_PATH):
18-
try:
19-
importlib.util.find_spec("openslide")
20-
except ImportError as err_osd:
21-
warnings.warn(
22-
"Openslide Converter requires 'openslide-python' package. "
23-
"You can install 'tiledb-bioimg' with the 'openslide' or 'full' flag"
24-
)
25-
_osd_exc = err_osd
26-
else:
27-
_osd_exc = None
12+
try:
13+
importlib.util.find_spec("openslide")
14+
except ImportError as err_osd:
15+
warnings.warn(
16+
"Openslide Converter requires 'openslide-python' package. "
17+
"You can install 'tiledb-bioimg' with the 'openslide' or 'full' flag"
18+
)
19+
_osd_exc = err_osd
2820
else:
29-
try:
30-
importlib.util.find_spec("openslide")
31-
except ImportError as err_osd:
32-
warnings.warn(
33-
"Openslide Converter requires 'openslide-python' package. "
34-
"You can install 'tiledb-bioimg' with the 'openslide' or 'full' flag"
35-
)
36-
_osd_exc = err_osd
37-
else:
38-
_osd_exc = None
21+
_osd_exc = None
3922

4023
from .wrappers import *

0 commit comments

Comments
 (0)