Skip to content

Commit 8d65894

Browse files
committed
DeepZoomGenerator: Add methods to get tile coordinates and dimensions
1 parent 3fb155d commit 8d65894

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

openslide/deepzoom.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,25 @@ def _l_from_z(self, level, z):
178178
def _z_from_t(self, t):
179179
return self._z_t_downsample * t
180180

181+
def get_tile_coordinates(self, level, address):
182+
"""Return the OpenSlide.read_region() arguments for the specified tile.
183+
184+
Most users should call get_tile() rather than calling
185+
OpenSlide.read_region() directly.
186+
187+
level: the Deep Zoom level.
188+
address: the address of the tile within the level as a (col, row)
189+
tuple."""
190+
return self._get_tile_info(level, address)[0]
191+
192+
def get_tile_dimensions(self, level, address):
193+
"""Return a (pixels_x, pixels_y) tuple for the specified tile.
194+
195+
level: the Deep Zoom level.
196+
address: the address of the tile within the level as a (col, row)
197+
tuple."""
198+
return self._get_tile_info(level, address)[1]
199+
181200
def get_dzi(self, format):
182201
"""Return a string containing the XML metadata for the .dzi file.
183202

0 commit comments

Comments
 (0)