Name | bipl JSON |
Version |
0.6.1
JSON |
| download |
home_page | None |
Summary | Openslide/libtiff/GDAL ndarray-like interface and lazy parallel tile-based processing |
upload_time | 2024-11-11 16:06:33 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.12 |
license | MIT License Copyright (c) 2019 Paul Maevskikh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
aperio
batch
bigtiff
gdal
geotiff
hamamatsu
images
lazy
libtiff
medical
mrxs
ndpi
openslide
osgeo
parallel
pathology
processing
pyramid
slide
svs
tiff
tile
whole-slide
wsi
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# BIPL is a Big Image Python Library
Library to read big pyramidal images like in formats like BigTiff, Aperio SVS, Leica MRXS.
## `bipl.Slide` - ndarray-like reader for multiscale images (svs, tiff, etc...)
<details>
```python
import numpy as np
from bipl import Slide
slide = Slide.open('test.svs')
shape: tuple[int, ...] = slide.shape # Native shape
downsamples: tuple[int, ...] = slide.downsamples # List of pre-existing sub-resolution levels
# Get native miniature
tmb: np.ndarray = slide.thumbnail()
mpp: float = slide.mpp # X um per pixel, native resolution
image: np.ndarray = slide[:2048, :2048] # Get numpy.ndarray of 2048x2048 from full resolution
MPP = 16. # Let's say we want slide at 16 um/px resolution
downsample = MPP / slide.mpp
mini = slide.pool(downsample) # Gives `downsample`-times smaller image
mini = slide.resample(MPP) # Gives the same result
# Those ones trigger ndarray conversion
image: np.ndarray
image = mini[:512, :512] # Take a part of
image = mini.numpy() # Take a whole resolution level
image = np.array(mini, copy=False) # Use __array__ API
```
</details>
## `bipl.Mosaic` - apply function for each tile of big image on desired scale.
<details>
```python
import numpy as np
from bipl import Mosaic, Slide
m = Mosaic(step=512, overlap=0) # Read at [0:512], [512:1024], ...
# Open slide at 1:1 scale
s = Slide.open('test.svs')
# Target at 4 um/px resolution
# If `test.svs` has some pyramid in it (i.e. 1:1, 1:4, 1:16), it will be used to speed up reads.
s4 = s.resample(mpp=4.0)
# Get iterator over tiles.
# Reads will be at [0:512], [512:1024] ... @ MPP
tiles = m.iterate(s4)
# Read only subset of tiles according to binary mask (1s are read, 0s are not).
# `s4.shape * scale = mask.shape`, `scale <= 1`
tiles = tiles.select(mask, scale)
# Read all data, trigger I/O. All the previous calls do not trigger any disk reads beyond metadata.
images: list[np.ndarray] = [*tiles]
```
</details>
## Installation
```bash
pip install bipl
```
bipl is compatible with: Python 3.10+.
Tested on ArchLinux, Ubuntu 20.04/22.04, Windows 10/11.
Raw data
{
"_id": null,
"home_page": null,
"name": "bipl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": "Paul Maevskikh <arquolo@gmail.com>",
"keywords": "aperio, batch, bigtiff, gdal, geotiff, hamamatsu, images, lazy, libtiff, medical, mrxs, ndpi, openslide, osgeo, parallel, pathology, processing, pyramid, slide, svs, tiff, tile, whole-slide, wsi",
"author": null,
"author_email": "Paul Maevskikh <arquolo@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/c5/fe7d1b3923d5ab316d432cdd634eebf3b45b67059bec9a7dbe940cbd9656/bipl-0.6.1.tar.gz",
"platform": null,
"description": "# BIPL is a Big Image Python Library\n\nLibrary to read big pyramidal images like in formats like BigTiff, Aperio SVS, Leica MRXS.\n\n## `bipl.Slide` - ndarray-like reader for multiscale images (svs, tiff, etc...)\n<details>\n\n```python\nimport numpy as np\nfrom bipl import Slide\n\nslide = Slide.open('test.svs')\nshape: tuple[int, ...] = slide.shape # Native shape\ndownsamples: tuple[int, ...] = slide.downsamples # List of pre-existing sub-resolution levels\n\n# Get native miniature\ntmb: np.ndarray = slide.thumbnail()\n\nmpp: float = slide.mpp # X um per pixel, native resolution\nimage: np.ndarray = slide[:2048, :2048] # Get numpy.ndarray of 2048x2048 from full resolution\n\nMPP = 16. # Let's say we want slide at 16 um/px resolution\ndownsample = MPP / slide.mpp\nmini = slide.pool(downsample) # Gives `downsample`-times smaller image\nmini = slide.resample(MPP) # Gives the same result\n\n# Those ones trigger ndarray conversion\nimage: np.ndarray\nimage = mini[:512, :512] # Take a part of\nimage = mini.numpy() # Take a whole resolution level\nimage = np.array(mini, copy=False) # Use __array__ API\n```\n</details>\n\n## `bipl.Mosaic` - apply function for each tile of big image on desired scale.\n<details>\n\n```python\nimport numpy as np\nfrom bipl import Mosaic, Slide\n\nm = Mosaic(step=512, overlap=0) # Read at [0:512], [512:1024], ...\n\n# Open slide at 1:1 scale\ns = Slide.open('test.svs')\n\n# Target at 4 um/px resolution\n# If `test.svs` has some pyramid in it (i.e. 1:1, 1:4, 1:16), it will be used to speed up reads.\ns4 = s.resample(mpp=4.0)\n\n# Get iterator over tiles.\n# Reads will be at [0:512], [512:1024] ... @ MPP\ntiles = m.iterate(s4)\n\n# Read only subset of tiles according to binary mask (1s are read, 0s are not).\n# `s4.shape * scale = mask.shape`, `scale <= 1`\ntiles = tiles.select(mask, scale)\n\n# Read all data, trigger I/O. All the previous calls do not trigger any disk reads beyond metadata.\nimages: list[np.ndarray] = [*tiles]\n```\n</details>\n\n## Installation\n\n```bash\npip install bipl\n```\nbipl is compatible with: Python 3.10+.\nTested on ArchLinux, Ubuntu 20.04/22.04, Windows 10/11.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2019 Paul Maevskikh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Openslide/libtiff/GDAL ndarray-like interface and lazy parallel tile-based processing",
"version": "0.6.1",
"project_urls": {
"homepage": "https://github.com/arquolo/bipl",
"repository": "https://github.com"
},
"split_keywords": [
"aperio",
" batch",
" bigtiff",
" gdal",
" geotiff",
" hamamatsu",
" images",
" lazy",
" libtiff",
" medical",
" mrxs",
" ndpi",
" openslide",
" osgeo",
" parallel",
" pathology",
" processing",
" pyramid",
" slide",
" svs",
" tiff",
" tile",
" whole-slide",
" wsi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1fe8ecff15eeff7cd00c71b9169af9d720d0e2c2fff6414a2b9d51dfbb7c0289",
"md5": "3cf7b955bad21f2a39abbc0e3c8d7b24",
"sha256": "1b6d50738148cbd6148917e3649575f9a913f2ec02b1f0eb6b49f1ee3c223970"
},
"downloads": -1,
"filename": "bipl-0.6.1-py3-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "3cf7b955bad21f2a39abbc0e3c8d7b24",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 4635107,
"upload_time": "2024-11-11T16:06:30",
"upload_time_iso_8601": "2024-11-11T16:06:30.900758Z",
"url": "https://files.pythonhosted.org/packages/1f/e8/ecff15eeff7cd00c71b9169af9d720d0e2c2fff6414a2b9d51dfbb7c0289/bipl-0.6.1-py3-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a9c5fe7d1b3923d5ab316d432cdd634eebf3b45b67059bec9a7dbe940cbd9656",
"md5": "32d304ba454d888859da50ec11b4fdc3",
"sha256": "adef25f1bc9cf138a1fcf69137a9914999b0c1aa811cfd876841878da722cdf6"
},
"downloads": -1,
"filename": "bipl-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "32d304ba454d888859da50ec11b4fdc3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 39144,
"upload_time": "2024-11-11T16:06:33",
"upload_time_iso_8601": "2024-11-11T16:06:33.361281Z",
"url": "https://files.pythonhosted.org/packages/a9/c5/fe7d1b3923d5ab316d432cdd634eebf3b45b67059bec9a7dbe940cbd9656/bipl-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-11 16:06:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arquolo",
"github_project": "bipl",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"lcname": "bipl"
}