コード例 #1
0
ファイル: test_DatasetInfo.py プロジェクト: vibbits/ilastik
def test_h5_stack_via_star_file_glob_and_defined_inner_path(h5_stack_dir, empty_project_file: h5py.File):
    h5_external_star_glob = os.path.join(h5_stack_dir, "*.h5")
    internal_path = DatasetInfo.globInternalPaths(h5_external_star_glob, "*")[0]
    total_path = os.path.join(h5_stack_dir, "*.h5", internal_path)
    info = FilesystemDatasetInfo(filePath=total_path, sequence_axis="z", project_file=empty_project_file)
    assert info.nickname == "2d_apoptotic_binary_-volume-data"
    assert info.is_under_project_file()
コード例 #2
0
def test_stack_via_colon_glob(png_colon_path_stack,
                              empty_project_file: h5py.File):
    info = FilesystemDatasetInfo(filePath=png_colon_path_stack,
                                 sequence_axis="t",
                                 project_file=empty_project_file)
    assert info.nickname == "c_cells_"
    assert info.is_under_project_file()
コード例 #3
0
ファイル: test_DatasetInfo.py プロジェクト: vibbits/ilastik
def test_relative_paths(png_stack_dir: str, monkeypatch):
    with h5py.File(os.path.join(png_stack_dir, "myproj.ilp"), "w") as project_file:
        info = FilesystemDatasetInfo(
            filePath=os.path.join(png_stack_dir, "*.png"), project_file=project_file, sequence_axis="z"
        )
        assert info.is_under_project_file()
        assert info.get_relative_paths() == ["c_cells_0.png", "c_cells_1.png", "c_cells_2.png"]
コード例 #4
0
def test_star_glob(png_colon_path_stack: str, empty_project_file: h5py.File):
    info = FilesystemDatasetInfo(filePath=png_colon_path_stack,
                                 sequence_axis="z",
                                 project_file=empty_project_file)
    assert info.nickname == "c_cells_"
    assert info.laneDtype == numpy.uint8
    assert info.laneShape == (3, 520, 697, 3)
    assert info.is_under_project_file()
コード例 #5
0
def test_stack_via_star_glob(png_star_stack: str, empty_project_file):
    info = FilesystemDatasetInfo(filePath=png_star_stack,
                                 sequence_axis="z",
                                 project_file=empty_project_file)
    assert info.nickname == "c_cells_"

    # empty project lies in /tmp, so paths should be relative
    assert info.is_under_project_file()
コード例 #6
0
def test_create_using_paths_relative_to_project_file(png_stack_dir: str):
    with h5py.File(os.path.join(png_stack_dir, "myproj.ilp"),
                   "w") as project_file:
        info = FilesystemDatasetInfo(filePath="*.png",
                                     project_file=project_file,
                                     sequence_axis="z")
        assert info.get_relative_paths() == [
            "c_cells_0.png", "c_cells_1.png", "c_cells_2.png"
        ]
コード例 #7
0
def test_no_relative_paths_when_project_file_not_in_same_tree_as_files(
        png_stack_dir: str, monkeypatch):
    with h5py.File(os.path.join(tempfile.mkdtemp(), "myproj.ilp"),
                   "w") as project_file:
        info = FilesystemDatasetInfo(filePath=os.path.join(
            png_stack_dir, "*.png"),
                                     project_file=project_file,
                                     sequence_axis="z")
        assert not info.is_under_project_file()
コード例 #8
0
ファイル: test_DatasetInfo.py プロジェクト: vibbits/ilastik
def test_h5_stack_via_star_file_glob_and_stared_internal_path(h5_stack_dir, empty_project_file):
    star_glob = h5_stack_dir / "*.h5/*"
    info = FilesystemDatasetInfo(filePath=str(star_glob), sequence_axis="z", project_file=empty_project_file)
    assert info.nickname == "2d_apoptotic_binary_-volume-data"
    assert info.is_under_project_file()

    expected_filepath = os.path.pathsep.join(
        [
            Path(h5_stack_dir).joinpath("2d_apoptotic_binary_0.h5/volume/data").as_posix(),
            Path(h5_stack_dir).joinpath("2d_apoptotic_binary_1.h5/volume/data").as_posix(),
            Path(h5_stack_dir).joinpath("2d_apoptotic_binary_2.h5/volume/data").as_posix(),
        ]
    )

    assert info.filePath == expected_filepath
コード例 #9
0
ファイル: test_DatasetInfo.py プロジェクト: vibbits/ilastik
def test_guess_tags_for_singleton_axes(h5_1_100_200_1_1, empty_project_file):
    info = FilesystemDatasetInfo(
        filePath=h5_1_100_200_1_1,
        project_file=empty_project_file,
        axistags=vigra.defaultAxistags("yx"),
        guess_tags_for_singleton_axes=True,
        sequence_axis="z",
    )
    assert info.axiskeys[1:3] == "yx"
コード例 #10
0
def test_h5_stack_via_colon_glob(h5_colon_path_stack_with_inner_paths,
                                 empty_project_file):
    info = FilesystemDatasetInfo(filePath=h5_colon_path_stack_with_inner_paths,
                                 sequence_axis="t",
                                 project_file=empty_project_file)
    assert info.nickname == "2d_apoptotic_binary_-volume-data"