Skip to content

Commit

Permalink
fix: duplicated name for volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Oct 3, 2024
1 parent e2b5330 commit 0da024e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions new_api/v3/serialization/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ def dsv_id_to_model(id: str):
volumes: List[VolumeModel] = []

indices = defaultdict(list)
volume_name_to_idx = {}
volume_name_to_idx = defaultdict(list)

for idx, vol in enumerate(all_volumes):
volume_name_to_idx[vol.name] = idx
volume_name_to_idx[vol.name].append(idx)
vol_ds: List[EbrainsDatasetModel] = []
if vol.id:
vol_ds = [dsv_id_to_model(dsv)
Expand Down Expand Up @@ -176,13 +176,14 @@ def dsv_id_to_model(id: str):
for mapping in mappings:
target = mapping["target"]
assert target in volume_name_to_idx, f"target {target} not found in volume name {volume_name_to_idx}"
new_index = {
"volume": volume_name_to_idx[target]
}
if mapping.get("label"):
new_index["label"] = mapping.get("label")
indices[regionname].append(new_index)
indices[clear_name(regionname)].append(new_index)
for idx in volume_name_to_idx[target]:
new_index = {
"volume": volume_name_to_idx[target]
}
if mapping.get("label"):
new_index["label"] = mapping.get("label")
indices[regionname].append(new_index)
indices[clear_name(regionname)].append(new_index)

if mp.space_id == FSA_ID:
assert len(all_volumes) == 2, f"Expected fsaverage to have 2 volumes, but got {len(all_volumes)}"
Expand Down

0 comments on commit 0da024e

Please sign in to comment.