datamint 2.3.3__tar.gz → 2.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of datamint might be problematic. Click here for more details.
- {datamint-2.3.3 → datamint-2.3.4}/PKG-INFO +1 -1
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/base_api.py +6 -5
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/projects_api.py +9 -4
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/resources_api.py +9 -3
- {datamint-2.3.3 → datamint-2.3.4}/datamint/client_cmd_tools/datamint_upload.py +3 -1
- {datamint-2.3.3 → datamint-2.3.4}/pyproject.toml +1 -1
- {datamint-2.3.3 → datamint-2.3.4}/README.md +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/client.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/dto/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/annotations_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/annotationsets_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/channels_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/datasetsinfo_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/models_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/endpoints/users_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/api/entity_base_api.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/annotation_api_handler.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/api_handler.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/base_api_handler.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/dto/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/dto/annotation_dto.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/exp_api_handler.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/apihandler/root_api_handler.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/client_cmd_tools/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/client_cmd_tools/datamint_config.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/configs.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/dataset/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/dataset/annotation.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/dataset/base_dataset.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/dataset/dataset.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/annotation.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/base_entity.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/cache_manager.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/channel.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/datasetinfo.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/project.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/resource.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/entities/user.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/examples/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/examples/example_projects.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/exceptions.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/experiment/__init__.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/experiment/_patcher.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/experiment/experiment.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/logging.yaml +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/types.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/utils/logging_utils.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/utils/torchmetrics.py +0 -0
- {datamint-2.3.3 → datamint-2.3.4}/datamint/utils/visualization.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datamint
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -121,11 +121,12 @@ class BaseApi:
|
|
|
121
121
|
url = endpoint.lstrip('/') # Remove leading slash for httpx
|
|
122
122
|
|
|
123
123
|
try:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
if logger.isEnabledFor(logging.DEBUG):
|
|
125
|
+
curl_command = self._generate_curl_command({"method": method,
|
|
126
|
+
"url": url,
|
|
127
|
+
"headers": self.client.headers,
|
|
128
|
+
**kwargs}, fail_silently=True)
|
|
129
|
+
logger.debug(f'Equivalent curl command: "{curl_command}"')
|
|
129
130
|
response = self.client.request(method, url, **kwargs)
|
|
130
131
|
response.raise_for_status()
|
|
131
132
|
return response
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
from typing import Sequence, Literal
|
|
1
|
+
from typing import Sequence, Literal, TYPE_CHECKING
|
|
2
2
|
from ..entity_base_api import ApiConfig, CRUDEntityApi
|
|
3
3
|
from datamint.entities.project import Project
|
|
4
|
-
from datamint.entities.resource import Resource
|
|
5
4
|
import httpx
|
|
5
|
+
from datamint.entities.resource import Resource
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from .resources_api import ResourcesApi
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
class ProjectsApi(CRUDEntityApi[Project]):
|
|
@@ -10,14 +12,17 @@ class ProjectsApi(CRUDEntityApi[Project]):
|
|
|
10
12
|
|
|
11
13
|
def __init__(self,
|
|
12
14
|
config: ApiConfig,
|
|
13
|
-
client: httpx.Client | None = None
|
|
15
|
+
client: httpx.Client | None = None,
|
|
16
|
+
resources_api: 'ResourcesApi | None' = None) -> None:
|
|
14
17
|
"""Initialize the projects API handler.
|
|
15
18
|
|
|
16
19
|
Args:
|
|
17
20
|
config: API configuration containing base URL, API key, etc.
|
|
18
21
|
client: Optional HTTP client instance. If None, a new one will be created.
|
|
19
22
|
"""
|
|
23
|
+
from .resources_api import ResourcesApi
|
|
20
24
|
super().__init__(config, Project, 'projects', client)
|
|
25
|
+
self.resources_api = resources_api or ResourcesApi(config, client, projects_api=self)
|
|
21
26
|
|
|
22
27
|
def get_project_resources(self, project: Project | str) -> list[Resource]:
|
|
23
28
|
"""Get resources associated with a specific project.
|
|
@@ -30,7 +35,7 @@ class ProjectsApi(CRUDEntityApi[Project]):
|
|
|
30
35
|
"""
|
|
31
36
|
response = self._get_child_entities(project, 'resources')
|
|
32
37
|
resources_data = response.json()
|
|
33
|
-
resources = [
|
|
38
|
+
resources = [self.resources_api._init_entity_obj(**item) for item in resources_data]
|
|
34
39
|
return resources
|
|
35
40
|
|
|
36
41
|
def create(self,
|
|
@@ -70,7 +70,7 @@ class ResourcesApi(CreatableEntityApi[Resource], DeletableEntityApi[Resource]):
|
|
|
70
70
|
nest_asyncio.apply()
|
|
71
71
|
self.annotations_api = AnnotationsApi(
|
|
72
72
|
config, client, resources_api=self) if annotations_api is None else annotations_api
|
|
73
|
-
self.projects_api = ProjectsApi(config, client)
|
|
73
|
+
self.projects_api = projects_api or ProjectsApi(config, client, resources_api=self)
|
|
74
74
|
|
|
75
75
|
def get_list(self,
|
|
76
76
|
status: Optional[ResourceStatus] = None,
|
|
@@ -433,8 +433,14 @@ class ResourcesApi(CreatableEntityApi[Resource], DeletableEntityApi[Resource]):
|
|
|
433
433
|
)
|
|
434
434
|
return rid
|
|
435
435
|
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
try:
|
|
437
|
+
tasks = [__upload_single_resource(f, segfiles, metadata_file)
|
|
438
|
+
for f, segfiles, metadata_file in zip(files_path, segmentation_files, metadata_files)]
|
|
439
|
+
except ValueError:
|
|
440
|
+
msg = f"Error preparing upload tasks. Try `assemble_dicom=False`."
|
|
441
|
+
_LOGGER.error(msg)
|
|
442
|
+
_USER_LOGGER.error(msg)
|
|
443
|
+
raise
|
|
438
444
|
return await asyncio.gather(*tasks, return_exceptions=on_error == 'skip')
|
|
439
445
|
|
|
440
446
|
def upload_resources(self,
|
|
@@ -574,6 +574,8 @@ def _parse_args() -> tuple[Any, list[str], Optional[list[dict]], Optional[list[s
|
|
|
574
574
|
help='Automatically detect and include JSON metadata files with the same base name as NIFTI files')
|
|
575
575
|
parser.add_argument('--no-auto-detect-json', dest='auto_detect_json', action='store_false',
|
|
576
576
|
help='Disable automatic detection of JSON metadata files (default behavior)')
|
|
577
|
+
parser.add_argument('--no-assemble-dicoms', dest='assemble_dicoms', action='store_false', default=True,
|
|
578
|
+
help='Do not assemble DICOM files into series (default: assemble them)')
|
|
577
579
|
parser.add_argument('--version', action='version', version=f'%(prog)s {datamint_version}')
|
|
578
580
|
parser.add_argument('--verbose', action='store_true', help='Print debug messages', default=False)
|
|
579
581
|
args = parser.parse_args()
|
|
@@ -797,7 +799,7 @@ def main():
|
|
|
797
799
|
publish_to=args.project,
|
|
798
800
|
segmentation_files=segfiles,
|
|
799
801
|
transpose_segmentation=args.transpose_segmentation,
|
|
800
|
-
assemble_dicoms=
|
|
802
|
+
assemble_dicoms=args.assemble_dicoms,
|
|
801
803
|
metadata=metadata_files,
|
|
802
804
|
progress_bar=True
|
|
803
805
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "datamint"
|
|
3
3
|
description = "A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows."
|
|
4
|
-
version = "2.3.
|
|
4
|
+
version = "2.3.4"
|
|
5
5
|
dynamic = ["dependencies"]
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|