def test_get_num_images(): """ check if the get_num_images method works as expected """ # paired dir_paths = ["./data/test/nifti/paired/test"] name = "fixed_images" loader = NiftiFileLoader(dir_paths=dir_paths, name=name, grouped=False) got = loader.get_num_images() expected = 2 loader.close() assert got == expected # unpaired dir_paths = ["./data/test/nifti/unpaired/test"] name = "images" loader = NiftiFileLoader(dir_paths=dir_paths, name=name, grouped=False) got = loader.get_num_images() expected = 2 loader.close() assert got == expected # grouped dir_paths = ["./data/test/nifti/grouped/test"] name = "images" loader = NiftiFileLoader(dir_paths=dir_paths, name=name, grouped=True) got = loader.get_num_images() expected = 2 loader.close() assert got == expected # multi dirs dir_paths = [ "./data/test/nifti/grouped/train", "./data/test/nifti/grouped/test" ] name = "images" loader = NiftiFileLoader(dir_paths=dir_paths, name=name, grouped=True) got = loader.get_num_images() expected = 9 loader.close() assert got == expected
def test_get_num_images(): """ check if the get_num_images method works as expected """ dir_path = "./data/test/nifti/paired/test" name = "fixed_images" loader = NiftiFileLoader(dir_path=dir_path, name=name, grouped=False) got = int(loader.get_num_images()) expected = int(2) loader.close() assert got == expected