wsidata.accessors.iter.TileImage#

class TileImage(id, x, y, image, downsample=1.0, tissue_id=None, annot_mask=None, annot_shapes=None, annot_labels=None)#

Bases: object

The data container return by wsidata.iter.tile_images

Attributes:
idint

The tile id.

xint

The x-coordinate of the tile.

yint

The y-coordinate of the tile.

widthint

The width of the tile image.

heightint

The height of the tile image.

downsamplefloat

The downsample factor of the image relative to level 0.

tissue_idint

The tissue id.

imagenp.ndarray

The tile image.

annot_masknp.ndarray

The annotation mask.

annot_shapesarray of (Polygon, name, label)

The annotation shapes.

annot_labelsdict

The annotation labels mapping.

norm_annot_shapesarray of (Polygon, name, label)

The normalized annotation shapes, the coordinates are normalized to the 0-1 range.

has_annotbool

Whether the tile has annotation.

property has_annot#

Whether the tile has annotation.

property height#

The height of the tile image.

property norm_annot_shapes#

The normalized annotation shapes, the coordinates are normalized to the 0-1 range.

plot(ax=None, show_annots=True, palette=None, legend=True, alpha=0.3, linewidth=1, **kwargs)#

Plot the tile image.

Parameters:
axAxes

The axes to plot the image.

show_annotsbool

Whether to show the annotations.

palettedict

The palette for the annotation colors.

legendbool

Whether to show the legend.

alphafloat

The transparency of the annotation.

linewidthint

The width of the annotation line.

**kwargs

Additional keyword arguments for imshow.

property width#

The width of the tile image.