wsidata.open_wsi#
- open_wsi(wsi, store='auto', reader=None, scene=None, attach_images=False, image_key=None, save_images=False, attach_thumbnail=False, thumbnail_key='wsi_thumbnail', thumbnail_size=2000, save_thumbnail=False, **kwargs)#
Open a whole slide image.
You can attach the whole slide image, and a thumbnail, a downsampled version of it, to the SpatialData object. Neither is attached by default. Attached images are written to the store only with
save_imagesorsave_thumbnail, so that writing does not copy the slide.- Parameters:
- wsistr or Path or SpatialData
The path to whole slide image, or an existing SpatialData object. When passing a SpatialData object,
image_keymust be provided.- storestr, optional
The backed file path, by default will create a zarr file with the same name as the slide file. You can either supply a file path or a directory. A path ending in
.zarr, or an existing zarr store, is the store. Any other path is a directory, created when the store is written, and the zarr file is created in it:store="data"keeps the store ofslide.svsatdata/slide.zarr. This is useful when you want to store all zarr files in a specific location. The store of a slide of another shape raises a ValueError. PassNoneto skip persistence (no zarr store will be set).- readerstr, optional
Reader to use, by default
None. PassingNoneenables automatic reader selection. To check avaiable readers: print(wsidata.READERS)- sceneint, optional
Zero-based scene to open. By default, each reader selects its primary image.
- attach_imagesbool, optional, default: False
Whether to attach whole slide image to image slot in the spatial data object.
- image_keystr, optional
The key to store the whole slide image, by default “wsi”. If the wsi is a SpatialData object, the image from this key will be used as the whole slide image.
- save_imagesbool, optional, default: False
Whether to save the whole slide image to on the disk. Only used by
WSIData.write().- attach_thumbnailbool, optional, default: False
Whether to attach thumbnail to image slot in the spatial data object.
- thumbnail_keystr, optional
The key to store the thumbnail, by default “wsi_thumbnail”.
- thumbnail_sizeint, optional, default: 2000
The size of the thumbnail.
- save_thumbnailbool, optional, default: False
Whether to save the thumbnail to on the disk. Only used by
WSIData.write().- **kwargs
Passed to the reader, for example
cache_sizefor isyntax ormemorizefor bioformats. Ignored whenwsiis a SpatialData object.
- Returns:
WSIDataWhole slide image data.
Examples
>>> from wsidata import open_wsi >>> wsi = open_wsi("slide.svs")