From 3e75afb1750be546cf2926a84bcee94440364f0a Mon Sep 17 00:00:00 2001
From: Benjamin Gilbert An open whole-slide image. If any operation on the object fails, Return a string describing the format vendor of the specified file.
This string is also accessible via the If the file is not recognized, return If the file is not recognized, return filename – the file to examineBasic usage
OpenSlide objects¶
OpenSlideError is raised.
OpenSlide has latching error semantics: once OpenSlideError is
@@ -113,11 +113,11 @@ Basic usage
PROPERTY_NAME_VENDOR
property.None.None.
Basic usagelevel_count - 1 (lowest resolution).
k.
@@ -167,7 +167,7 @@ k.
@@ -176,12 +176,12 @@ Metadata about the slide, in the form of a
-Mapping from OpenSlide property name to
+Mapping from OpenSlide property name to
property value. OpenSlide provides some Standard properties,
plus additional properties that vary by slide format.
Images, such as label or macro images, which are associated with this
-slide. This is a Mapping from image
-name to RGBA Image.
Mapping from image
+name to RGBA Image.
Unlike in the C interface, these images are not premultiplied.
The embedded color profile for this slide,
-or None if not available.
None if not available.
ImageCmsProfile | None
+ImageCmsProfile | None
Return an RGBA Image containing the contents of
+read_region(location: tuple[int, int], level: int, size: tuple[int, int]) Image¶
+
Return an RGBA Image containing the contents of
the specified region.
Unlike in the C interface, the image data is not premultiplied.
Return the best level for displaying the given downsample.
Return an Image containing an RGB thumbnail of the
+get_thumbnail(size: tuple[int, int]) Image¶
+
Return an Image containing an RGB thumbnail of the
slide.
Use the specified OpenSlideCache to store recently decoded
slide tiles. By default, the OpenSlide has a private cache
with a default size.
Close the OpenSlide object.
bytes object in
-Image.info['icc_profile']. If no
+a bytes object in
+Image.info['icc_profile']. If no
profile is available, the icc_profile dictionary key is absent.
To include the profile in an image file when saving the image to disk:
image.save(filename, icc_profile=image.info.get('icc_profile'))
To perform color conversions using the profile, import it into
-ImageCms. For example, to synthesize an sRGB profile
+ImageCms. For example, to synthesize an sRGB profile
and use it to transform an image for display, with the default rendering
intent of the image’s profile:
from io import BytesIO
@@ -310,8 +310,8 @@ Basic usageOpenSlide.color_profile, already parsed into an
-ImageCmsProfile object. You can save processing time
-by building an ImageCmsTransform for the slide and
+ImageCmsProfile object. You can save processing time
+by building an ImageCmsTransform for the slide and
reusing it for multiple slide regions:
toProfile = ImageCms.createProfile('sRGB')
intent = ImageCms.getDefaultIntent(slide.color_profile)
@@ -327,7 +327,7 @@ Basic usage¶
-
-class openslide.OpenSlideCache(capacity: int)¶
+class openslide.OpenSlideCache(capacity: int)¶
An in-memory tile cache.
Tile caches can be attached to one or more OpenSlide objects
with OpenSlide.set_cache() to cache recently-decoded tiles. By
@@ -425,7 +425,7 @@
Caching¶
Exceptions¶
-
-exception openslide.OpenSlideError¶
+exception openslide.OpenSlideError¶
An error produced by the OpenSlide library.
Once OpenSlideError has been raised by a particular
OpenSlide, all future operations on that OpenSlide
@@ -435,14 +435,14 @@
Exceptions
-
-exception openslide.OpenSlideUnsupportedFormatError¶
+exception openslide.OpenSlideUnsupportedFormatError¶
OpenSlide does not support the requested file. Subclass of
OpenSlideError.
-
-exception openslide.OpenSlideVersionError¶
+exception openslide.OpenSlideVersionError¶
This version of OpenSlide does not support the requested functionality.
Subclass of OpenSlideError.
@@ -453,28 +453,28 @@ ExceptionsWrapping a Pillow Image¶
-
-class openslide.AbstractSlide¶
+class openslide.AbstractSlide¶
The abstract base class of OpenSlide and ImageSlide.
-
-class openslide.ImageSlide(file: str | bytes | PathLike[Any] | Image)¶
-A wrapper around an Image object that provides an
+class openslide.ImageSlide(file: str | bytes | PathLike[Any] | Image)¶
+
A wrapper around an Image object that provides an
OpenSlide-compatible API.
-
-openslide.open_slide(filename: str | bytes | PathLike[Any]) OpenSlide | ImageSlide¶
+openslide.open_slide(filename: str | bytes | PathLike[Any]) OpenSlide | ImageSlide¶
Return an OpenSlide for whole-slide images and an
ImageSlide for other types of images.
@@ -500,7 +500,7 @@ Exceptions
-
-class openslide.deepzoom.DeepZoomGenerator(osr: AbstractSlide, tile_size: int = 254, overlap: int = 1, limit_bounds: bool = False)¶
+class openslide.deepzoom.DeepZoomGenerator(osr: AbstractSlide, tile_size: int = 254, overlap: int = 1, limit_bounds: bool = False)¶
A Deep Zoom generator that wraps an OpenSlide object,
ImageSlide object, or user-provided instance of
AbstractSlide.
@@ -512,7 +512,7 @@ Exceptionstile_size + 2 * overlap should be a power of two.
overlap – the number of extra pixels to add to each interior edge of a
tile
-limit_bounds – True to render only the non-empty slide region
+limit_bounds – True to render only the non-empty slide region
@@ -522,7 +522,7 @@ Exceptions
- Type:
--
+
-
@@ -533,7 +533,7 @@ Exceptions
- Type:
--
+
-
@@ -545,7 +545,7 @@ Exceptionslevel_tiles[k] are the tile counts of level k.
@@ -557,14 +557,14 @@ Exceptionslevel_dimensions[k] are the dimensions of level k.
-
-get_dzi(format: str) str¶
+get_dzi(format: str) str¶
Return a string containing the XML metadata for the Deep Zoom .dzi
file.
@@ -577,8 +577,8 @@ Exceptions
-
-get_tile(level: int, address: tuple[int, int]) Image¶
-Return an RGB Image for a tile.
+get_tile(level: int, address: tuple[int, int]) Image¶
+Return an RGB Image for a tile.
- Parameters:
@@ -592,7 +592,7 @@ Exceptions
-
-get_tile_coordinates(level: int, address: tuple[int, int]) tuple[tuple[int, int], int, tuple[int, int]]¶
+get_tile_coordinates(level: int, address: tuple[int, int]) tuple[tuple[int, int], int, tuple[int, int]]¶
Return the OpenSlide.read_region() arguments corresponding to the
specified tile.
Most applications should use get_tile() instead.
@@ -609,7 +609,7 @@ Exceptions
-
-get_tile_dimensions(level: int, address: tuple[int, int]) tuple[int, int]¶
+get_tile_dimensions(level: int, address: tuple[int, int]) tuple[int, int]¶
Return a (pixels_x, pixels_y) tuple for the specified tile.
- Parameters:
@@ -745,13 +745,13 @@ This Page