-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests: check region-volume intersection, centroid containednedness
- Loading branch information
1 parent
50e4db3
commit 7356b80
Showing
2 changed files
with
62 additions
and
3 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 |
---|---|---|
@@ -1 +1,35 @@ | ||
import siibra | ||
from siibra.volumes import Volume | ||
from siibra.core.region import Region | ||
import numpy as np | ||
import pytest | ||
# TODO write a test for the volume-region and volume-volume intersection | ||
|
||
|
||
selected_regions = [ | ||
(siibra.get_region('julich 2.9', 'CA2 (Hippocampus) right'), 'mni152'), | ||
(siibra.get_region('julich 2.9', 'CA2 (Hippocampus) left'), 'colin27'), | ||
(siibra.get_region('julich 2.9', 'hoc1 left'), 'bigbrain'), | ||
(siibra.get_region('julich 3', 'sts'), 'mni152'), | ||
(siibra.get_region('Von Economo Koskinas', 'TC: Area supratemporalis granulosa right'), 'mni152') | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("region, space", selected_regions) | ||
def test_region_intersection_with_its_own_volume(region, space): | ||
assert isinstance(region, Region) | ||
volume = region.get_regional_map(space) | ||
intersection = region.intersection(volume) | ||
assert isinstance(intersection, Volume) | ||
assert np.all( | ||
np.equal(intersection.fetch().dataobj, volume.fetch().dataobj) | ||
), "Intersection of a regional map with its region object should be the same volume." | ||
|
||
|
||
@pytest.mark.parametrize("region, space", selected_regions) | ||
def test_region_intersection_with_its_centroid(region, space): | ||
assert isinstance(region, Region) | ||
centroids = region.compute_centroids(space) | ||
assert centroids in region | ||
intersection = region.intersection(centroids) | ||
assert intersection == centroids |