Exemplo n.º 1
0
def test_image_open(wsi_file):
    TiffSlide(wsi_file)
Exemplo n.º 2
0
def test_image_open_incorrect_path():
    with pytest.raises(FileNotFoundError):
        TiffSlide("i-do-not-exist")
Exemplo n.º 3
0
def test_image_open_unsupported_image(tmp_path):
    f = tmp_path.joinpath("test_file.svs")
    f.write_text("123")
    with pytest.raises(TiffFileError):
        TiffSlide(f)
Exemplo n.º 4
0
def slide(wsi_file):
    yield TiffSlide(wsi_file)
Exemplo n.º 5
0
def test_image_detect_format(wsi_file):
    fmt = TiffSlide.detect_format(wsi_file)
    assert fmt is not None
    assert isinstance(fmt, str)
Exemplo n.º 6
0
def test_tiffslide_reject_unsupported_file():
    with pytest.raises(ValueError):
        TiffSlide(dict())  # type: ignore
Exemplo n.º 7
0
def test_tiffslide_from_fsspec_urlpath(wsi_file_urlpath):
    slide = TiffSlide(wsi_file_urlpath)
    _ = slide.get_thumbnail((200, 200))
Exemplo n.º 8
0
def test_tiffslide_from_fsspec_openfile(wsi_file_urlpath):
    of = fsspec.open(wsi_file_urlpath)
    slide = TiffSlide(of)
    _ = slide.get_thumbnail((200, 200))
Exemplo n.º 9
0
def test_tiffslide_from_fsspec_buffer(wsi_file_urlpath):
    with fsspec.open(wsi_file_urlpath) as f:
        slide = TiffSlide(f)
        _ = slide.get_thumbnail((200, 200))
Exemplo n.º 10
0
def ts_slide(file_name):
    from tiffslide import TiffSlide

    yield TiffSlide(file_name)