|
1 |
| -from enum import Enum |
2 | 1 | from typing import List, Optional, Tuple
|
3 | 2 |
|
4 |
| -from labelbox.data.annotation_types.annotation import ( |
5 |
| - ClassificationAnnotation, |
6 |
| - ObjectAnnotation, |
| 3 | +from pydantic import ( |
| 4 | + AliasChoices, |
| 5 | + BaseModel, |
| 6 | + ConfigDict, |
| 7 | + Field, |
| 8 | + field_validator, |
| 9 | + model_validator, |
7 | 10 | )
|
8 | 11 |
|
9 | 12 | from labelbox.data.annotation_types.annotation import (
|
|
16 | 19 | CustomMetricsNotSupportedMixin,
|
17 | 20 | )
|
18 | 21 | from labelbox.utils import _CamelCaseMixin, is_valid_uri
|
19 |
| -from pydantic import ( |
20 |
| - model_validator, |
21 |
| - BaseModel, |
22 |
| - field_validator, |
23 |
| - Field, |
24 |
| - ConfigDict, |
25 |
| - AliasChoices, |
26 |
| -) |
27 | 22 |
|
28 | 23 |
|
29 | 24 | class VideoClassificationAnnotation(ClassificationAnnotation):
|
@@ -72,43 +67,6 @@ class VideoObjectAnnotation(
|
72 | 67 | segment_index: Optional[int] = None
|
73 | 68 |
|
74 | 69 |
|
75 |
| -class GroupKey(Enum): |
76 |
| - """Group key for DICOM annotations""" |
77 |
| - |
78 |
| - AXIAL = "axial" |
79 |
| - SAGITTAL = "sagittal" |
80 |
| - CORONAL = "coronal" |
81 |
| - |
82 |
| - |
83 |
| -class DICOMObjectAnnotation(VideoObjectAnnotation): |
84 |
| - """DICOM object annotation |
85 |
| - >>> DICOMObjectAnnotation( |
86 |
| - >>> name="dicom_polyline", |
87 |
| - >>> frame=2, |
88 |
| - >>> value=lb_types.Line(points = [ |
89 |
| - >>> lb_types.Point(x=680, y=100), |
90 |
| - >>> lb_types.Point(x=100, y=190), |
91 |
| - >>> lb_types.Point(x=190, y=220) |
92 |
| - >>> ]), |
93 |
| - >>> segment_index=0, |
94 |
| - >>> keyframe=True, |
95 |
| - >>> Group_key=GroupKey.AXIAL |
96 |
| - >>> ) |
97 |
| - Args: |
98 |
| - name (Optional[str]) |
99 |
| - feature_schema_id (Optional[Cuid]) |
100 |
| - value (Geometry) |
101 |
| - group_key (GroupKey) |
102 |
| - frame (Int): The frame index that this annotation corresponds to |
103 |
| - keyframe (bool): Whether or not this annotation was a human generated or interpolated annotation |
104 |
| - segment_id (Optional[Int]): Index of video segment this annotation belongs to |
105 |
| - classifications (List[ClassificationAnnotation]) = [] |
106 |
| - extra (Dict[str, Any]) |
107 |
| - """ |
108 |
| - |
109 |
| - group_key: GroupKey |
110 |
| - |
111 |
| - |
112 | 70 | class MaskFrame(_CamelCaseMixin, BaseModel):
|
113 | 71 | index: int
|
114 | 72 | instance_uri: Optional[str] = Field(
|
@@ -162,23 +120,3 @@ class VideoMaskAnnotation(BaseModel):
|
162 | 120 |
|
163 | 121 | frames: List[MaskFrame]
|
164 | 122 | instances: List[MaskInstance]
|
165 |
| - |
166 |
| - |
167 |
| -class DICOMMaskAnnotation(VideoMaskAnnotation): |
168 |
| - """DICOM mask annotation |
169 |
| - >>> DICOMMaskAnnotation( |
170 |
| - >>> name="dicom_mask", |
171 |
| - >>> group_key=GroupKey.AXIAL, |
172 |
| - >>> frames=[ |
173 |
| - >>> MaskFrame(index=1, instance_uri='https://storage.labelbox.com/cjhfn5y6s0pk507024nz1ocys%2F1d60856c-59b7-3060-2754-83f7e93e0d01-1?Expires=1666901963361&KeyName=labelbox-assets-key-3&Signature=t-2s2DB4YjFuWEFak0wxYqfBfZA'), |
174 |
| - >>> MaskFrame(index=5, instance_uri='https://storage.labelbox.com/cjhfn5y6s0pk507024nz1ocys1%2F1d60856c-59b7-3060-2754-83f7e93e0d01-1?Expires=1666901963361&KeyName=labelbox-assets-key-3&Signature=t-2s2DB4YjFuWEFak0wxYqfBfZA'), |
175 |
| - >>> ], |
176 |
| - >>> instances=[ |
177 |
| - >>> MaskInstance(color_rgb=(0, 0, 255), name="mask1"), |
178 |
| - >>> MaskInstance(color_rgb=(0, 255, 0), name="mask2"), |
179 |
| - >>> MaskInstance(color_rgb=(255, 0, 0), name="mask3") |
180 |
| - >>> ] |
181 |
| - >>> ) |
182 |
| - """ |
183 |
| - |
184 |
| - group_key: GroupKey |
0 commit comments