bipl


Namebipl JSON
Version 0.5.6 PyPI version JSON
download
home_pageNone
SummaryOpenslide/libtiff/GDAL ndarray-like interface and lazy parallel tile-based processing
upload_time2024-04-11 18:50:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT 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: Sequence[int] = slide.shape  # Native shape
downsamples: Sequence[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 crop 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.10",
    "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/0b/c4/fe83900424fc8d4e4549469702966472249e24ba61aa51bc3252c9b876a7/bipl-0.5.6.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: Sequence[int] = slide.shape  # Native shape\ndownsamples: Sequence[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 crop 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.5.6",
    "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": "4d8d7a6efce82822183447ba610762a2f752a7194c18971570d3da55024748ca",
                "md5": "d577d505b511e92100fc314778fa312e",
                "sha256": "0ef3139c3c4191cc9651127e99d6a08d9cdc898aa60a5a85b21f9ce9105f31ec"
            },
            "downloads": -1,
            "filename": "bipl-0.5.6-py3-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d577d505b511e92100fc314778fa312e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 4626889,
            "upload_time": "2024-04-11T18:50:55",
            "upload_time_iso_8601": "2024-04-11T18:50:55.918024Z",
            "url": "https://files.pythonhosted.org/packages/4d/8d/7a6efce82822183447ba610762a2f752a7194c18971570d3da55024748ca/bipl-0.5.6-py3-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bc4fe83900424fc8d4e4549469702966472249e24ba61aa51bc3252c9b876a7",
                "md5": "36a7e1f9df356a1d4907fe409d659763",
                "sha256": "57e7f54a768776c835bebe6b22d8fe0e037072219c006a1fc24b3a8d057c8480"
            },
            "downloads": -1,
            "filename": "bipl-0.5.6.tar.gz",
            "has_sig": false,
            "md5_digest": "36a7e1f9df356a1d4907fe409d659763",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 31990,
            "upload_time": "2024-04-11T18:50:58",
            "upload_time_iso_8601": "2024-04-11T18:50:58.222192Z",
            "url": "https://files.pythonhosted.org/packages/0b/c4/fe83900424fc8d4e4549469702966472249e24ba61aa51bc3252c9b876a7/bipl-0.5.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 18:50:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "arquolo",
    "github_project": "bipl",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "lcname": "bipl"
}
        
Elapsed time: 0.63267s