Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use precalculated bounding boxes of image-features to speed up image feature query #583

Merged
merged 17 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/features/image/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_images_datasets_names():


# Update this as new configs are added

query_and_results = [
(siibra.features.get(siibra.get_template("big brain"), "CellbodyStainedSection"), 145),
(siibra.features.get(siibra.get_template("big brain"), "CellBodyStainedVolumeOfInterest"), 2),
Expand All @@ -51,10 +52,9 @@ def test_color_channel_fetching():
dti_rgb_vol = [
f
for f in siibra.features.get(
siibra.get_template('mni152'),
siibra.features.fibres.DTIVolumeOfInterest
siibra.get_template("mni152"), siibra.features.fibres.DTIVolumeOfInterest
)
if 'rgb' in f.name
if "rgb" in f.name
][0]
_ = dti_rgb_vol.fetch(channel=0)
_ = dti_rgb_vol.fetch(channel=1)
Expand Down
24 changes: 24 additions & 0 deletions e2e/volumes/test_preconfigured_boundingbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import siibra
from siibra.features.image.image import Image
from siibra.volumes.volume import Volume
import pytest
from itertools import repeat

map_vols = [v for m in siibra.maps for v in m.volumes]
imagefeatures = [
feat
for ftype in siibra.features.Feature._SUBCLASSES[Image]
for feat in ftype._get_instances()
]
volumes = list(zip(map_vols, repeat(True))) + list(zip(imagefeatures, repeat(False)))


@pytest.mark.parametrize("volume, clip_flag", volumes)
def test_onthefly_and_preconfig_bboxes(volume: Volume, clip_flag: bool):
configured_bbox = volume._boundingbox
if configured_bbox is None:
pytest.skip(f"No preconfigured BoundingBox for {volume} is found. ")
volume._boundingbox = None
kwargs = {"clip": clip_flag}
bbox = volume.get_boundingbox(**kwargs)
assert configured_bbox == bbox, f" {volume}"
Loading
Loading