https://github.com/bayer-group/tiffslide
TiffSlide - cloud native openslide-python replacement based on tifffile
Science Score: 46.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
2 of 7 committers (28.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
TiffSlide - cloud native openslide-python replacement based on tifffile
Basic Info
Statistics
- Stars: 103
- Watchers: 5
- Forks: 12
- Open Issues: 23
- Releases: 2
Topics
Metadata Files
README.md
tiffslide: a drop-in replacement for openslide-python
Welcome to tiffslide :wave:, a tifffile based
drop-in replacement for openslide-python.
tiffslide's goal is to provide an easy way to migrate existing code from an
openslide dependency to the excellently maintained tifffile module.
We strive to make your lives as easy as possible: If using tiffslide is
unintuitive, slow, or if it's drop-in behavior differs from what you expect,
it's a bug in tiffslide. Feel free to report any issues or feature requests in
the issue tracker!
Development happens on github :octocat:
Notes
TiffSlide aims to be compatible with all formats that openslide supports and more,
but not all are implemented yet. Aperio SVS is currently the most tested format.
Contributions to expand to a larger variety of file formats that tifffile supports are very welcome :heart:
If there are any questions open an issue, and we'll do our best to help!
Compatibility
Here's a list with currently supported formats.
| File Format | can be opened | full support | references | |----------------|:------------------:|:------------------:|-------------------------------------------------------------------------------| | Aperio SVS | :whitecheckmark: | :whitecheckmark: | | | Generic TIFF | :whitecheckmark: | :whitecheckmark: | | | Hamamatsu NDPI | :whitecheckmark: | :warning: | #35 | | Leica SCN | :whitecheckmark: | :whitecheckmark: | | | Ventana | :warning: | :warning: | #37 | | Hamamatsu VMS | :noentrysign: | :noentrysign: | | | DICOM | :noentrysign: | :noentrysign: | #32 | | Mirax | :noentrysign: | :noentrysign: | #33 | | Zeiss ZVI | :noentrysign: | :noentrysign: | |
Documentation
Installation
tiffslide's stable releases can be installed via pip:
bash
pip install tiffslide
Or via conda:
bash
conda install -c conda-forge tiffslide
Usage
tiffslide's behavior aims to be identical to openslide-python where it makes sense. If you rely heavily on the internals of openslide, this is not the package you are looking for. In case we add more features, we will add documentation here.
as a drop-in replacement
```python
directly
from tiffslide import TiffSlide slide = TiffSlide('path/to/my/file.svs')
or via its drop-in behavior
import tiffslide as openslide slide = openslide.OpenSlide('path/to/my/file.svs') ```
access files in the cloud
A nice side effect of using tiffslide is that your code will also work with filesystem_spec, which enables you to access your whole slide images from various supported filesystems:
```python import fsspec from tiffslide import TiffSlide
read from any io buffer
with fsspec.open("s3://my-bucket/file.svs") as f: slide = TiffSlide(f) thumb = slide.get_thumbnail((200, 200))
read from fsspec urlpaths directly, using your AWS_PROFILE 'aws'
slide = TiffSlide("s3://my-bucket/file.svs", storageoptions={'profile': 'aws'}) thumb = slide.getthumbnail((200, 200))
read via fsspec from google cloud and use fsspec's caching mechanism to cache locally
slide = TiffSlide("simplecache::gcs://my-bucket/file.svs", storageoptions={'project': 'my-project'}) region = slide.readregion((300, 400), 0, (512, 512)) ```
read numpy arrays instead of PIL images
Very often you'd actually want your region returned as a numpy array instead getting a PIL Image and then having to convert to numpy:
```python import numpy as np from tiffslide import TiffSlide
slide = TiffSlide("myfile.svs") arr = slide.readregion((100, 200), 0, (256, 256), asarray=True) assert isinstance(arr, np.ndarray) ```
Development Installation
If you want to help improve tiffslide, you can setup your development environment in two different ways:
With conda:
- Clone tiffslide
git clone https://github.com/bayer-science-for-a-better-life/tiffslide.git cd tiffslideconda env create -f environment.devenv.yml- Activate the environment
conda activate tiffslide
Without conda:
- Clone tiffslide
git clone https://github.com/bayer-science-for-a-better-life/tiffslide.git cd tiffslidepython -m venv venv && source venv/bin/activate && python -m pip install -U pippip install -e .[dev]
Note that in these environments tiffslide is already installed in development
mode, so go ahead and hack.
Benchmarks
Here are some benchmarks comparing tiffslide to openslide for different
supported file types and access patterns. Please note that you should test the
difference in access time always for yourself on your target machine and your
specific use case.
In case you would like a specific use case to be added, please feel free to open an issue or make a pull request.
The plots below were generated on a Thinkpad E495 and the files were stored on the
internal ssd.
Note, that in general, on my test my machine, tiffslide outperforms openslide
when reading data as numpy arrays. Ventana tile reading is not "correct"
since as of now (1.5.0) tiffslide lacks compositing for the overlapping tiles.
See the docs/README.md to run the benchmarks on your own machine.
reading PIL images

reading Numpy arrays

Contributing Guidelines
- Please follow pep-8 conventions but:
- We allow 120 character long lines (try anyway to keep them short)
- Please use numpy docstrings.
- When contributing code, please try to use Pull Requests.
- tests go hand in hand with modules on
testspackages at the same level. We usepytest.
You can setup your IDE to help you adhering to these guidelines.
(Santi is happy to help you setting up pycharm in 5 minutes)
Acknowledgements
Build with love by Andreas Poehlmann and Santi Villalba from the Machine Learning Research group at Bayer.
tiffslide: copyright 2020 Bayer AG, licensed under BSD
Owner
- Name: Bayer Open Source
- Login: Bayer-Group
- Kind: organization
- Website: https://bayer.com/
- Repositories: 98
- Profile: https://github.com/Bayer-Group
Science for a better life
GitHub Events
Total
- Create event: 3
- Release event: 3
- Issues event: 7
- Watch event: 15
- Delete event: 1
- Issue comment event: 11
- Push event: 4
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 6
Last Year
- Create event: 3
- Release event: 3
- Issues event: 7
- Watch event: 15
- Delete event: 1
- Issue comment event: 11
- Push event: 4
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 6
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Andreas Poehlmann | a****s@p****o | 343 |
| OneSixth | O****h | 20 |
| Erik O Gabrielsson | e****n@s****m | 5 |
| Christodoulidis Stergios | s****s@c****r | 5 |
| Santi Villalba | s****l@g****m | 3 |
| Jakub Kaczmarzyk | j****k@g****m | 2 |
| Sarthak Pati | s****i@p****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 14
- Total pull requests: 14
- Average time to close issues: 23 days
- Average time to close pull requests: 1 day
- Total issue authors: 8
- Total pull request authors: 4
- Average comments per issue: 5.57
- Average comments per pull request: 0.14
- Merged pull requests: 14
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 8
- Average time to close issues: 21 days
- Average time to close pull requests: 3 days
- Issue authors: 5
- Pull request authors: 3
- Average comments per issue: 3.2
- Average comments per pull request: 0.0
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- kaczmarj (5)
- ap-- (2)
- erikogabrielsson (2)
- swamidass (1)
- Songhao-LI (1)
- stergioc (1)
- sarthakpati (1)
- chengdonglin (1)
Pull Request Authors
- ap-- (8)
- kaczmarj (3)
- stergioc (2)
- erikogabrielsson (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 13,539 last-month
- Total docker downloads: 370
- Total dependent packages: 10
- Total dependent repositories: 1
- Total versions: 35
- Total maintainers: 1
pypi.org: tiffslide
tifffile-based drop-in replacement for openslide-python
- Homepage: https://github.com/Bayer-Group/tiffslide
- Documentation: https://tiffslide.readthedocs.io/
- License: New BSD License Copyright (c) 2020, Bayer AG All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: a. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. b. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. c. Neither the name of the tiffslide developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
Latest release: 2.5.1
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
- matplotlib *
- pandas *
- pytest-benchmark *