Skip to content

Commit

Permalink
add reference integer schema (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceesem authored May 22, 2024
1 parent 32a0124 commit 62cf39e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion emannotationschemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from emannotationschemas.schemas.synapse import NoCleftSynapse
from emannotationschemas.schemas.bouton_shape import BoutonShape
from emannotationschemas.schemas.presynaptic_bouton_type import PresynapticBoutonType
from emannotationschemas.schemas.base import ReferenceAnnotation, ReferenceTagAnnotation
from emannotationschemas.schemas.base import (
ReferenceAnnotation,
ReferenceTagAnnotation,
ReferenceInteger,
)
from emannotationschemas.schemas.functional_coregistration import (
FunctionalCoregistration,
FunctionalUnitCoregistration,
Expand Down Expand Up @@ -106,6 +110,7 @@
"bound_tag_bool": BoundBoolAnnotation,
"bound_tag_bool_valid": BoundBoolWithValid,
"bound_tag_valid": BoundTagWithValid,
"reference_integer": ReferenceInteger,
}


Expand Down
15 changes: 12 additions & 3 deletions emannotationschemas/schemas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ class SpatialPoint(mm.Schema):
@mm.post_load
def transform_position(self, data, **kwargs):
if self.context.get("postgis", False):
data[
"position"
] = f'POINTZ({data["position"][0]} {data["position"][1]} {data["position"][2]})'
data["position"] = (
f'POINTZ({data["position"][0]} {data["position"][1]} {data["position"][2]})'
)

return data

Expand Down Expand Up @@ -190,3 +190,12 @@ class RepresentativePoint(AnnotationSchema):
required=True,
description="the point to be used for attaching objects to the dynamic segmentation",
)


class ReferenceInteger(ReferenceAnnotation):
"""Reference annotation with an integer value"""

value = mm.fields.Int(
required=True,
description="Integer value to be attached to the annotation",
)

0 comments on commit 62cf39e

Please sign in to comment.