From bb1468c5c007bfc03e9d1f7cba235028b822aa52 Mon Sep 17 00:00:00 2001 From: Xiao Gui Date: Wed, 3 May 2023 13:58:36 +0200 Subject: [PATCH 1/2] test: add e2e test to ensure labelled/stat map is of expected size --- e2e/volumes/test_parcellationmap.py | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/e2e/volumes/test_parcellationmap.py b/e2e/volumes/test_parcellationmap.py index 580d3ed10..494449f48 100644 --- a/e2e/volumes/test_parcellationmap.py +++ b/e2e/volumes/test_parcellationmap.py @@ -76,3 +76,43 @@ def test_sparsemap_cache_uniqueness(): mp157 = siibra.get_map("julich 3.0", "colin 27", "statistical", spec="157") mp175 = siibra.get_map("julich 3.0", "colin 27", "statistical", spec="175") assert mp157.sparse_index.probs[0] != mp175.sparse_index.probs[0] + +# checks labelled/statistical returns volume size matches template +# see https://github.com/FZJ-INM1-BDA/siibra-python/issues/302 +MNI152_ID="minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2" +COLIN_ID="minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992" + +JBA_29_ID="minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-290" +JBA_30_ID="minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-300" + +HOC1_RIGHT="Area hOc1 (V1, 17, CalcS) - right hemisphere" +FP1_RIGHT="Area Fp1 (FPole) - right hemisphere" + +STATISTIC_ENDPOINT="statistical" +LABELLED_ENDPOINT="labelled" + +map_shape_args = product( + ((MNI152_ID, (193, 229, 193)),), + (JBA_29_ID,), + (STATISTIC_ENDPOINT, LABELLED_ENDPOINT), + (HOC1_RIGHT, FP1_RIGHT, None), +) + +@pytest.mark.parametrize('space_shape,parc_id,map_endpoint,region_name', map_shape_args) +def test_map_shape(space_shape,parc_id,map_endpoint,region_name): + if region_name is None and map_endpoint == STATISTIC_ENDPOINT: + assert True + return + space_id, expected_shape = space_shape + + volume_data = None + if region_name is not None: + region = siibra.get_region(parc_id, region_name) + volume_data = region.fetch_regional_map(space_id, map_endpoint) + else: + labelled_map = siibra.get_map(parc_id, space_id, map_endpoint) + assert labelled_map is not None + volume_data = labelled_map.fetch() + + assert volume_data + assert volume_data.get_fdata().shape == expected_shape, f"{volume_data.get_fdata().shape}, {expected_shape}, {region_name}, {map_endpoint}, {space_id}" From df51a05cbe7a3384fb69aa2f9676de807da46ae9 Mon Sep 17 00:00:00 2001 From: Ahmet Nihat Simsek Date: Wed, 10 May 2023 17:09:03 +0200 Subject: [PATCH 2/2] Use preordered image provider list for format='image' --- siibra/volumes/volume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siibra/volumes/volume.py b/siibra/volumes/volume.py index c8ac43000..7b48b9ac3 100644 --- a/siibra/volumes/volume.py +++ b/siibra/volumes/volume.py @@ -178,7 +178,7 @@ def fetch( elif format == 'mesh': requested_formats = self.MESH_FORMATS elif format == 'image': - requested_formats = set(self.SUPPORTED_FORMATS) - set(self.MESH_FORMATS) + requested_formats = self.IMAGE_FORMATS elif format in self.SUPPORTED_FORMATS: requested_formats = [format] else: