images
#
File parsers for images stored as zoom-level pyramids
- class DeepZoom(file: Path = None)[source]#
Represents a zoom-level image pyramid stored in DeepZoom format.
A DeepZoom image is a large image is subdivided into smaller tiles for various zoom levels, creating a “pyramid of tiles”. For given zoom level and region of interest, we then know how to quickly look up the data to be displayed, without having to rescale the original image.
This class reads and returns the meta data for the image, provides helper functions for working with dimensions, and loads and returns tiles. It doesn’t store pixel data in memory, but provides
load_tile()
to return it.Higher zoom means bigger picture. Zoom level 0 corresponds to the smallest available picture, zoomed out the most. There is typically only one tile at that level, though that depends on the settings used when the image pyramid was generated.
- file#
file with image meta data
- image_width#
width of the full image
- image_height#
height of the full image
- tile_width#
width of a single tile
- tile_height#
height of a single tile
- overlap#
pixel overlap between tiles
- tile_format#
file format of tile images
- zoom_levels#
available zoom levels, biggest to smallest
- zoom_min#
minimum available zoom level (smallest number)
- zoom_max#
maximum available zoom level (largest number)
- tile_x1(i, clip=False)[source]#
Returns the x-coordinate of the left edge of tiles number
i
.This includes the overlap pixels.
- tile_y1(j, clip=False)[source]#
Returns the y-coordinate of top edge of tiles number
j
.This includes the overlap pixels.
- tile_x2(i, zoom)[source]#
Returns the x-coordinate of the right edge of tiles number
i
.This includes the overlap pixels. The returned pixel index is actually one pixel beyond the edge, in anticipation of right-inclusive ranges.
- tile_y2(tile, zoom)[source]#
Returns the y-coordinate of the bottom edge of tiles number
j
.This includes the overlap pixels. The returned pixel index is actually one pixel beyond the edge, in anticipation of right-inclusive ranges.
- level_width(zoom)[source]#
Returns the width of the image at the given
zoom
level.Raises
ZoomError
if the zoom level doesn’t exist.