-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn user if data segmented in a different coordinate space (#107)
* Warn user if data segmented in a different coordinate space * Add draft (failing) test * Add simpler test * rename test file * Add warnings about different coordinate spaces * Update tests/conftest.py Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com> --------- Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>
- Loading branch information
1 parent
b6d0202
commit 398772a
Showing
6 changed files
with
72 additions
and
24 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
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,9 +1,26 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
from bg_atlasapi import BrainGlobeAtlas | ||
|
||
from brainreg_segment.segment import SegmentationWidget | ||
|
||
atlas_name = "allen_mouse_50um" | ||
brainreg_dir = Path.cwd() / "tests" / "data" / "brainreg_output" | ||
|
||
|
||
@pytest.fixture | ||
def allen_mouse_50um_atlas(): | ||
return BrainGlobeAtlas(atlas_name) | ||
|
||
|
||
@pytest.fixture | ||
def segmentation_widget(make_napari_viewer): | ||
""" | ||
Create a viewer, add the segmentation widget, and return the widget. | ||
The viewer can be accessed using ``widget.viewer``. | ||
""" | ||
viewer = make_napari_viewer() | ||
widget = SegmentationWidget(viewer) | ||
viewer.window.add_dock_widget(widget) | ||
return widget |
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
Empty file.
17 changes: 17 additions & 0 deletions
17
tests/tests/test_unit/test_segmentation_panels/test_regions.py
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,17 @@ | ||
import numpy as np | ||
from napari.layers import Labels | ||
|
||
from brainreg_segment.segmentation_panels.regions import ( | ||
check_segmentation_in_correct_space, | ||
) | ||
|
||
|
||
def test_check_segmentation_in_correct_space(): | ||
labels_layer_10 = Labels(np.zeros((10, 10, 10), dtype=int)) | ||
labels_layer_15 = Labels(np.zeros((15, 15, 15), dtype=int)) | ||
assert check_segmentation_in_correct_space( | ||
[labels_layer_10], labels_layer_10.data | ||
) | ||
assert not check_segmentation_in_correct_space( | ||
[labels_layer_10], labels_layer_15.data | ||
) |