lazyslide.tl.virtual_stain#
- virtual_stain(wsi, model='rosie', image_key=None, tile_key='tiles', device=None, amp=None, autocast_dtype=None, batch_size=32, num_workers=0, pbar=True)#
Translate the H&E images to multiplexed images.
A new multi-channel image will be created and stored in the WSIData object. The marker name is recorded in the image channel names.
- Parameters:
- wsi
WSIData The whole-slide image data to work on.
- modelstr, default: “rosie”
The virtual staining model to use.
- image_keystr, default: None
The key to store the new image.
- tile_keystr, default: “tiles”
The key for the tile table.
- devicestr, default: None
Which device to use for inference. If None, the default device is used.
- ampbool, default: False
Whether to use automatic mixed precision.
- autocast_dtypetorch.dtype, default: torch.float16
The dtype for automatic mixed precision.
- batch_sizeint, default: 32
The batch size for inference.
- num_workersint, default: 0
The number of workers for data loading.
- pbarbool, default: True
If the progress bar should be shown.
- wsi
Examples
>>> import lazyslide as zs >>> wsi = zs.datasets.sample() >>> zs.tl.virtual_stain(wsi) >>> wsi.images["rosie_prediction"]