Skip to content
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
26 changes: 20 additions & 6 deletions datamint/api/endpoints/annotations_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def upload_volume_segmentation(self,
worklist_id: str | None = None,
ai_model_name: str | None = None,
transpose_segmentation: bool = False,
source: str | None = None,
source: str | None = 'imported',
) -> list[str]:
"""
Upload a 3D volume segmentation to a resource.
Expand All @@ -605,7 +605,8 @@ def upload_volume_segmentation(self,
worklist_id: The annotation worklist unique id.
ai_model_name: The AI model name.
transpose_segmentation: Whether to transpose the segmentation before uploading.
source: Annotation source tag (e.g. 'model_pipeline', 'model_deploy').
source: Annotation source tag. Defaults to 'imported' since this is a direct API
entry point; :meth:`upload_predictions` overrides it with 'model_pipeline'/'model_deploy'.

Returns:
List of annotation unique ids created.
Expand Down Expand Up @@ -668,7 +669,7 @@ def upload_segmentations(self,
worklist_id: str | None = None,
transpose_segmentation: bool = False,
ai_model_name: str | None = None,
source: str | None = None,
source: str | None = 'imported',
) -> list[str]:
"""
Upload frame-by-frame segmentations to a resource.
Expand Down Expand Up @@ -698,7 +699,8 @@ def upload_segmentations(self,
model_id: The model unique id.
transpose_segmentation: Whether to transpose the segmentation or not.
ai_model_name: Optional AI model name to associate with the segmentation.
source: Annotation source tag (e.g. 'model_pipeline', 'model_deploy').
source: Annotation source tag. Defaults to 'imported' since this is a direct API
entry point; :meth:`upload_predictions` overrides it with 'model_pipeline'/'model_deploy'.

Returns:
List of segmentation unique ids.
Expand Down Expand Up @@ -1083,6 +1085,7 @@ def create_image_classification(self,
value: str,
imported_from: str | None = None,
model_id: str | None = None,
source: str | None = 'imported',
) -> str:
"""
Create an image-level classification annotation.
Expand All @@ -1093,6 +1096,8 @@ def create_image_classification(self,
value: The classification value.
imported_from: The imported from source value.
model_id: The model unique id.
source: Annotation source tag. Defaults to 'imported' since this is a direct API
entry point; :meth:`upload_predictions` overrides it with 'model_pipeline'/'model_deploy'.

Returns:
The id of the created annotation.
Expand All @@ -1102,6 +1107,7 @@ def create_image_classification(self,
value=value,
imported_from=imported_from,
model_id=model_id,
source=source,
)

created = self.create(resource, annotation)
Expand Down Expand Up @@ -1245,7 +1251,8 @@ def add_line_annotation(self,
worklist_id: str | None = None,
imported_from: str | None = None,
author_email: str | None = None,
model_id: str | None = None) -> str:
model_id: str | None = None,
source: str | None = 'imported') -> str:
"""
Add a line annotation to a resource.

Expand All @@ -1268,6 +1275,8 @@ def add_line_annotation(self,
imported_from: The imported from source value.
author_email: The email to consider as the author of the annotation. If None, use the customer of the api key.
model_id: The model unique id. Optional.
source: Annotation source tag. Defaults to 'imported' since this is a direct API
entry point; :meth:`upload_predictions` overrides it with 'model_pipeline'/'model_deploy'.

Example:
.. code-block:: python
Expand Down Expand Up @@ -1308,6 +1317,7 @@ def add_line_annotation(self,
imported_from=imported_from,
import_author=author_email,
model_id=model_id,
source=source,
)

resource_id = self._entid(resource)
Expand All @@ -1328,7 +1338,8 @@ def add_box_annotation(self,
worklist_id: str | None = None,
imported_from: str | None = None,
author_email: str | None = None,
model_id: str | None = None) -> str:
model_id: str | None = None,
source: str | None = 'imported') -> str:
"""
Add a box annotation to a resource.

Expand All @@ -1350,6 +1361,8 @@ def add_box_annotation(self,
imported_from: The imported from source value.
author_email: The email to consider as the author of the annotation. If None, use the customer of the api key.
model_id: The model unique id. Optional.
source: Annotation source tag. Defaults to 'imported' since this is a direct API
entry point; :meth:`upload_predictions` overrides it with 'model_pipeline'/'model_deploy'.

Example:
.. code-block:: python
Expand Down Expand Up @@ -1395,6 +1408,7 @@ def add_box_annotation(self,
imported_from=imported_from,
import_author=author_email,
model_id=model_id,
source=source,
)

created = self.create(resource_id, annotation)
Expand Down
1 change: 1 addition & 0 deletions datamint/api/endpoints/resources_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ async def __upload_single_resource(all_files_path, index: int,
frame_index=frame_index,
transpose_segmentation=transpose_segmentation,
model_id=ai_model,
source='imported',
session=session,
)
return rid
Expand Down
Loading