Skip to content

Commit eaa1e87

Browse files
authored
Merge pull request #79 from scaleapi/cuboid_error_messaging
Add error messaging for cuboids in Python client
2 parents c398f77 + da6c18c commit eaa1e87

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

nucleus/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
Segment,
6969
SegmentationAnnotation,
7070
Point,
71+
CuboidAnnotation,
7172
)
7273
from .constants import (
7374
ANNOTATION_METADATA_SCHEMA_KEY,
@@ -115,6 +116,7 @@
115116
)
116117
from .prediction import (
117118
BoxPrediction,
119+
CuboidPrediction,
118120
PolygonPrediction,
119121
SegmentationPrediction,
120122
)
@@ -565,6 +567,8 @@ def annotate_dataset(
565567
:param update: whether to update or ignore conflicting annotations
566568
:return: {"dataset_id: str, "annotations_processed": int}
567569
"""
570+
if any((isinstance(ann, CuboidAnnotation) for ann in annotations)):
571+
raise NotImplementedError("Cuboid annotations not yet supported")
568572

569573
# Split payload into segmentations and Box/Polygon
570574
segmentations = [
@@ -723,6 +727,9 @@ def predict(
723727
"predictions_ignored": int,
724728
}
725729
"""
730+
if any((isinstance(ann, CuboidPrediction) for ann in annotations)):
731+
raise NotImplementedError("Cuboid predictions not yet supported")
732+
726733
segmentations = [
727734
ann
728735
for ann in annotations

nucleus/dataset.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
serialize_and_write_to_presigned_url,
1010
)
1111

12-
from .annotation import Annotation, check_all_annotation_paths_remote
12+
from .annotation import (
13+
Annotation,
14+
CuboidAnnotation,
15+
check_all_annotation_paths_remote,
16+
)
1317
from .constants import (
1418
DATASET_ITEM_IDS_KEY,
1519
DATASET_LENGTH_KEY,
@@ -163,6 +167,9 @@ def annotate(
163167
"ignored_items": int,
164168
}
165169
"""
170+
if any((isinstance(ann, CuboidAnnotation) for ann in annotations)):
171+
raise NotImplementedError("Cuboid annotations not yet supported")
172+
166173
if asynchronous:
167174
check_all_annotation_paths_remote(annotations)
168175

0 commit comments

Comments
 (0)