Пример #1
0
def test_save_cell_images(tmp_path):
    cells = segment_cells(locate_module_and_cells(datasets.poly10x6(1)[0]))
    save_images(tmp_path, cells)

    for cell in cells:
        p = tmp_path / "{}_row{:02d}_col{:02d}{}".format(
            cell.path.stem, cell.row, cell.col, cell.path.suffix)
        img_read = read_module_image(p, EL_IMAGE)
Пример #2
0
def _prepare_stitching_test_img():
    image = datasets.poly10x6(1)[0].data.T[:, :1930]
    height = image.shape[0]
    width = image.shape[1]

    img0 = Image(image[600:, 0:int(width * 2 // 3)])
    img1 = Image(image[600:, int(width // 3):])
    return img0, img1
Пример #3
0
def test_save_images_filename_hook(tmp_path: Path):
    cells = segment_cells(locate_module_and_cells(datasets.poly10x6(1)[0]))
    hook = lambda x: "{}_{:02d}{:02d}{}".format(x.path.stem, x.row, x.col, x.
                                                path.suffix)
    save_images(tmp_path, cells)

    for cell in cells:
        p = tmp_path / "{}_{:02d}{:02d}{}".format(cell.path.stem, cell.row,
                                                  cell.col, cell.path.suffix)
        # try read
        img_read = read_module_image(p, EL_IMAGE)
Пример #4
0
def test_single_segmentation():
    # load images
    img = datasets.poly10x6(N=1)[0]

    # perform detection
    module = locate_module_and_cells(img)

    # check result
    assert module.has_meta("transform")

    # check that show result does not fail
    module.show()

    # perform segmentation into cells
    cells = segment_cells(module)

    # check
    assert len(cells) == 60
Пример #5
0
def test_save_and_read_image(tmp_path):
    img = datasets.poly10x6(1)[0]
    save_image(tmp_path / "img.tif", img)
    img_read = read_module_image(tmp_path / "img.tif", EL_IMAGE)
    assert np.linalg.norm(img.data.flatten() - img_read.data.flatten()) == 0
Пример #6
0
def test_save_image_with_visualization(tmp_path: Path):
    img = datasets.poly10x6(1)[0]
    p = tmp_path / "img.pdf"
    save_image(p, img, with_visusalization=True)
    assert p.is_file()
Пример #7
0
def test_save_image_sequence(tmp_path):
    seq = datasets.poly10x6(5)
    save_images(tmp_path, seq)

    for img in seq:
        img_read = read_module_image(tmp_path / img.path.name, EL_IMAGE)