wsidata.IterAccessor#
- class IterAccessor(obj)#
Bases:
objectAn accessor to iterate over the WSI data.
Usage:
wsidata.iterThe iter accessor will return a data container, you can access the data within container using attributes. All container has
.plot()method to visualize its content.- tile_images(key, color_norm=None, format='yxc', image_size=None, annot_key=None, annot_names=None, annot_labels=None, mask_dtype=None, shuffle=False, sample_n=None, seed=0)#
Extract tile images from the WSI.
- Parameters:
- keystr
The tile key.
- color_normstr, {“macenko”, “reinhard”}, default: None
Color normalization method.
- formatstr, {“yxc”, “cyx”}, default: “yxc”
The channel format of the image.
- image_sizeint or tuple of (int, int), optional
The desired output image size. If tile_spec exists, this overrides the output size. If tile_spec does not exist, this is used when deriving tiles from shapes on the fly.
- annot_keystr, default: None
The key to the annotation table in shapes slot.
- annot_namesstr or array of str, default: None
The name of the annotation column in the annotation table or a list of names.
- annot_labelsstr or dict, default: None
The name of the label column in the annotation table or a dictionary of label mappings.
- mask_dtypenp.dtype, default: np.uint8
The data type of the annotation mask, if you have annotation labels more than 255, consider using data type with higher bound.
- shufflebool, default: False
If True, return tile images in random order.
- sample_nint, default: None
The number of samples to return.
- seedint, default: 0
The random seed.
- Returns:
- tissue_contours(key, shuffle=False, seed=0)#
A generator to extract tissue contours from the WSI.
- Parameters:
- keystr
The tissue key.
- shufflebool, default: False
If True, return tissue contour in random order.
- seedint, default: 0
- Returns:
- tissue_images(key, level=-1, mask_bg=False, color_norm=None, format='yxc', shuffle=False, seed=0, image_size=None)#
Extract tissue images from the WSI.
- Parameters:
- keystr
The tissue key.
- levelint, default: 0
The level to extract the tissue images.
- mask_bgbool | int, default: False
Mask the background with the given value.
If False, the background is not masked.
If True, the background is masked with 0.
If an integer, the background is masked with the given value.
- color_normstr, {“macenko”, “reinhard”}, default: None
Color normalization method.
- formatstr, {“yxc”, “cyx”}, default: “yxc”
The channel format of the image.
- Returns: