wsic
wsic copied to clipboard
Generic tiled TIF to SVS. Could not serialize DataArray
- wsic version: 0.9.0
- Python version: 3.11.5
- Operating System: Windows 11
Description
Hi, thanks for the tool. I am testing Generic tiled tiff to SVS with command line. Image sample from here: https://openslide.cs.cmu.edu/download/openslide-testdata/Generic-TIFF/
What I Did
wsic convert -i CMU-1.tiff -o CMU-1-1-out.svs -c jpeg --overwrite
Output
TypeError: ('Could not serialize object of type DataArray', "<xarray.DataArray '0' (Y: 32914, X: 46000, C: 3)>\ndask.array<astype, shape=(32914, 46000, 3), dtype=uint8, chunksize=(256, 256, 3), chunktype=numpy.ndarray>\nDimensions without coordinates: Y, X, C")
Additionally
Tried:
import os
import wsic
from pathlib import Path
OPENSLIDE_PATH = r'D:\001-setup-files\openslide-win64-20231011\bin'
if hasattr(os, 'add_dll_directory'):
# Windows
with os.add_dll_directory(OPENSLIDE_PATH):
import openslide
else:
import openslide
if __name__ == '__main__':
rootpath = Path(r"D:\wsi")
dataset = "CMU-1-1"
reader = wsic.readers.TIFFReader(rootpath.joinpath(dataset+".tiff"))
writer = wsic.writers.SVSWriter(
rootpath.joinpath(dataset+"-out.svs"),
tile_size=(256, 256, 3),
compression="jpeg",
compression_level=90,
overwrite=True,
ome=False,
app_mag=None,
shape=reader.shape
)
writer.copy_from_reader(reader, read_tile_size=(
256, 256), num_workers=32, timeout=30.0)
Throws same:
TypeError: ('Could not serialize object of type DataArray', "<xarray.DataArray '0' (Y: 32914, X: 46000, C: 3)>\ndask.array<astype, shape=(32914, 46000, 3), dtype=uint8, chunksize=(256, 256, 3), chunktype=numpy.ndarray>\nDimensions without coordinates: Y, X, C")
If I replace reader,
reader = wsic.readers.OpenSlideReader(rootpath.joinpath(dataset+".tiff"))
Now it throws:
RuntimeError: cannot schedule new futures after interpreter shutdown
What might be the issue, how to solve this?