Example #1
0
def test_image_open(wsi_file):
    TiffSlide(wsi_file)
Example #2
0
def test_image_open_incorrect_path():
    with pytest.raises(FileNotFoundError):
        TiffSlide("i-do-not-exist")
Example #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)
Example #4
0
def slide(wsi_file):
    yield TiffSlide(wsi_file)
Example #5
0
def test_image_detect_format(wsi_file):
    fmt = TiffSlide.detect_format(wsi_file)
    assert fmt is not None
    assert isinstance(fmt, str)
Example #6
0
def test_tiffslide_reject_unsupported_file():
    with pytest.raises(ValueError):
        TiffSlide(dict())  # type: ignore
Example #7
0
def test_tiffslide_from_fsspec_urlpath(wsi_file_urlpath):
    slide = TiffSlide(wsi_file_urlpath)
    _ = slide.get_thumbnail((200, 200))
Example #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))
Example #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))
Example #10
0
def ts_slide(file_name):
    from tiffslide import TiffSlide

    yield TiffSlide(file_name)