Skip to content

Commit e2b0181

Browse files
committed
fix: download call signature
fix: download template bbox
1 parent 4a44d1a commit e2b0181

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

api/common/data_handlers/compounds/download.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import json
99
import math
1010

11-
BIGBRAIN_ID = "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588"
12-
BIGBRAIN_SIZE_LIMIT = 2 * 1024 * 1024
11+
VOLUME_SIZE_LIMIT = 2 * 1024 * 1024
1312

1413
README = """# Packaged Atlas Data
1514
@@ -138,17 +137,13 @@ def write_desc(filename, obj, **kwargs):
138137
space: _space.Space = siibra.spaces[space_id]
139138
space_filename = f"{space.key}.nii.gz"
140139

141-
# this should fetch anything (surface, nifti, ng precomputed)
142-
if space.id == BIGBRAIN_ID:
143-
if bbox:
144-
bounding_box = space.get_bounding_box(*json.loads(bbox))
145-
value = BIGBRAIN_SIZE_LIMIT
146-
for dim in bounding_box.maxpoint - bounding_box.minpoint:
147-
value /= dim
148-
cube_rooted = math.pow(value, 1/3)
149-
space_vol = space.get_template().fetch(voi=bounding_box, resolution_mm=1/cube_rooted)
150-
else:
151-
raise RuntimeError(f"For big brain, bbox must be defined.")
140+
if bbox:
141+
bounding_box = space.get_bounding_box(*json.loads(bbox))
142+
value = VOLUME_SIZE_LIMIT
143+
for dim in bounding_box.maxpoint - bounding_box.minpoint:
144+
value /= dim
145+
cube_rooted = math.pow(value, 1/3)
146+
space_vol = space.get_template().fetch(voi=bounding_box, resolution_mm=1/cube_rooted)
152147
else:
153148
space_vol = space.get_template().fetch()
154149
zipfile.writestr(space_filename, gzip.compress(space_vol.to_bytes()))

api/server/compounds/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def cleanup(filepath: Path):
2525
@router.get("")
2626
@version(*FASTAPI_VERSION)
2727
@router_decorator(ROLE, func=download_all, queue_as_async=(ROLE=="server"))
28-
def get_download_bundle(space_id: str=None, parcellation_id: str=None, bbox=None, region_id: str=None, feature_id: str=None, *, background: BackgroundTasks, func):
28+
def get_download_bundle(space_id: str=None, parcellation_id: str=None, bbox: str=None, region_id: str=None, feature_id: str=None, *, background: BackgroundTasks, func):
2929
"""Prepare the bundle. Given a specification, prepare/bundle according to the specification."""
3030
returnval = func(space_id=space_id, parcellation_id=parcellation_id, bbox=bbox, region_id=region_id, feature_id=feature_id)
3131
try:

0 commit comments

Comments
 (0)