Skip to content

Commit e1f8f87

Browse files
authored
Merge pull request #583 from FZJ-INM1-BDA/enh_use_precalc_img_bboxes
Use precalculated bounding boxes of image-features to speed up image feature query
2 parents ef0e542 + 4f2f68e commit e1f8f87

File tree

9 files changed

+214
-130
lines changed

9 files changed

+214
-130
lines changed

e2e/features/image/test_image.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_images_datasets_names():
2929

3030

3131
# Update this as new configs are added
32+
3233
query_and_results = [
3334
(siibra.features.get(siibra.get_template("big brain"), "CellbodyStainedSection"), 145),
3435
(siibra.features.get(siibra.get_template("big brain"), "CellBodyStainedVolumeOfInterest"), 2),
@@ -51,10 +52,9 @@ def test_color_channel_fetching():
5152
dti_rgb_vol = [
5253
f
5354
for f in siibra.features.get(
54-
siibra.get_template('mni152'),
55-
siibra.features.fibres.DTIVolumeOfInterest
55+
siibra.get_template("mni152"), siibra.features.fibres.DTIVolumeOfInterest
5656
)
57-
if 'rgb' in f.name
57+
if "rgb" in f.name
5858
][0]
5959
_ = dti_rgb_vol.fetch(channel=0)
6060
_ = dti_rgb_vol.fetch(channel=1)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import siibra
2+
from siibra.features.image.image import Image
3+
from siibra.volumes.volume import Volume
4+
import pytest
5+
from itertools import repeat
6+
7+
map_vols = [v for m in siibra.maps for v in m.volumes]
8+
imagefeatures = [
9+
feat
10+
for ftype in siibra.features.Feature._SUBCLASSES[Image]
11+
for feat in ftype._get_instances()
12+
]
13+
volumes = list(zip(map_vols, repeat(True))) + list(zip(imagefeatures, repeat(False)))
14+
15+
16+
@pytest.mark.parametrize("volume, clip_flag", volumes)
17+
def test_onthefly_and_preconfig_bboxes(volume: Volume, clip_flag: bool):
18+
configured_bbox = volume._boundingbox
19+
if configured_bbox is None:
20+
pytest.skip(f"No preconfigured BoundingBox for {volume} is found. ")
21+
volume._boundingbox = None
22+
kwargs = {"clip": clip_flag}
23+
bbox = volume.get_boundingbox(**kwargs)
24+
assert configured_bbox == bbox, f" {volume}"

0 commit comments

Comments
 (0)