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
6 changes: 0 additions & 6 deletions .github/workflows/run_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ jobs:
PYTHONIOENCODING: utf-8
if: runner.os == 'Windows'

- name: Test datamint-config CLI (deprecated alias)
run: datamint-config --api-key testapikey
timeout-minutes: 1
env:
PYTHONIOENCODING: utf-8

- name: Test datamint config CLI (unified)
run: datamint config --api-key testapikey
timeout-minutes: 1
Expand Down
2 changes: 1 addition & 1 deletion datamint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__getattr__, __dir__, __all__ = lazy.attach(
__name__,
submodules=['dataset', "dataset.dataset", "examples"],
submodules=['dataset', "examples"],
submod_attrs={
"api.client": ["Api"],
# New modular dataset classes
Expand Down
4 changes: 3 additions & 1 deletion datamint/api/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ def convert_format(bytes_array: bytes,
Args:
bytes_array: Raw file content bytes
mimetype: Optional MIME type of the content
file_path: deprecated
file_path: Path to the source file. Required when mimetype is a video type
(used to open the file with ``cv2.VideoCapture``) or a NIfTI type
(used to load the file with ``nibabel``).

Returns:
Converted content in appropriate format (pydicom.Dataset, PIL Image, cv2.VideoCapture, ...)
Expand Down
56 changes: 1 addition & 55 deletions datamint/api/endpoints/annotations_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import json
import logging
import os
import warnings

import aiohttp
import httpx
Expand Down Expand Up @@ -117,9 +116,6 @@ def get_list( # type: ignore[override]
load_ai_segmentations: bool | None = None,
limit: int | None = None,
group_by_resource: bool = False,
*,
date_from: date | None = None,
date_to: date | None = None,
**kwargs: Any,
) -> Sequence[Annotation] | Sequence[Sequence[Annotation]]:
"""
Expand All @@ -139,8 +135,6 @@ def get_list( # type: ignore[override]
limit: Maximum number of annotations to return.
group_by_resource: If True, return results grouped by resource.
For instance, the first index of the returned list will contain all annotations for the first resource.
date_from: (DEPRECATED) Use ``from_date`` instead.
date_to: (DEPRECATED) Use ``to_date`` instead.

Returns:
Sequence[Annotation] | Sequence[Sequence[Annotation]]: List of annotations, or list of lists if grouped by resource.
Expand Down Expand Up @@ -175,17 +169,6 @@ def group_annotations_by_resource(annotations: Sequence[Annotation],
resource_annotations_map[ann.resource_id].append(ann)
return [resource_annotations_map[rid] for rid in resource_ids]

if date_from is not None:
warnings.warn("The 'date_from' parameter is deprecated. "
"Please use 'from_date' instead", DeprecationWarning)
if from_date is None:
from_date = date_from
if date_to is not None:
warnings.warn("The 'date_to' parameter is deprecated. "
"Please use 'to_date' instead", DeprecationWarning)
if to_date is None:
to_date = date_to

# Build search payload according to POST /annotations/search schema
payload = {
'annotation_type': annotation_type,
Expand Down Expand Up @@ -605,8 +588,6 @@ def upload_volume_segmentation(self,
model_name: str | None = None,
transpose_segmentation: bool = False,
source: str | None = 'imported',
*,
ai_model_name: str | None = None,
) -> list[str]:
"""
Upload a 3D volume segmentation to a resource.
Expand All @@ -623,7 +604,6 @@ def upload_volume_segmentation(self,
worklist_id: The annotation worklist unique id.
model_name: The AI model name.
transpose_segmentation: Whether to transpose the segmentation before uploading.
ai_model_name: (DEPRECATED) Use ``model_name`` instead.
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'.

Expand Down Expand Up @@ -653,12 +633,6 @@ def upload_volume_segmentation(self,
"""
import nest_asyncio

if ai_model_name is not None:
warnings.warn("The 'ai_model_name' parameter is deprecated. "
"Please use 'model_name' instead", DeprecationWarning)
if model_name is None:
model_name = ai_model_name

if isinstance(file_path, Path):
file_path = str(file_path)

Expand Down Expand Up @@ -694,8 +668,6 @@ def upload_segmentations(self,
transpose_segmentation: bool = False,
model_name: str | None = None,
source: str | None = 'imported',
*,
ai_model_name: str | None = None,
) -> list[str]:
"""
Upload frame-by-frame segmentations to a resource.
Expand Down Expand Up @@ -727,7 +699,6 @@ def upload_segmentations(self,
model_name: Optional AI model name to associate with the segmentation.
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'.
ai_model_name: (DEPRECATED) Use ``model_name`` instead.

Returns:
List of segmentation unique ids.
Expand Down Expand Up @@ -756,12 +727,6 @@ def upload_segmentations(self,
"""
import nest_asyncio

if ai_model_name is not None:
warnings.warn("The 'ai_model_name' parameter is deprecated. "
"Please use 'model_name' instead", DeprecationWarning)
if model_name is None:
model_name = ai_model_name

if isinstance(file_path, Path):
file_path = str(file_path)

Expand Down Expand Up @@ -1321,7 +1286,6 @@ def add_line_annotation(self,
frame_index: int | None = None,
slice_plane: ViewPlane | None = None,
metadata: pydicom.Dataset | Nifti1Image | None = None,
dicom_metadata: pydicom.Dataset | None = None,
coords_system: CoordinateSystem = 'pixel',
worklist_id: str | None = None,
imported_from: str | None = None,
Expand All @@ -1341,8 +1305,6 @@ def add_line_annotation(self,
resource: The resource unique id or Resource instance.
identifier: The annotation identifier, also as known as the annotation's label.
frame_index: The frame index of the annotation.
dicom_metadata: (DEPRECATED) The DICOM metadata of the image. If provided, the coordinates will be converted to the
correct coordinates automatically using the DICOM metadata.
coords_system: The coordinate system of the points. Can be 'pixel', or 'patient'.
If 'pixel', the points are in pixel coordinates. If 'patient', the points are in patient coordinates (see DICOM patient coordinates).
project: The project unique id or name.
Expand Down Expand Up @@ -1373,13 +1335,6 @@ def add_line_annotation(self,
metadata,
)

if dicom_metadata is not None:
import warnings
warnings.warn("The 'dicom_metadata' parameter is deprecated. "
"Please use 'metadata' parameter instead", DeprecationWarning)
if resolved_metadata is None:
resolved_metadata = dicom_metadata

annotation = LineAnnotation.from_points(
point1,
point2,
Expand Down Expand Up @@ -1625,29 +1580,20 @@ def bulk_download_file(self,
def patch(self,
annotation: str | Annotation,
identifier: str | None = None,
project: 'str | Project | None' = None,
*,
project_id: str | None = None) -> None:
project: 'str | Project | None' = None) -> None:
"""
Partially update an annotation's metadata.

Args:
annotation: The annotation unique id or Annotation instance.
identifier: Optional new identifier/label for the annotation.
project: Optional project ID or Project instance to associate with the annotation.
project_id: (DEPRECATED) Use ``project`` instead.

Raises:
ServerError: If the update fails.
"""
annotation_id = self._entid(annotation)

if project_id is not None:
warnings.warn("The 'project_id' parameter is deprecated. "
"Please use 'project' instead", DeprecationWarning)
if project is None:
project = project_id

payload = {'identifier': identifier,
'project_id': self._entid(project) if project is not None else None}
# remove None values
Expand Down
Loading
Loading