datamint 2.3.3__py3-none-any.whl → 2.9.0__py3-none-any.whl
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.
- datamint/__init__.py +1 -3
- datamint/api/__init__.py +0 -3
- datamint/api/base_api.py +286 -54
- datamint/api/client.py +76 -13
- datamint/api/endpoints/__init__.py +2 -2
- datamint/api/endpoints/annotations_api.py +186 -28
- datamint/api/endpoints/deploy_model_api.py +78 -0
- datamint/api/endpoints/models_api.py +1 -0
- datamint/api/endpoints/projects_api.py +38 -7
- datamint/api/endpoints/resources_api.py +227 -100
- datamint/api/entity_base_api.py +66 -7
- datamint/apihandler/base_api_handler.py +0 -1
- datamint/apihandler/dto/annotation_dto.py +2 -0
- datamint/client_cmd_tools/datamint_config.py +0 -1
- datamint/client_cmd_tools/datamint_upload.py +3 -1
- datamint/configs.py +11 -7
- datamint/dataset/base_dataset.py +24 -4
- datamint/dataset/dataset.py +1 -1
- datamint/entities/__init__.py +1 -1
- datamint/entities/annotations/__init__.py +13 -0
- datamint/entities/{annotation.py → annotations/annotation.py} +81 -47
- datamint/entities/annotations/image_classification.py +12 -0
- datamint/entities/annotations/image_segmentation.py +252 -0
- datamint/entities/annotations/volume_segmentation.py +273 -0
- datamint/entities/base_entity.py +100 -6
- datamint/entities/cache_manager.py +129 -15
- datamint/entities/datasetinfo.py +60 -65
- datamint/entities/deployjob.py +18 -0
- datamint/entities/project.py +39 -0
- datamint/entities/resource.py +310 -46
- datamint/lightning/__init__.py +1 -0
- datamint/lightning/datamintdatamodule.py +103 -0
- datamint/mlflow/__init__.py +65 -0
- datamint/mlflow/artifact/__init__.py +1 -0
- datamint/mlflow/artifact/datamint_artifacts_repo.py +8 -0
- datamint/mlflow/env_utils.py +131 -0
- datamint/mlflow/env_vars.py +5 -0
- datamint/mlflow/flavors/__init__.py +17 -0
- datamint/mlflow/flavors/datamint_flavor.py +150 -0
- datamint/mlflow/flavors/model.py +877 -0
- datamint/mlflow/lightning/callbacks/__init__.py +1 -0
- datamint/mlflow/lightning/callbacks/modelcheckpoint.py +410 -0
- datamint/mlflow/models/__init__.py +93 -0
- datamint/mlflow/tracking/datamint_store.py +76 -0
- datamint/mlflow/tracking/default_experiment.py +27 -0
- datamint/mlflow/tracking/fluent.py +91 -0
- datamint/utils/env.py +27 -0
- datamint/utils/visualization.py +21 -13
- datamint-2.9.0.dist-info/METADATA +220 -0
- datamint-2.9.0.dist-info/RECORD +73 -0
- {datamint-2.3.3.dist-info → datamint-2.9.0.dist-info}/WHEEL +1 -1
- datamint-2.9.0.dist-info/entry_points.txt +18 -0
- datamint/apihandler/exp_api_handler.py +0 -204
- datamint/experiment/__init__.py +0 -1
- datamint/experiment/_patcher.py +0 -570
- datamint/experiment/experiment.py +0 -1049
- datamint-2.3.3.dist-info/METADATA +0 -125
- datamint-2.3.3.dist-info/RECORD +0 -54
- datamint-2.3.3.dist-info/entry_points.txt +0 -4
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
import threading
|
|
3
|
+
import logging
|
|
4
|
+
from datamint import Api
|
|
5
|
+
from datamint.exceptions import DatamintException
|
|
6
|
+
import os
|
|
7
|
+
from datamint.mlflow.env_vars import EnvVars
|
|
8
|
+
from datamint.mlflow.env_utils import ensure_mlflow_configured
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from datamint.entities.project import Project
|
|
12
|
+
|
|
13
|
+
_PROJECT_LOCK = threading.Lock()
|
|
14
|
+
_LOGGER = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
_ACTIVE_PROJECT_ID: str | None = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_active_project_id() -> str | None:
|
|
20
|
+
"""
|
|
21
|
+
Get the active project ID from the environment variable or the global variable.
|
|
22
|
+
"""
|
|
23
|
+
global _ACTIVE_PROJECT_ID
|
|
24
|
+
|
|
25
|
+
if _ACTIVE_PROJECT_ID is not None:
|
|
26
|
+
return _ACTIVE_PROJECT_ID
|
|
27
|
+
# Check if the environment variable is set
|
|
28
|
+
project_id = os.getenv(EnvVars.DATAMINT_PROJECT_ID.value)
|
|
29
|
+
if project_id is not None:
|
|
30
|
+
_ACTIVE_PROJECT_ID = project_id
|
|
31
|
+
return project_id
|
|
32
|
+
project_name = os.getenv(EnvVars.DATAMINT_PROJECT_NAME.value)
|
|
33
|
+
if project_name is not None:
|
|
34
|
+
project = _find_project_by_name(project_name)
|
|
35
|
+
if project is not None:
|
|
36
|
+
_ACTIVE_PROJECT_ID = project['id']
|
|
37
|
+
return _ACTIVE_PROJECT_ID
|
|
38
|
+
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _find_project_by_name(project_name: str):
|
|
43
|
+
dt_client = Api(check_connection=False)
|
|
44
|
+
project = dt_client.projects.get_by_name(project_name)
|
|
45
|
+
if project is None:
|
|
46
|
+
raise DatamintException(f"Project with name '{project_name}' does not exist.")
|
|
47
|
+
return project
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _get_project_by_name_or_id(project_name_or_id: str) -> 'Project':
|
|
51
|
+
dt_client = Api(check_connection=False)
|
|
52
|
+
# If length >= 32, likely an ID
|
|
53
|
+
if len(project_name_or_id) >= 32 and ' ' not in project_name_or_id:
|
|
54
|
+
# Try to get by ID first
|
|
55
|
+
project = dt_client.projects.get_by_id(project_name_or_id)
|
|
56
|
+
if project is not None:
|
|
57
|
+
return project
|
|
58
|
+
project = dt_client.projects.get_by_name(project_name_or_id)
|
|
59
|
+
if project is None:
|
|
60
|
+
raise DatamintException(f"Project '{project_name_or_id}' does not exist.")
|
|
61
|
+
return project
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def set_project(project: 'Project | str'):
|
|
65
|
+
"""
|
|
66
|
+
Set the active project for the current session.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
project: The Project instance or project name/ID to set as active.
|
|
70
|
+
"""
|
|
71
|
+
global _ACTIVE_PROJECT_ID
|
|
72
|
+
|
|
73
|
+
# Ensure MLflow is properly configured before proceeding
|
|
74
|
+
ensure_mlflow_configured()
|
|
75
|
+
|
|
76
|
+
with _PROJECT_LOCK:
|
|
77
|
+
if isinstance(project, str):
|
|
78
|
+
project_id = None
|
|
79
|
+
project = _get_project_by_name_or_id(project)
|
|
80
|
+
project_id = project.id
|
|
81
|
+
else:
|
|
82
|
+
# It's a Project entity
|
|
83
|
+
project_id = project.id
|
|
84
|
+
|
|
85
|
+
_ACTIVE_PROJECT_ID = project_id
|
|
86
|
+
|
|
87
|
+
# Set 'DATAMINT_PROJECT_ID' environment variable
|
|
88
|
+
# so that subprocess can inherit it.
|
|
89
|
+
os.environ[EnvVars.DATAMINT_PROJECT_ID.value] = project_id
|
|
90
|
+
|
|
91
|
+
return project
|
datamint/utils/env.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
def is_jupyter_env():
|
|
2
|
+
"""Check if code is running in a Jupyter notebook environment."""
|
|
3
|
+
try:
|
|
4
|
+
# Check for IPython kernel
|
|
5
|
+
from IPython import get_ipython
|
|
6
|
+
if get_ipython() is None:
|
|
7
|
+
return False
|
|
8
|
+
|
|
9
|
+
# Check if it's specifically a notebook (not just IPython terminal)
|
|
10
|
+
if 'IPKernelApp' in get_ipython().config:
|
|
11
|
+
return True
|
|
12
|
+
except (ImportError, AttributeError):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
return False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_ASYNCIO_LOOP_PATCHED = False
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def ensure_asyncio_loop():
|
|
22
|
+
"""Ensure that the asyncio event loop is properly set up for Jupyter notebooks."""
|
|
23
|
+
global _ASYNCIO_LOOP_PATCHED
|
|
24
|
+
if not _ASYNCIO_LOOP_PATCHED and is_jupyter_env():
|
|
25
|
+
import nest_asyncio
|
|
26
|
+
nest_asyncio.apply()
|
|
27
|
+
_ASYNCIO_LOOP_PATCHED = True
|
datamint/utils/visualization.py
CHANGED
|
@@ -5,23 +5,26 @@ from torch import Tensor
|
|
|
5
5
|
import torchvision.utils
|
|
6
6
|
import torch
|
|
7
7
|
import colorsys
|
|
8
|
+
from collections.abc import Sequence
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
def show(imgs:
|
|
11
|
-
figsize: tuple[int, int] = None,
|
|
11
|
+
def show(imgs: Sequence[Tensor | np.ndarray] | Tensor | np.ndarray,
|
|
12
|
+
figsize: tuple[int, int] | None = None,
|
|
12
13
|
normalize: bool = False):
|
|
13
14
|
"""
|
|
14
15
|
Show a list of images in a grid.
|
|
15
16
|
Args:
|
|
16
|
-
imgs (
|
|
17
|
+
imgs (Sequence[Tensor | np.ndarray] | Tensor | np.ndarray): List of images to show.
|
|
17
18
|
Each image should be a tensor of shape (C, H, W) and dtype uint8 or float.
|
|
18
19
|
figsize (tuple[int, int], optional): Size of the figure. Defaults to None.
|
|
19
20
|
normalize (bool, optional): Whether to normalize the images to [0, 1] range by min-max scaling.
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
|
-
if not isinstance(imgs, list):
|
|
23
|
+
if not isinstance(imgs, list) and not isinstance(imgs, tuple):
|
|
23
24
|
imgs = [imgs]
|
|
24
25
|
|
|
26
|
+
imgs = [img if isinstance(img, torch.Tensor) else torch.from_numpy(img) for img in imgs]
|
|
27
|
+
|
|
25
28
|
if normalize:
|
|
26
29
|
for i, img in enumerate(imgs):
|
|
27
30
|
img = img.float()
|
|
@@ -72,10 +75,10 @@ def generate_color_palette(num_objects: int) -> list[tuple[int, int, int]]:
|
|
|
72
75
|
return colors
|
|
73
76
|
|
|
74
77
|
|
|
75
|
-
@torch.
|
|
78
|
+
@torch.inference_mode()
|
|
76
79
|
def draw_masks(
|
|
77
|
-
image: Tensor,
|
|
78
|
-
masks: Tensor,
|
|
80
|
+
image: Tensor | np.ndarray,
|
|
81
|
+
masks: Tensor | np.ndarray,
|
|
79
82
|
alpha: float = 0.5,
|
|
80
83
|
colors: list[str | tuple[int, int, int]] | str | tuple[int, int, int] | None = None,
|
|
81
84
|
) -> Tensor:
|
|
@@ -85,7 +88,7 @@ def draw_masks(
|
|
|
85
88
|
The image values should be uint8 or float.
|
|
86
89
|
|
|
87
90
|
Args:
|
|
88
|
-
image (Tensor): Tensor of shape (3, H, W) and dtype uint8 or float.
|
|
91
|
+
image (Tensor): Tensor of shape (3, H, W) or (H, W) and dtype uint8 or float.
|
|
89
92
|
masks (Tensor): Tensor of shape (num_masks, H, W) or (H, W) and dtype bool.
|
|
90
93
|
alpha (float): Float number between 0 and 1 denoting the transparency of the masks.
|
|
91
94
|
0 means full transparency, 1 means no transparency.
|
|
@@ -97,11 +100,19 @@ def draw_masks(
|
|
|
97
100
|
Returns:
|
|
98
101
|
img (Tensor[C, H, W]): Image Tensor, with segmentation masks drawn on top.
|
|
99
102
|
"""
|
|
100
|
-
|
|
103
|
+
|
|
104
|
+
if isinstance(image, np.ndarray):
|
|
105
|
+
image = torch.from_numpy(image)
|
|
106
|
+
|
|
107
|
+
if isinstance(masks, np.ndarray):
|
|
108
|
+
masks = torch.from_numpy(masks)
|
|
101
109
|
|
|
102
110
|
if image.ndim == 3 and image.shape[0] == 1:
|
|
103
111
|
# convert to RGB
|
|
104
112
|
image = image.expand(3, -1, -1)
|
|
113
|
+
if image.ndim == 2:
|
|
114
|
+
# convert to RGB
|
|
115
|
+
image = image.unsqueeze(0).expand(3, -1, -1)
|
|
105
116
|
|
|
106
117
|
if masks.dtype != torch.bool:
|
|
107
118
|
masks = masks.bool()
|
|
@@ -113,10 +124,7 @@ def draw_masks(
|
|
|
113
124
|
image = image / image.max()
|
|
114
125
|
|
|
115
126
|
if masks.ndim == 2:
|
|
116
|
-
|
|
117
|
-
masks=masks,
|
|
118
|
-
alpha=alpha,
|
|
119
|
-
colors=colors)
|
|
127
|
+
masks = masks.unsqueeze(0)
|
|
120
128
|
|
|
121
129
|
if colors is None:
|
|
122
130
|
colors = generate_color_palette(len(masks))
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datamint
|
|
3
|
+
Version: 2.9.0
|
|
4
|
+
Summary: A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Provides-Extra: docs
|
|
14
|
+
Requires-Dist: Deprecated (>=1.2.0)
|
|
15
|
+
Requires-Dist: aiohttp (>=3.0.0,<4.0.0)
|
|
16
|
+
Requires-Dist: aioresponses (>=0.7.8,<0.8.0) ; extra == "dev"
|
|
17
|
+
Requires-Dist: albumentations (>=2.0.0)
|
|
18
|
+
Requires-Dist: backports-strenum ; python_version < "3.11"
|
|
19
|
+
Requires-Dist: certifi (>=2025.0.0)
|
|
20
|
+
Requires-Dist: httpx
|
|
21
|
+
Requires-Dist: humanize (>=4.0.0,<5.0.0)
|
|
22
|
+
Requires-Dist: lazy-loader (>=0.3.0)
|
|
23
|
+
Requires-Dist: lightning[extra] (>=2.0.0,!=2.5.1,!=2.5.1.post0)
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
|
+
Requires-Dist: medimgkit (>=0.11.2)
|
|
26
|
+
Requires-Dist: mlflow (>=3.8.1)
|
|
27
|
+
Requires-Dist: nest-asyncio (>=1.0.0,<2.0.0)
|
|
28
|
+
Requires-Dist: nibabel (>=4.0.0)
|
|
29
|
+
Requires-Dist: numpy
|
|
30
|
+
Requires-Dist: opencv-python (>=4.0.0)
|
|
31
|
+
Requires-Dist: pandas (>=2.0.0)
|
|
32
|
+
Requires-Dist: platformdirs (>=4.0.0,<5.0.0)
|
|
33
|
+
Requires-Dist: pydantic (>=2.6.4)
|
|
34
|
+
Requires-Dist: pydicom (>=3.0.0,<4.0.0)
|
|
35
|
+
Requires-Dist: pylibjpeg (>=2.0.0,<3.0.0)
|
|
36
|
+
Requires-Dist: pylibjpeg-libjpeg (>=2.0.0,<3.0.0)
|
|
37
|
+
Requires-Dist: pytest (>=7.0.0,<8.0.0) ; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov (>=4.0.0,<5.0.0) ; extra == "dev"
|
|
39
|
+
Requires-Dist: pyyaml (>=5.0.0)
|
|
40
|
+
Requires-Dist: requests (>=2.0.0,<3.0.0)
|
|
41
|
+
Requires-Dist: responses (>=0.20.0,<0.21.0) ; extra == "dev"
|
|
42
|
+
Requires-Dist: respx (>=0.22.0) ; extra == "dev"
|
|
43
|
+
Requires-Dist: rich (>=10.0.0)
|
|
44
|
+
Requires-Dist: setuptools (>=57.0) ; extra == "docs"
|
|
45
|
+
Requires-Dist: sphinx (>=5.0) ; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx-tabs (>=3.0.0) ; extra == "docs"
|
|
47
|
+
Requires-Dist: sphinx_rtd_theme (>=2.0.0) ; extra == "docs"
|
|
48
|
+
Requires-Dist: torch (>=1.2.0,!=2.3.0)
|
|
49
|
+
Requires-Dist: torchvision (>=0.18.0)
|
|
50
|
+
Requires-Dist: tqdm (>=4.0.0,<5.0.0)
|
|
51
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
53
|
+
|
|
54
|
+
# Datamint Python API
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
[](https://www.python.org/downloads/)
|
|
58
|
+
|
|
59
|
+
A comprehensive Python SDK for interacting with the Datamint platform, providing seamless integration for medical imaging workflows, dataset management, and machine learning experiments.
|
|
60
|
+
|
|
61
|
+
## 📋 Table of Contents
|
|
62
|
+
|
|
63
|
+
- [Features](#-features)
|
|
64
|
+
- [Installation](#-installation)
|
|
65
|
+
- [Quick Setup](#-setup-api-key)
|
|
66
|
+
- [Documentation](#-documentation)
|
|
67
|
+
- [Command Line Tools](#️-command-line-tools)
|
|
68
|
+
- [Support](#-support)
|
|
69
|
+
|
|
70
|
+
## 🚀 Features
|
|
71
|
+
|
|
72
|
+
- **Dataset Management**: Download, upload, and manage medical imaging datasets
|
|
73
|
+
- **Annotation Tools**: Create, upload, and manage annotations (segmentations, labels, measurements)
|
|
74
|
+
- **Experiment Tracking**: Integrated MLflow support for experiment management
|
|
75
|
+
- **PyTorch Lightning Integration**: Streamlined ML workflows with Lightning DataModules and callbacks
|
|
76
|
+
- **DICOM Support**: Native handling of DICOM files with anonymization capabilities
|
|
77
|
+
- **Multi-format Support**: PNG, JPEG, NIfTI, and other medical imaging formats
|
|
78
|
+
|
|
79
|
+
See the full documentation at https://sonanceai.github.io/datamint-python-api/
|
|
80
|
+
|
|
81
|
+
## 📦 Installation
|
|
82
|
+
|
|
83
|
+
> [!NOTE]
|
|
84
|
+
> We recommend using a virtual environment to avoid package conflicts.
|
|
85
|
+
|
|
86
|
+
### From PyPI
|
|
87
|
+
|
|
88
|
+
`pip install -U datamint`
|
|
89
|
+
|
|
90
|
+
### Virtual Environment Setup
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary>Click to expand virtual environment setup instructions</summary>
|
|
94
|
+
|
|
95
|
+
We recommend that you install Datamint in a dedicated virtual environment, to avoid conflicting with your system packages.
|
|
96
|
+
For instance, create the enviroment once with `python3 -m venv datamint-env` and then activate it whenever you need it with:
|
|
97
|
+
|
|
98
|
+
1. **Create the environment** (one-time setup):
|
|
99
|
+
```bash
|
|
100
|
+
python3 -m venv datamint-env
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
2. **Activate the environment** (run whenever you need it):
|
|
104
|
+
|
|
105
|
+
| Platform | Command |
|
|
106
|
+
|----------|---------|
|
|
107
|
+
| Linux/macOS | `source datamint-env/bin/activate` |
|
|
108
|
+
| Windows CMD | `datamint-env\Scripts\activate.bat` |
|
|
109
|
+
| Windows PowerShell | `datamint-env\Scripts\Activate.ps1` |
|
|
110
|
+
|
|
111
|
+
3. **Install the package**:
|
|
112
|
+
```bash
|
|
113
|
+
pip install datamint
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
## ⚙ Setup API key
|
|
119
|
+
|
|
120
|
+
To use the Datamint API, you need to setup your API key (ask your administrator if you don't have one). Use one of the following methods to setup your API key:
|
|
121
|
+
|
|
122
|
+
### Method 1: Command-line tool (recommended)
|
|
123
|
+
|
|
124
|
+
Run ``datamint-config`` in the terminal and follow the instructions. See [command_line_tools](https://sonanceai.github.io/datamint-python-api/command_line_tools.html#configuring-the-datamint-settings) for more details.
|
|
125
|
+
|
|
126
|
+
### Method 2: Environment variable
|
|
127
|
+
|
|
128
|
+
Specify the API key as an environment variable.
|
|
129
|
+
|
|
130
|
+
**Bash:**
|
|
131
|
+
```bash
|
|
132
|
+
export DATAMINT_API_KEY="my_api_key"
|
|
133
|
+
# run your commands (e.g., `datamint-upload`, `python script.py`)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Python:**
|
|
137
|
+
```python
|
|
138
|
+
import os
|
|
139
|
+
os.environ["DATAMINT_API_KEY"] = "my_api_key"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 📚 Documentation
|
|
143
|
+
|
|
144
|
+
| Resource | Description |
|
|
145
|
+
|----------|-------------|
|
|
146
|
+
| [🚀 Getting Started](https://sonanceai.github.io/datamint-python-api/getting_started.html) | Step-by-step setup and basic usage |
|
|
147
|
+
| [📖 API Reference](https://sonanceai.github.io/datamint-python-api/client_api.html) | Complete API documentation |
|
|
148
|
+
| [🔥 PyTorch Integration](https://sonanceai.github.io/datamint-python-api/pytorch_integration.html) | ML workflow integration |
|
|
149
|
+
| [💡 Examples](examples/) | Practical usage examples |
|
|
150
|
+
|
|
151
|
+
## 🛠️ Command Line Tools
|
|
152
|
+
|
|
153
|
+
Full documentation at [command_line_tools](https://sonanceai.github.io/datamint-python-api/command_line_tools.html).
|
|
154
|
+
|
|
155
|
+
### Upload Resources
|
|
156
|
+
|
|
157
|
+
**Upload DICOM files with anonymization:**
|
|
158
|
+
```bash
|
|
159
|
+
datamint-upload /path/to/dicoms --recursive --channel "training-data" --publish --tag "my_data_tag"
|
|
160
|
+
```
|
|
161
|
+
It anonymizes by default.
|
|
162
|
+
|
|
163
|
+
### Configuration Management
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Interactive setup
|
|
167
|
+
datamint-config
|
|
168
|
+
|
|
169
|
+
# Set API key
|
|
170
|
+
datamint-config --api-key "your-key"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 🔒 SSL Certificate Troubleshooting
|
|
174
|
+
|
|
175
|
+
If you encounter SSL certificate verification errors like:
|
|
176
|
+
```
|
|
177
|
+
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Quick Fix
|
|
181
|
+
|
|
182
|
+
**1. Upgrade certifi:**
|
|
183
|
+
```bash
|
|
184
|
+
pip install --upgrade certifi
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**2. Set environment variables:**
|
|
188
|
+
```bash
|
|
189
|
+
export SSL_CERT_FILE=$(python -m certifi)
|
|
190
|
+
export REQUESTS_CA_BUNDLE=$(python -m certifi)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**3. Run your script:**
|
|
194
|
+
```bash
|
|
195
|
+
python your_script.py
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Alternative Solutions
|
|
199
|
+
|
|
200
|
+
**Option 1: Use Custom CA Bundle**
|
|
201
|
+
```python
|
|
202
|
+
from datamint import Api
|
|
203
|
+
|
|
204
|
+
api = Api(verify_ssl="/path/to/your/ca-bundle.crt")
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Option 2: Disable SSL Verification (Development Only)**
|
|
208
|
+
```python
|
|
209
|
+
from datamint import Api
|
|
210
|
+
|
|
211
|
+
# ⚠️ WARNING: Only use in development with self-signed certificates
|
|
212
|
+
api = Api(verify_ssl=False)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 🆘 Support
|
|
216
|
+
|
|
217
|
+
[Full Documentation](https://datamint-python-api.readthedocs.io/)
|
|
218
|
+
[GitHub Issues](https://github.com/SonanceAI/datamint-python-api/issues)
|
|
219
|
+
|
|
220
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
datamint/__init__.py,sha256=Vr7_9b6xQva-hNmCWH8Xw6ejH2v_tJGpoFepmLhFxks,729
|
|
2
|
+
datamint/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
datamint/api/base_api.py,sha256=EijBpBDJbwJ4MkWPN1ZnKz5SR-QxB2gq4FKj4HOAr7c,28584
|
|
4
|
+
datamint/api/client.py,sha256=o9BQUe7iYJGUn6rNjRg6vv_SlIUXYVU8N0YpRNFznFw,6455
|
|
5
|
+
datamint/api/dto/__init__.py,sha256=fUi901Zs-q5XHyWwZ4dMi2fEO8-CUEVEdYbpd17lahc,416
|
|
6
|
+
datamint/api/endpoints/__init__.py,sha256=_lSweXuAr6FWbuf5rsM1O3rp1p0P8oGfNngFjkNfLZ4,545
|
|
7
|
+
datamint/api/endpoints/annotations_api.py,sha256=GIeKomiYL27IgHoxUCsT-YsOqf3-1jLeIMLds79S2Xk,57174
|
|
8
|
+
datamint/api/endpoints/annotationsets_api.py,sha256=NIsPIjGGptiUBxHft-EhOMRG-DsQAthheVqd7ph0id4,409
|
|
9
|
+
datamint/api/endpoints/channels_api.py,sha256=oQqxSw9DJzAqtVQI7-tc1llTdnsm-URx8jwtXNXnhio,867
|
|
10
|
+
datamint/api/endpoints/datasetsinfo_api.py,sha256=WdzrUzK63w9gvAP6U--P65FbD-3X-jm9TPCcYnRNjas,597
|
|
11
|
+
datamint/api/endpoints/deploy_model_api.py,sha256=pOQWNxoKcrxOd7x9GM1AhPjh9ckbrvg6Jd9MtBvTxZQ,3169
|
|
12
|
+
datamint/api/endpoints/models_api.py,sha256=IKLaO5oC7Kc6_5XeCMIN4YpSDOiMOIzHgdFIQPRWEOw,1544
|
|
13
|
+
datamint/api/endpoints/projects_api.py,sha256=VNOi-yzuHNMhC3hKl4-btv02KdSs9DlpKw8mOThKvOU,9120
|
|
14
|
+
datamint/api/endpoints/resources_api.py,sha256=BQNy2p82VpewOmr88f_YvSVOthZZYb7swaget4E2AGM,55797
|
|
15
|
+
datamint/api/endpoints/users_api.py,sha256=pnkuTZ1B9Y0FtwwvXO8J64e02RSkRxnBmTl9UGSuC5I,1186
|
|
16
|
+
datamint/api/entity_base_api.py,sha256=Kiedud8TIgaPDADGZvylCqbOSeET6U1YjkNUqDo9qBg,14583
|
|
17
|
+
datamint/apihandler/annotation_api_handler.py,sha256=W3vV4z3BqX1OQe1r7zr8dI-IVu4zUDxED4QttdiWV-E,57098
|
|
18
|
+
datamint/apihandler/api_handler.py,sha256=mL0gMaWePYa7zwkw92E-VMK2WjpcPt7au0KqnmsWSYw,439
|
|
19
|
+
datamint/apihandler/base_api_handler.py,sha256=VrQvCkCmWPHLVcK-zl764Ay7toiEJ2W9c2hymz63pro,11668
|
|
20
|
+
datamint/apihandler/dto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
datamint/apihandler/dto/annotation_dto.py,sha256=4tpcet0-ShCMhrflk9H3CEX5tnhWZqw4Doft1B2E260,7341
|
|
22
|
+
datamint/apihandler/root_api_handler.py,sha256=jBof_XPTeq4o41CW-l-I5GHQKVa76kaX75RovS_qAM4,63384
|
|
23
|
+
datamint/client_cmd_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
datamint/client_cmd_tools/datamint_config.py,sha256=b1FgHMhX757CZjOsCm_FzKL2_2nachAMy6FYYlT0od0,16197
|
|
25
|
+
datamint/client_cmd_tools/datamint_upload.py,sha256=zGNEylfS2P5XUyzBz44ruHjoyAoKZFwZbw4wRVANEL8,36279
|
|
26
|
+
datamint/configs.py,sha256=teZXU5303-FuiDa1GgxEdAlailXi9uKob8j2wJi76YM,1772
|
|
27
|
+
datamint/dataset/__init__.py,sha256=4PlUKSvVhdfQvvuq8jQXrkdqnot-iTTizM3aM1vgSwg,47
|
|
28
|
+
datamint/dataset/annotation.py,sha256=qN1IMjdfLD2ceQ6va3l76jOXA8Vb_c-eBk1oWQu6hW0,7994
|
|
29
|
+
datamint/dataset/base_dataset.py,sha256=H287VgKyxoy2taiaekEgXJwNOv-Peyo50nscbI1FyOQ,50824
|
|
30
|
+
datamint/dataset/dataset.py,sha256=UuHf7ODC-4dXVP89HwzOpbZrx6w2QTXNq-NVQU5-320,28941
|
|
31
|
+
datamint/entities/__init__.py,sha256=S7FgnNmdLcVuoBQvhJNHkcpQQXj6lg_7X1uNeuX811Q,516
|
|
32
|
+
datamint/entities/annotations/__init__.py,sha256=wucS0Z5lgXcwMkkIxPP0QuxmebNqhgCXut8LhuIEvPY,402
|
|
33
|
+
datamint/entities/annotations/annotation.py,sha256=87xUJorhnSrNeJ3P_K9WFiEkmE1B-t36uARwOCZr__w,10283
|
|
34
|
+
datamint/entities/annotations/image_classification.py,sha256=Ea6TDjZypP2q9REPoOZrBU9Ym9LP5Dg-BP_vBLkWqRE,438
|
|
35
|
+
datamint/entities/annotations/image_segmentation.py,sha256=WRcUi9QrIOzSPnVDLOxw1xWACM2qQHVw_TpmGevOi5o,7480
|
|
36
|
+
datamint/entities/annotations/volume_segmentation.py,sha256=-IU1ujBDHXBBwgg-kZKjMhMz9-z22Ka_59r8YlyVVrw,9174
|
|
37
|
+
datamint/entities/base_entity.py,sha256=x1YfruyjwNFzAIBeHFD6SoxVtkXHo1w6sC-a1OUsnU0,7608
|
|
38
|
+
datamint/entities/cache_manager.py,sha256=2wkyA28xEFbyPqHycSxFexbq39L_LzNQgO7k_ekaJZY,14692
|
|
39
|
+
datamint/entities/channel.py,sha256=9fl22eSx_ng98NosfQGs18cdaRdbeC3wXL61KhSg4Zo,1601
|
|
40
|
+
datamint/entities/datasetinfo.py,sha256=B6zDrcBfgsdHfsq5N_DB_WZ2HrALpqfzy-6aH0eM2uo,4019
|
|
41
|
+
datamint/entities/deployjob.py,sha256=s4KGRJmpND0wsKrLmYrLzi29T1AAomhz4FqdTx-yHkk,514
|
|
42
|
+
datamint/entities/project.py,sha256=5xQUTodjPI47iYJRx6hUVKO7cXPR5NWYweuBdApVm_k,6026
|
|
43
|
+
datamint/entities/resource.py,sha256=U9_w2T9U8uzv9ztcl7cWL9SadyU4-6x8uhSG-eDKnE0,19475
|
|
44
|
+
datamint/entities/user.py,sha256=MREHDOsV9NOBEbXqiQ2ww6DmetN07CELId-ZQVpZCb8,620
|
|
45
|
+
datamint/examples/__init__.py,sha256=zcYnd5nLVme9GCTPYH-1JpGo8xXK2WEYvhzcy_2alZc,39
|
|
46
|
+
datamint/examples/example_projects.py,sha256=sU-Gxy7PPqA0WUfN-ZmXV-0YnwrnzpJ79lMXTJp2DzU,2804
|
|
47
|
+
datamint/exceptions.py,sha256=Or-NNj8pgChzAZNaWtkX1WyHJ2q5GziyvHdFLYymvX0,1661
|
|
48
|
+
datamint/lightning/__init__.py,sha256=8Od8e-nWi4pNn1m5CQsIV8ElitVEUoHxEBiT2GVfJUc,50
|
|
49
|
+
datamint/lightning/datamintdatamodule.py,sha256=yTch-H0QCAQh_lwls8sCfofKqP0nPssy0CpSsO8QeEI,4038
|
|
50
|
+
datamint/logging.yaml,sha256=tOMxtc2UmwlIMTK6ljtnBwTco1PNrPeq3mx2iMuSbiw,482
|
|
51
|
+
datamint/mlflow/__init__.py,sha256=vQP9MR_1Nf_A4L_rdBCNPD7Oaj9Cxj2GVMQ-eCfmnEA,2427
|
|
52
|
+
datamint/mlflow/artifact/__init__.py,sha256=XwZ4u63VoB9EdAx3mTwoOp-2PmMfa7KPBVPV0kZFUh0,64
|
|
53
|
+
datamint/mlflow/artifact/datamint_artifacts_repo.py,sha256=e97U4SF1bq8j_OTiZofuY92eIdgBuw9J8cyhW72ez6A,353
|
|
54
|
+
datamint/mlflow/env_utils.py,sha256=Q9STQdFyk1f1Lkf3ZvU6xf0EcPoivx2dPDBeVdgwT5Q,4815
|
|
55
|
+
datamint/mlflow/env_vars.py,sha256=H3iteY7o_Jj3_EU9vREBE4s62SZMmiO6-ubC5_xG2kU,144
|
|
56
|
+
datamint/mlflow/flavors/__init__.py,sha256=GTJqHZT_TiNirIOto-42AMKKbXXyChQQdoLpMh6t_fE,274
|
|
57
|
+
datamint/mlflow/flavors/datamint_flavor.py,sha256=Y6BMAJ4neltz1SiL-uxgM5FUePEwAAMpDiH8RmTpc18,5335
|
|
58
|
+
datamint/mlflow/flavors/model.py,sha256=4kaz9C4KZV1ZDcrhFzvn89Pw8Aq_sN_pxyBsbL-O01o,33511
|
|
59
|
+
datamint/mlflow/lightning/callbacks/__init__.py,sha256=4Y-54OFIKBiwD_AwbWr2JRNyWBYsz9vnagfZfKgdKA0,50
|
|
60
|
+
datamint/mlflow/lightning/callbacks/modelcheckpoint.py,sha256=Lry9RR8HJM6NOw_vPJ7RG7VLUI6WGa9NzBO1Z77bRZc,18124
|
|
61
|
+
datamint/mlflow/models/__init__.py,sha256=LgTImfBg3OY8cWCzQw1Af_e9VY0IOIj66BQ8sY_U3TI,3608
|
|
62
|
+
datamint/mlflow/tracking/datamint_store.py,sha256=h24dtseWJlJFYiOYkXP2JaT_XAOand3a8KNcAq33wkQ,3180
|
|
63
|
+
datamint/mlflow/tracking/default_experiment.py,sha256=gzrIZng0DpI2GWa8X30JVAq2fteq4w8cg4nz3UxYCvc,934
|
|
64
|
+
datamint/mlflow/tracking/fluent.py,sha256=brvShypy167sbJ8mAtu5prASDFeOAsXkO6Fm85PmjPM,2852
|
|
65
|
+
datamint/types.py,sha256=2OaY5QJvQIJKxyMNJYzxBksKCa9ZS2gb_ayJrByvu2Y,410
|
|
66
|
+
datamint/utils/env.py,sha256=lItXhaAKto6hB33yZ9369fxolrobeZSGXI3-L3_WoqA,789
|
|
67
|
+
datamint/utils/logging_utils.py,sha256=9pRoaPrWu2jOdDCiAoUsjEdP5ZwaealWL3hjUqFvx9g,4022
|
|
68
|
+
datamint/utils/torchmetrics.py,sha256=lwU0nOtsSWfebyp7dvjlAggaqXtj5ohSEUXOg3L0hJE,2837
|
|
69
|
+
datamint/utils/visualization.py,sha256=6xmVbKIkpcyOf_f0lmv_GG8JrrWZe7s_YzP_YC8H1MU,4751
|
|
70
|
+
datamint-2.9.0.dist-info/METADATA,sha256=hMQPkCTwu_SO_J275fMlpmXCzdeT7Zt8JCMHH9qmZ40,7249
|
|
71
|
+
datamint-2.9.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
72
|
+
datamint-2.9.0.dist-info/entry_points.txt,sha256=wTr9DXteCfAFqLUstN1Qx_SqC_rFLrAUIcDx9q1eXZw,845
|
|
73
|
+
datamint-2.9.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
datamint-config=datamint.client_cmd_tools.datamint_config:main
|
|
3
|
+
datamint-upload=datamint.client_cmd_tools.datamint_upload:main
|
|
4
|
+
|
|
5
|
+
[mlflow.artifact_repository]
|
|
6
|
+
datamint=datamint.mlflow.artifact.datamint_artifacts_repo:DatamintArtifactsRepository
|
|
7
|
+
http=datamint.mlflow.artifact.datamint_artifacts_repo:DatamintArtifactsRepository
|
|
8
|
+
https=datamint.mlflow.artifact.datamint_artifacts_repo:DatamintArtifactsRepository
|
|
9
|
+
mlflow-artifacts=datamint.mlflow.artifact.datamint_artifacts_repo:DatamintArtifactsRepository
|
|
10
|
+
|
|
11
|
+
[mlflow.default_experiment_provider]
|
|
12
|
+
datamint=datamint.mlflow.tracking.default_experiment:DatamintExperimentProvider
|
|
13
|
+
|
|
14
|
+
[mlflow.tracking_store]
|
|
15
|
+
datamint=datamint.mlflow.tracking.datamint_store:DatamintStore
|
|
16
|
+
http=datamint.mlflow.tracking.datamint_store:DatamintStore
|
|
17
|
+
https=datamint.mlflow.tracking.datamint_store:DatamintStore
|
|
18
|
+
|