Skip to content

Commit

Permalink
remove enum
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-encord committed Jan 2, 2025
1 parent 42ffce9 commit 5607bee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
24 changes: 7 additions & 17 deletions encord/objects/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,6 @@ def to_dict(self) -> dict:
return {str(idx): {"x": value.x, "y": value.y} for idx, value in enumerate(self.values)}


class Visibility(CamelStrEnum):
"""
An enumeration to represent the visibility state of an item.
Attributes:
VISIBLE: The item is visible within the frame.
INVISIBLE: The item is outside the frame and thus invisible.
OCCLUDED: The item is within the frame but occluded by something else.
"""

VISIBLE = auto()
INVISIBLE = auto()
OCCLUDED = auto()


class SkeletonCoordinate(BaseDTO):
"""
Represents a coordinate for a skeleton structure in an image.
Expand All @@ -299,7 +284,9 @@ class SkeletonCoordinate(BaseDTO):
color (Optional[str]): The color associated with the skeleton point.
feature_hash (Optional[str]): A unique hash for the feature.
value (Optional[str]): An optional value associated with the skeleton point.
visibility (Optional[Visibility]): The visibility state of the skeleton point.
visible (Optional[bool]): `True` if the skeleton point is visible within the frame (default).
invisible (Optional[bool]): `True` if the skeleton point is outside the frame and thus invisible.
occluded (Optional[bool]): `True` if the skeleton point is within the frame but occluded by something else.
"""

x: float
Expand All @@ -308,7 +295,10 @@ class SkeletonCoordinate(BaseDTO):
color: Optional[str] = None
feature_hash: Optional[str] = None
value: Optional[str] = None
visibility: Optional[Visibility] = None

visible: Optional[bool] = None
invisible: Optional[bool] = None
occluded: Optional[bool] = None


class SkeletonCoordinates(BaseDTO):
Expand Down
14 changes: 7 additions & 7 deletions tests/objects/data/skeleton_coordinates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from encord.objects.coordinates import SkeletonCoordinate, SkeletonCoordinates, Visibility
from encord.objects.coordinates import SkeletonCoordinate, SkeletonCoordinates

ontology = {
"objects": [
Expand Down Expand Up @@ -106,7 +106,7 @@
"color": "#000000",
"value": "point_0",
"featureHash": "1wthOoHe",
"visibility": "visible",
"visible": True,
},
"1": {
"x": 0.4649,
Expand All @@ -115,7 +115,7 @@
"color": "#000000",
"value": "point_1",
"featureHash": "KGp1oToz",
"visibility": "occluded",
"occluded": True,
},
"2": {
"x": 0.2356,
Expand All @@ -124,7 +124,7 @@
"color": "#000000",
"value": "point_2",
"featureHash": "OqR+F4dN",
"visibility": "invisible",
"invisible": True,
},
},
"manualAnnotation": True,
Expand Down Expand Up @@ -152,7 +152,7 @@
color="#000000",
feature_hash="1wthOoHe",
value="point_0",
visibility=Visibility.VISIBLE,
visible=True,
),
SkeletonCoordinate(
x=0.4649,
Expand All @@ -161,7 +161,7 @@
color="#000000",
feature_hash="KGp1oToz",
value="point_1",
visibility=Visibility.OCCLUDED,
occluded=True,
),
SkeletonCoordinate(
x=0.2356,
Expand All @@ -170,7 +170,7 @@
color="#000000",
feature_hash="OqR+F4dN",
value="point_2",
visibility=Visibility.INVISIBLE,
invisible=True,
),
],
name="Triangle",
Expand Down

0 comments on commit 5607bee

Please sign in to comment.