-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into public/main
- Loading branch information
Showing
33 changed files
with
1,456 additions
and
208 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include README.md | ||
include LICENSE | ||
include ultrack/widgets/ultrackwidget/resources/*.json | ||
recursive-include ultrack/widgets/ultrackwidget/resources *.json |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ channels: | |
dependencies: | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- pip | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ channels: | |
dependencies: | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- napari | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ channels: | |
dependencies: | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- pip | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ dependencies: | |
- cellpose | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- pip | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ channels: | |
dependencies: | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- pyqt | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ channels: | |
dependencies: | ||
- coin-or-cbc | ||
- cucim | ||
- cupy!=13.0.* | ||
- cupy!=13.* | ||
- gurobi | ||
- jupyter | ||
- pip | ||
|
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
from ultrack.api.database import Experiment, ExperimentStatus | ||
from ultrack.api.main import start_server | ||
from ultrack.api.database import Experiment | ||
from ultrack.api.database import ExperimentStatus |
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
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,57 @@ | ||
from typing import Tuple | ||
|
||
import numpy as np | ||
import pytest | ||
from sqlalchemy import create_engine | ||
from sqlalchemy.orm import Session | ||
|
||
from ultrack import MainConfig, add_new_node | ||
from ultrack.core.database import LinkDB, NodeDB, OverlapDB | ||
|
||
|
||
def _get_table_sizes(session: Session) -> Tuple[int, int, int]: | ||
return ( | ||
session.query(NodeDB).count(), | ||
session.query(LinkDB).count(), | ||
session.query(OverlapDB).count(), | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"config_content", | ||
[ | ||
{ | ||
"data.database": "sqlite", | ||
"segmentation.n_workers": 4, | ||
"linking.n_workers": 4, | ||
"linking.max_distance": 500, # too big and ignored | ||
}, | ||
], | ||
indirect=True, | ||
) | ||
def test_clear_solution( | ||
linked_database_mock_data: MainConfig, | ||
) -> None: | ||
|
||
mask = np.ones((7, 12, 12), dtype=bool) | ||
bbox = np.array([15, 24, 24, 22, 36, 36], dtype=int) | ||
|
||
engine = create_engine(linked_database_mock_data.data_config.database_path) | ||
with Session(engine) as session: | ||
n_nodes, n_links, n_overlaps = _get_table_sizes(session) | ||
|
||
add_new_node( | ||
linked_database_mock_data, | ||
0, | ||
mask, | ||
bbox, | ||
) | ||
|
||
new_n_nodes, new_n_links, new_n_overlaps = _get_table_sizes(session) | ||
|
||
assert new_n_nodes == n_nodes + 1 | ||
assert new_n_overlaps > n_overlaps | ||
# could smaller than max neighbors because of radius | ||
assert ( | ||
new_n_links == n_links + linked_database_mock_data.linking_config.max_neighbors | ||
) |
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,42 @@ | ||
from pathlib import Path | ||
|
||
from ultrack import MainConfig, export_tracks_by_extension | ||
|
||
|
||
def test_exporter(tracked_database_mock_data: MainConfig, tmp_path: Path) -> None: | ||
file_ext_list = [".xml", ".csv", ".zarr", ".dot", ".json"] | ||
last_modified_time = {} | ||
for file_ext in file_ext_list: | ||
tmp_file = tmp_path / f"tracks{file_ext}" | ||
export_tracks_by_extension(tracked_database_mock_data, tmp_file) | ||
|
||
# assert file exists | ||
assert (tmp_path / f"tracks{file_ext}").exists() | ||
# assert file size is not zero | ||
assert (tmp_path / f"tracks{file_ext}").stat().st_size > 0 | ||
|
||
# store last modified time | ||
last_modified_time[str(tmp_file)] = tmp_file.stat().st_mtime | ||
|
||
# loop again testing overwrite=False | ||
for file_ext in file_ext_list: | ||
tmp_file = tmp_path / f"tracks{file_ext}" | ||
try: | ||
export_tracks_by_extension( | ||
tracked_database_mock_data, tmp_file, overwrite=False | ||
) | ||
assert False, "FileExistsError should be raised" | ||
except FileExistsError: | ||
pass | ||
|
||
# loop again testing overwrite=True | ||
for file_ext in file_ext_list: | ||
tmp_file = tmp_path / f"tracks{file_ext}" | ||
export_tracks_by_extension(tracked_database_mock_data, tmp_file, overwrite=True) | ||
|
||
# assert file exists | ||
assert (tmp_path / f"tracks{file_ext}").exists() | ||
# assert file size is not zero | ||
assert (tmp_path / f"tracks{file_ext}").stat().st_size > 0 | ||
|
||
assert last_modified_time[str(tmp_file)] != tmp_file.stat().st_mtime |
Oops, something went wrong.