Skip to content

Vb/remove dicomm plt 1853 #1902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@
</tr>
</thead>
<tbody>
<tr>
<td>DICOM</td>
<td><a href="https://github.com/Labelbox/labelbox-python/tree/develop/examples/annotation_import/dicom.ipynb" target="_blank"><img src="https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white" alt="Open In Github"></a></td>
<td><a href="https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/annotation_import/dicom.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td>
</tr>
<tr>
<td>Tiled</td>
<td><a href="https://github.com/Labelbox/labelbox-python/tree/develop/examples/annotation_import/tiled.ipynb" target="_blank"><img src="https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white" alt="Open In Github"></a></td>
Expand Down
266 changes: 0 additions & 266 deletions examples/annotation_import/dicom.ipynb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@

from .video import VideoClassificationAnnotation
from .video import VideoObjectAnnotation
from .video import DICOMObjectAnnotation
from .video import GroupKey
from .video import MaskFrame
from .video import MaskInstance
from .video import VideoMaskAnnotation
from .video import DICOMMaskAnnotation

from .ner import ConversationEntity
from .ner import DocumentEntity
Expand Down
76 changes: 7 additions & 69 deletions libs/labelbox/src/labelbox/data/annotation_types/video.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from enum import Enum
from typing import List, Optional, Tuple

from labelbox.data.annotation_types.annotation import (
ClassificationAnnotation,
ObjectAnnotation,
from pydantic import (
AliasChoices,
BaseModel,
ConfigDict,
Field,
field_validator,
model_validator,
)

from labelbox.data.annotation_types.annotation import (
Expand All @@ -16,14 +19,6 @@
CustomMetricsNotSupportedMixin,
)
from labelbox.utils import _CamelCaseMixin, is_valid_uri
from pydantic import (
model_validator,
BaseModel,
field_validator,
Field,
ConfigDict,
AliasChoices,
)


class VideoClassificationAnnotation(ClassificationAnnotation):
Expand Down Expand Up @@ -72,43 +67,6 @@ class VideoObjectAnnotation(
segment_index: Optional[int] = None


class GroupKey(Enum):
"""Group key for DICOM annotations"""

AXIAL = "axial"
SAGITTAL = "sagittal"
CORONAL = "coronal"


class DICOMObjectAnnotation(VideoObjectAnnotation):
"""DICOM object annotation
>>> DICOMObjectAnnotation(
>>> name="dicom_polyline",
>>> frame=2,
>>> value=lb_types.Line(points = [
>>> lb_types.Point(x=680, y=100),
>>> lb_types.Point(x=100, y=190),
>>> lb_types.Point(x=190, y=220)
>>> ]),
>>> segment_index=0,
>>> keyframe=True,
>>> Group_key=GroupKey.AXIAL
>>> )
Args:
name (Optional[str])
feature_schema_id (Optional[Cuid])
value (Geometry)
group_key (GroupKey)
frame (Int): The frame index that this annotation corresponds to
keyframe (bool): Whether or not this annotation was a human generated or interpolated annotation
segment_id (Optional[Int]): Index of video segment this annotation belongs to
classifications (List[ClassificationAnnotation]) = []
extra (Dict[str, Any])
"""

group_key: GroupKey


class MaskFrame(_CamelCaseMixin, BaseModel):
index: int
instance_uri: Optional[str] = Field(
Expand Down Expand Up @@ -162,23 +120,3 @@ class VideoMaskAnnotation(BaseModel):

frames: List[MaskFrame]
instances: List[MaskInstance]


class DICOMMaskAnnotation(VideoMaskAnnotation):
"""DICOM mask annotation
>>> DICOMMaskAnnotation(
>>> name="dicom_mask",
>>> group_key=GroupKey.AXIAL,
>>> frames=[
>>> 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'),
>>> 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'),
>>> ],
>>> instances=[
>>> MaskInstance(color_rgb=(0, 0, 255), name="mask1"),
>>> MaskInstance(color_rgb=(0, 255, 0), name="mask2"),
>>> MaskInstance(color_rgb=(255, 0, 0), name="mask3")
>>> ]
>>> )
"""

group_key: GroupKey
Loading