Example #1
0
def images():
    image1 = ImageIOLoader().load(
        fname=Path(__file__).parent / "resources" / "images" / "1_mask.png"
    )[0]
    image2 = ImageIOLoader().load(
        fname=Path(__file__).parent / "resources" / "images" / "2_mask.png"
    )[0]
    return [image1, image2]
Example #2
0
def images():
    image1 = ImageIOLoader().load(
        fname=Path(__file__).parent / 'resources' / 'images' / '1_mask.png'
    )[0]
    image2 = ImageIOLoader().load(
        fname=Path(__file__).parent / 'resources' / 'images' / '2_mask.png'
    )[0]
    return [image1, image2]
Example #3
0
def test_image_io_loader():
    fname = Path(__file__).parent / 'resources' / 'images' / '1_mask.png'
    o = ImageIOLoader.load(fname=fname)
    assert o['path'] == fname
    assert o['img'].shape == (584, 565)

    with pytest.raises(FileLoaderError):
        non_image_fname = (Path(__file__).parent / 'resources' / 'csv' /
                           'algorithm_result.csv')
        ImageIOLoader.load(fname=non_image_fname)
Example #4
0
 def __init__(self):
     self._metrics_output = {}
     self._total_G = 0
     self._total_S = 0
     super().__init__(
         file_loader=ImageIOLoader(),
         validators=(
             NumberOfCasesValidator(num_cases=4),
             UniquePathIndicesValidator(),
             UniqueImagesValidator(),
         ),
         aggregates={
             "mean",
         },
     )
Example #5
0
def test_image_io_loader():
    fname = Path(__file__).parent / "resources" / "images" / "1_mask.png"
    loader = ImageIOLoader()
    o = loader.load(fname=fname)[0]
    img = loader.load_image(fname)
    assert o["path"] == fname
    assert o["hash"] == loader.hash_image(img)
    assert img.shape == (584, 565)

    with pytest.raises(FileLoaderError):
        non_image_fname = (Path(__file__).parent / "resources" / "csv" /
                           "algorithm_result.csv")
        ImageIOLoader().load(fname=non_image_fname)