-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from fmi-faim/cellpose
- Loading branch information
Showing
5 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2023 Friedrich Miescher Institute for Biomedical Research (FMI), Basel (Switzerland) | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Required | ||
file_selection: # criteria for file selection in case of multiple channels/slices per position | ||
channel: C01 | ||
process: # choose method how to segment, filter, and sample the objects | ||
segment: cellpose | ||
filter: [] | ||
sample: centers | ||
|
||
# Each subsequent section provides arguments to one of the methods defined in 'process' | ||
cellpose: | ||
diameter: 10.0 | ||
pretrained_model: cyto2 | ||
cellprob_threshold: 0.0 | ||
flow_threshold: 0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# SPDX-FileCopyrightText: 2023 Friedrich Miescher Institute for Biomedical Research (FMI), Basel (Switzerland) | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
"""Test faim_wako_searchfirst module.""" | ||
import csv | ||
import shutil | ||
from pathlib import Path | ||
|
||
import pytest | ||
from faim_wako_searchfirst.main import run | ||
|
||
|
||
@pytest.fixture | ||
def _data_path(tmp_path): | ||
# copy test set into tmp_path, return resulting Path | ||
testset_path = Path("tests/resources/TestSet") | ||
assert testset_path.exists() | ||
return shutil.copytree(testset_path, tmp_path / "TestSet") | ||
|
||
|
||
def test_cellpose(_data_path): | ||
"""Test run with parameters defined in the sample config_cellpose.yml file.""" | ||
run(_data_path, configfile="config_cellpose.yml") | ||
csv_path = _data_path / "TestSet_D07_T0001F002L01A02Z01C01.csv" | ||
assert csv_path.exists() | ||
with open(csv_path, "r") as csv_file: | ||
reader = csv.reader(csv_file, quoting=csv.QUOTE_NONNUMERIC) | ||
entries = list(reader) | ||
assert len(entries) == 3, "Incorrect number of objects detected." | ||
assert entries[0] == pytest.approx([1, 40.5, 30.5]) | ||
assert entries[1] == pytest.approx([2, 158.5, 58.5]) | ||
assert entries[2] == pytest.approx([3, 79.5287, 146.4483]) | ||
|
||
segmentation_folder = _data_path.parent / (_data_path.name + "_segmentation") | ||
assert sum(1 for _ in segmentation_folder.glob("*")) == 1 |