datamint 1.2.4__tar.gz → 1.3.0__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-1.2.4 → datamint-1.3.0}/PKG-INFO +5 -5
- {datamint-1.2.4 → datamint-1.3.0}/README.md +3 -4
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/__init__.py +4 -3
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/annotation_api_handler.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/api_handler.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/base_api_handler.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/dto/annotation_dto.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/exp_api_handler.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/apihandler/root_api_handler.py +3 -3
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/client_cmd_tools/datamint_config.py +3 -3
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/client_cmd_tools/datamint_upload.py +7 -7
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/dataset/base_dataset.py +5 -5
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/dataset/dataset.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/examples/example_projects.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/experiment/_patcher.py +1 -1
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/experiment/experiment.py +18 -18
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/logging.yaml +2 -2
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/utils/logging_utils.py +1 -1
- {datamint-1.2.4 → datamint-1.3.0}/pyproject.toml +7 -5
- datamint-1.2.4/datamint/__init__.py +0 -11
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/client_cmd_tools/__init__.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/configs.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/dataset/__init__.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/examples/__init__.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/experiment/__init__.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/utils/dicom_utils.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/utils/io_utils.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/utils/torchmetrics.py +0 -0
- {datamint-1.2.4/datamintapi → datamint-1.3.0/datamint}/utils/visualization.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: datamint
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
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
|
|
@@ -14,6 +14,7 @@ Requires-Dist: Deprecated (>=1.2.0)
|
|
|
14
14
|
Requires-Dist: aiohttp (>=3.0.0,<4.0.0)
|
|
15
15
|
Requires-Dist: aioresponses (>=0.7.8,<0.8.0) ; extra == "dev"
|
|
16
16
|
Requires-Dist: albumentations (>=2.0.0)
|
|
17
|
+
Requires-Dist: datamintapi (==0.0.*)
|
|
17
18
|
Requires-Dist: humanize (>=4.0.0,<5.0.0)
|
|
18
19
|
Requires-Dist: lazy-loader (>=0.3.0)
|
|
19
20
|
Requires-Dist: lightning
|
|
@@ -52,13 +53,12 @@ See the full documentation at https://sonanceai.github.io/datamint-python-api/
|
|
|
52
53
|
## Installation
|
|
53
54
|
|
|
54
55
|
Datamint requires Python 3.10+.
|
|
55
|
-
You can install Datamint and its dependencies using pip
|
|
56
|
+
You can install/update Datamint and its dependencies using pip
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
|
-
pip install
|
|
59
|
+
pip install -U datamint
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
Soon we will be releasing the package on PyPi.
|
|
62
62
|
We recommend that you install Datamint in a dedicated virtual environment, to avoid conflicting with your system packages.
|
|
63
63
|
Create the enviroment once with `python3 -m venv datamint-env` and then activate it whenever you need it with:
|
|
64
64
|
- `source datamint-env/bin/activate` (Linux/MAC)
|
|
@@ -95,7 +95,7 @@ os.environ["DATAMINT_API_KEY"] = "my_api_key"
|
|
|
95
95
|
Specify API key in the |APIHandlerClass| constructor:
|
|
96
96
|
|
|
97
97
|
```python
|
|
98
|
-
from
|
|
98
|
+
from datamint import APIHandler
|
|
99
99
|
api = APIHandler(api_key='my_api_key')
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -8,13 +8,12 @@ See the full documentation at https://sonanceai.github.io/datamint-python-api/
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
Datamint requires Python 3.10+.
|
|
11
|
-
You can install Datamint and its dependencies using pip
|
|
11
|
+
You can install/update Datamint and its dependencies using pip
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
pip install
|
|
14
|
+
pip install -U datamint
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Soon we will be releasing the package on PyPi.
|
|
18
17
|
We recommend that you install Datamint in a dedicated virtual environment, to avoid conflicting with your system packages.
|
|
19
18
|
Create the enviroment once with `python3 -m venv datamint-env` and then activate it whenever you need it with:
|
|
20
19
|
- `source datamint-env/bin/activate` (Linux/MAC)
|
|
@@ -51,7 +50,7 @@ os.environ["DATAMINT_API_KEY"] = "my_api_key"
|
|
|
51
50
|
Specify API key in the |APIHandlerClass| constructor:
|
|
52
51
|
|
|
53
52
|
```python
|
|
54
|
-
from
|
|
53
|
+
from datamint import APIHandler
|
|
55
54
|
api = APIHandler(api_key='my_api_key')
|
|
56
55
|
```
|
|
57
56
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Datamint API
|
|
2
|
+
Datamint API package alias.
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
import importlib.metadata
|
|
5
6
|
from typing import TYPE_CHECKING
|
|
6
7
|
if TYPE_CHECKING:
|
|
@@ -21,5 +22,5 @@ else:
|
|
|
21
22
|
},
|
|
22
23
|
)
|
|
23
24
|
|
|
24
|
-
__name__ = "
|
|
25
|
-
__version__ = importlib.metadata.version(
|
|
25
|
+
__name__ = "datamint"
|
|
26
|
+
__version__ = importlib.metadata.version(__name__)
|
|
@@ -541,7 +541,7 @@ class AnnotationAPIHandler(BaseAPIHandler):
|
|
|
541
541
|
|
|
542
542
|
Args:
|
|
543
543
|
resource_id (Optional[str]): The resource unique id.
|
|
544
|
-
annotation_type (Optional[str]): The annotation type. See :class:`~
|
|
544
|
+
annotation_type (Optional[str]): The annotation type. See :class:`~datamint.dto.annotation_dto.AnnotationType`.
|
|
545
545
|
annotator_email (Optional[str]): The annotator email.
|
|
546
546
|
date_from (Optional[date]): The start date.
|
|
547
547
|
date_to (Optional[date]): The end date.
|
|
@@ -13,7 +13,7 @@ from io import BytesIO
|
|
|
13
13
|
import cv2
|
|
14
14
|
import nibabel as nib
|
|
15
15
|
from nibabel.filebasedimages import FileBasedImage as nib_FileBasedImage
|
|
16
|
-
from
|
|
16
|
+
from datamint import configs
|
|
17
17
|
from functools import wraps
|
|
18
18
|
|
|
19
19
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -18,7 +18,7 @@ import json
|
|
|
18
18
|
from typing import Any, TypeAlias, Literal
|
|
19
19
|
import logging
|
|
20
20
|
from enum import Enum
|
|
21
|
-
from
|
|
21
|
+
from datamint.utils.dicom_utils import pixel_to_patient
|
|
22
22
|
import pydicom
|
|
23
23
|
import numpy as np
|
|
24
24
|
|
|
@@ -6,8 +6,8 @@ from requests.exceptions import HTTPError
|
|
|
6
6
|
import logging
|
|
7
7
|
import asyncio
|
|
8
8
|
import aiohttp
|
|
9
|
-
from
|
|
10
|
-
from
|
|
9
|
+
from datamint.utils.dicom_utils import anonymize_dicom, to_bytesio, is_dicom
|
|
10
|
+
from datamint.utils import dicom_utils
|
|
11
11
|
import pydicom
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from datetime import date
|
|
@@ -15,7 +15,7 @@ import mimetypes
|
|
|
15
15
|
from PIL import Image
|
|
16
16
|
import cv2
|
|
17
17
|
from nibabel.filebasedimages import FileBasedImage as nib_FileBasedImage
|
|
18
|
-
from
|
|
18
|
+
from datamint import configs
|
|
19
19
|
from .base_api_handler import BaseAPIHandler, DatamintException, ResourceNotFoundError, ResourceFields, ResourceStatus
|
|
20
20
|
from deprecated.sphinx import deprecated
|
|
21
21
|
import json
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
-
from
|
|
4
|
-
from
|
|
3
|
+
from datamint import configs
|
|
4
|
+
from datamint.utils.logging_utils import load_cmdline_logging_config
|
|
5
5
|
|
|
6
6
|
# Create two loggings: one for the user and one for the developer
|
|
7
7
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -79,7 +79,7 @@ def configure_api_key():
|
|
|
79
79
|
def test_connection():
|
|
80
80
|
"""Test the API connection with current settings."""
|
|
81
81
|
try:
|
|
82
|
-
from
|
|
82
|
+
from datamint import APIHandler
|
|
83
83
|
_USER_LOGGER.info("🔄 Testing connection...")
|
|
84
84
|
api = APIHandler()
|
|
85
85
|
# Simple test - try to get projects
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from
|
|
2
|
+
from datamint.apihandler.api_handler import APIHandler
|
|
3
3
|
import os
|
|
4
4
|
from humanize import naturalsize
|
|
5
5
|
import logging
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
import sys
|
|
8
|
-
from
|
|
8
|
+
from datamint.utils.dicom_utils import is_dicom
|
|
9
9
|
import fnmatch
|
|
10
10
|
from typing import Sequence, Generator, Optional, Any
|
|
11
11
|
from collections import defaultdict
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
12
|
+
from datamint import __version__ as datamint_version
|
|
13
|
+
from datamint import configs
|
|
14
|
+
from datamint.client_cmd_tools.datamint_config import ask_api_key
|
|
15
|
+
from datamint.utils.logging_utils import load_cmdline_logging_config
|
|
16
16
|
import yaml
|
|
17
17
|
|
|
18
18
|
# Create two loggings: one for the user and one for the developer
|
|
@@ -302,7 +302,7 @@ def _parse_args() -> tuple[Any, list, Optional[list[dict]]]:
|
|
|
302
302
|
help='Automatically answer yes to all prompts')
|
|
303
303
|
parser.add_argument('--transpose-segmentation', action='store_true', default=False,
|
|
304
304
|
help='Transpose the segmentation dimensions to match the image dimensions')
|
|
305
|
-
parser.add_argument('--version', action='version', version=f'%(prog)s {
|
|
305
|
+
parser.add_argument('--version', action='version', version=f'%(prog)s {datamint_version}')
|
|
306
306
|
parser.add_argument('--verbose', action='store_true', help='Print debug messages', default=False)
|
|
307
307
|
args = parser.parse_args()
|
|
308
308
|
if args.verbose:
|
|
@@ -8,13 +8,13 @@ import json
|
|
|
8
8
|
import yaml
|
|
9
9
|
import pydicom
|
|
10
10
|
import numpy as np
|
|
11
|
-
from
|
|
11
|
+
from datamint import configs
|
|
12
12
|
from torch.utils.data import DataLoader
|
|
13
13
|
import torch
|
|
14
|
-
from
|
|
15
|
-
from
|
|
14
|
+
from datamint.apihandler.base_api_handler import DatamintException
|
|
15
|
+
from datamint.utils.dicom_utils import is_dicom
|
|
16
16
|
import cv2
|
|
17
|
-
from
|
|
17
|
+
from datamint.utils.io_utils import read_array_normalized
|
|
18
18
|
from deprecated import deprecated
|
|
19
19
|
from datetime import datetime
|
|
20
20
|
|
|
@@ -79,7 +79,7 @@ class DatamintBaseDataset:
|
|
|
79
79
|
include_frame_label_names: Optional[list[str]] = None,
|
|
80
80
|
exclude_frame_label_names: Optional[list[str]] = None
|
|
81
81
|
):
|
|
82
|
-
from
|
|
82
|
+
from datamint.apihandler.api_handler import APIHandler
|
|
83
83
|
|
|
84
84
|
if project_name is None:
|
|
85
85
|
raise ValueError("project_name is required.")
|
|
@@ -17,7 +17,7 @@ class DatamintDataset(DatamintBaseDataset):
|
|
|
17
17
|
In addition to that, it has functionality to better process annotations and segmentations.
|
|
18
18
|
|
|
19
19
|
.. note::
|
|
20
|
-
Import using ``from
|
|
20
|
+
Import using ``from datamint import Dataset``.
|
|
21
21
|
|
|
22
22
|
Args:
|
|
23
23
|
root: Root directory of dataset where data already exists or will be downloaded.
|
|
@@ -486,7 +486,7 @@ def initialize_automatic_logging(enable_rich_logging: bool = True):
|
|
|
486
486
|
# check if RichHandler is already in the handlers
|
|
487
487
|
if enable_rich_logging and not any(isinstance(h, RichHandler) for h in logging.getLogger().handlers):
|
|
488
488
|
logging.getLogger().handlers.append(RichHandler()) # set rich logging handler for the root logger
|
|
489
|
-
# logging.getLogger("
|
|
489
|
+
# logging.getLogger("datamint").setLevel(logging.INFO)
|
|
490
490
|
|
|
491
491
|
pytorch_patcher = PytorchPatcher()
|
|
492
492
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from datamint.apihandler.api_handler import APIHandler
|
|
3
|
+
from datamint.apihandler.base_api_handler import DatamintException
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
5
|
from typing import List, Dict, Optional, Union, Any, Tuple, IO, Literal
|
|
6
6
|
from collections import defaultdict
|
|
7
|
-
from
|
|
7
|
+
from datamint.dataset.dataset import DatamintDataset
|
|
8
8
|
import os
|
|
9
9
|
import numpy as np
|
|
10
10
|
import heapq
|
|
11
|
-
from
|
|
11
|
+
from datamint.utils import io_utils
|
|
12
12
|
|
|
13
13
|
_LOGGER = logging.getLogger(__name__)
|
|
14
14
|
|
|
@@ -570,7 +570,7 @@ class Experiment:
|
|
|
570
570
|
|
|
571
571
|
Args:
|
|
572
572
|
split (str): The split of the dataset to get. Can be one of ['all', 'train', 'test', 'val'].
|
|
573
|
-
**kwargs: Additional arguments to pass to the :py:class:`~
|
|
573
|
+
**kwargs: Additional arguments to pass to the :py:class:`~datamint.dataset.dataset.DatamintDataset` class.
|
|
574
574
|
|
|
575
575
|
Returns:
|
|
576
576
|
DatamintDataset: The dataset object.
|
|
@@ -815,22 +815,22 @@ class Experiment:
|
|
|
815
815
|
Example:
|
|
816
816
|
.. code-block:: python
|
|
817
817
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
resource_id = '123'
|
|
819
|
+
predictions = np.array([[0.1, 0.4], [0.9, 0.2]])
|
|
820
|
+
label_name = 'fracture'
|
|
821
|
+
exp.log_segmentation_predictions(resource_id, predictions, label_name, threshold=0.5)
|
|
822
822
|
|
|
823
823
|
.. code-block:: python
|
|
824
824
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
825
|
+
resource_id = '456'
|
|
826
|
+
predictions = np.array([[0, 1, 2], [1, 2, 0]]) # Multi-class mask with values 0, 1, 2
|
|
827
|
+
label_name = {1: 'Femur', 2: 'Tibia'} # Mapping of pixel values to class names
|
|
828
|
+
exp.log_segmentation_predictions(
|
|
829
|
+
resource_id,
|
|
830
|
+
predictions,
|
|
831
|
+
label_name,
|
|
832
|
+
predictions_format='multi-class'
|
|
833
|
+
)
|
|
834
834
|
"""
|
|
835
835
|
|
|
836
836
|
if predictions_format not in ['multi-class', 'probability']:
|
|
@@ -7,13 +7,13 @@ handlers:
|
|
|
7
7
|
level: WARNING
|
|
8
8
|
show_time: False
|
|
9
9
|
console_user:
|
|
10
|
-
class:
|
|
10
|
+
class: datamint.utils.logging_utils.ConditionalRichHandler
|
|
11
11
|
level: INFO
|
|
12
12
|
show_path: False
|
|
13
13
|
show_time: False
|
|
14
14
|
|
|
15
15
|
loggers:
|
|
16
|
-
|
|
16
|
+
datamint:
|
|
17
17
|
level: ERROR
|
|
18
18
|
handlers: [console]
|
|
19
19
|
propagate: no
|
|
@@ -45,7 +45,7 @@ def load_cmdline_logging_config():
|
|
|
45
45
|
with open('logging_dev.yaml', 'r') as f:
|
|
46
46
|
config = yaml.safe_load(f)
|
|
47
47
|
except:
|
|
48
|
-
with importlib.resources.open_text('
|
|
48
|
+
with importlib.resources.open_text('datamint', 'logging.yaml') as f:
|
|
49
49
|
config = yaml.safe_load(f.read())
|
|
50
50
|
|
|
51
51
|
logging.config.dictConfig(config)
|
|
@@ -1,19 +1,19 @@
|
|
|
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 = "1.
|
|
4
|
+
version = "1.3.0"
|
|
5
5
|
dynamic = ["dependencies"]
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
|
|
9
9
|
[project.scripts]
|
|
10
|
-
datamint-upload = '
|
|
11
|
-
datamint-config = '
|
|
10
|
+
datamint-upload = 'datamint.client_cmd_tools.datamint_upload:main'
|
|
11
|
+
datamint-config = 'datamint.client_cmd_tools.datamint_config:main'
|
|
12
12
|
|
|
13
13
|
[tool.poetry]
|
|
14
14
|
# license = "Proprietary" # https://python-poetry.org/docs/pyproject/
|
|
15
|
-
include = [{ path = "
|
|
16
|
-
packages = [ { include = "datamint" }
|
|
15
|
+
include = [{ path = "datamint/logging.yaml", format = ["sdist", "wheel"] }]
|
|
16
|
+
packages = [ { include = "datamint" }]
|
|
17
17
|
|
|
18
18
|
# https://python-poetry.org/docs/dependency-specification/
|
|
19
19
|
[tool.poetry.dependencies]
|
|
@@ -40,6 +40,8 @@ matplotlib = "*"
|
|
|
40
40
|
lightning = "*"
|
|
41
41
|
albumentations = ">=2.0.0"
|
|
42
42
|
lazy-loader = ">=0.3.0"
|
|
43
|
+
# For compatibility with the datamintapi package
|
|
44
|
+
datamintapi = "0.0.*"
|
|
43
45
|
# Extra dependencies for docs
|
|
44
46
|
sphinx = { version = ">=5.0", optional = true }
|
|
45
47
|
sphinx_rtd_theme = { version = ">=2.0.0", optional = true }
|
|
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
|