Skip to content

Commit

Permalink
tmp: cache ebrainsdataset
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Jan 24, 2024
1 parent 99aa490 commit 3e8bc44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 31 deletions.
8 changes: 4 additions & 4 deletions api/serialization/features/_basetypes/volume_of_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# serializing voi is... somewhat complicated, so doing it manually
@serialize(Image, pass_super_model=False)
def voi_to_model(feat: Image, **kwargs) -> SiibraVoiModel:
def voi_to_model(feat: Image, detail=False, **kwargs) -> SiibraVoiModel:
"""Serialize siibra Image instance
Serializing Image instance turns out to be rather complex, so doing it manually.
Expand All @@ -19,13 +19,13 @@ def voi_to_model(feat: Image, **kwargs) -> SiibraVoiModel:
Returns:
SiibraVoiModel"""
feature_super_model = instance_to_model(feat, use_class=Feature)
volume_super_model = instance_to_model(feat, use_class=Volume)
feature_super_model = instance_to_model(feat, detail=detail, use_class=Feature)
volume_super_model = instance_to_model(feat, detail=detail, use_class=Volume)

feature_dict = feature_super_model.dict()
feature_dict.pop("@type", None)
return SiibraVoiModel(
**feature_dict,
volume=volume_super_model,
boundingbox=instance_to_model(feat.get_boundingbox()),
boundingbox=instance_to_model(feat.get_boundingbox(clip=False)),
)
4 changes: 2 additions & 2 deletions api/serialization/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ def instance_to_model(instance: Any, * , use_class: Type=None, skip_classes: Lis
return None
return instance
if isinstance(instance, (list, tuple)):
return [instance_to_model(item) for item in instance]
return [instance_to_model(item, **kwargs) for item in instance]
if isinstance(instance, dict):
if not all([isinstance(key, str) for key in instance]):
raise NonStrKeyException(f"Attempting to serialize dict with non str keys! {instance}")
return {
key: instance_to_model(value)
key: instance_to_model(value, **kwargs)
for key, value in instance.items()
}
for Cls in instance.__class__.__mro__:
Expand Down
24 changes: 0 additions & 24 deletions bla.py

This file was deleted.

3 changes: 2 additions & 1 deletion requirements/siibra.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
siibra==1.0a5
# siibra==1.0a5
git+https://github.com/FZJ-INM1-BDA/siibra-python.git@50f038f
plotly

0 comments on commit 3e8bc44

Please sign in to comment.