datamint 1.2.4__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.
Potentially problematic release.
This version of datamint might be problematic. Click here for more details.
- datamint/__init__.py +11 -0
- datamint-1.2.4.dist-info/METADATA +118 -0
- datamint-1.2.4.dist-info/RECORD +30 -0
- datamint-1.2.4.dist-info/WHEEL +4 -0
- datamint-1.2.4.dist-info/entry_points.txt +4 -0
- datamintapi/__init__.py +25 -0
- datamintapi/apihandler/annotation_api_handler.py +748 -0
- datamintapi/apihandler/api_handler.py +15 -0
- datamintapi/apihandler/base_api_handler.py +300 -0
- datamintapi/apihandler/dto/annotation_dto.py +149 -0
- datamintapi/apihandler/exp_api_handler.py +204 -0
- datamintapi/apihandler/root_api_handler.py +1013 -0
- datamintapi/client_cmd_tools/__init__.py +0 -0
- datamintapi/client_cmd_tools/datamint_config.py +168 -0
- datamintapi/client_cmd_tools/datamint_upload.py +483 -0
- datamintapi/configs.py +58 -0
- datamintapi/dataset/__init__.py +1 -0
- datamintapi/dataset/base_dataset.py +881 -0
- datamintapi/dataset/dataset.py +492 -0
- datamintapi/examples/__init__.py +1 -0
- datamintapi/examples/example_projects.py +75 -0
- datamintapi/experiment/__init__.py +1 -0
- datamintapi/experiment/_patcher.py +570 -0
- datamintapi/experiment/experiment.py +1049 -0
- datamintapi/logging.yaml +27 -0
- datamintapi/utils/dicom_utils.py +640 -0
- datamintapi/utils/io_utils.py +149 -0
- datamintapi/utils/logging_utils.py +55 -0
- datamintapi/utils/torchmetrics.py +70 -0
- datamintapi/utils/visualization.py +129 -0
datamintapi/configs.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import yaml
|
|
2
|
+
import os
|
|
3
|
+
import logging
|
|
4
|
+
from netrc import netrc
|
|
5
|
+
from platformdirs import PlatformDirs
|
|
6
|
+
from typing import Dict
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
APIURL_KEY = 'default_api_url'
|
|
10
|
+
APIKEY_KEY = 'api_key'
|
|
11
|
+
|
|
12
|
+
ENV_VARS = {
|
|
13
|
+
APIKEY_KEY: 'DATAMINT_API_KEY',
|
|
14
|
+
APIURL_KEY: 'DATAMINT_API_URL'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
_LOGGER = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
DIRS = PlatformDirs(appname='datamintapi')
|
|
20
|
+
CONFIG_FILE = os.path.join(DIRS.user_config_dir, 'datamintapi.yaml')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_env_var_name(key: str) -> str:
|
|
24
|
+
return ENV_VARS[key]
|
|
25
|
+
|
|
26
|
+
def read_config() -> Dict:
|
|
27
|
+
if os.path.exists(CONFIG_FILE):
|
|
28
|
+
with open(CONFIG_FILE, 'r') as configfile:
|
|
29
|
+
return yaml.safe_load(configfile)
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def set_value(key: str,
|
|
34
|
+
value):
|
|
35
|
+
config = read_config()
|
|
36
|
+
config[key] = value
|
|
37
|
+
if not os.path.exists(DIRS.user_config_dir):
|
|
38
|
+
os.makedirs(DIRS.user_config_dir, exist_ok=True)
|
|
39
|
+
with open(CONFIG_FILE, 'w') as configfile:
|
|
40
|
+
yaml.dump(config, configfile)
|
|
41
|
+
_LOGGER.debug(f"Configuration saved to {CONFIG_FILE}.")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_value(key: str,
|
|
45
|
+
include_envvars: bool = True):
|
|
46
|
+
if include_envvars:
|
|
47
|
+
if key in ENV_VARS:
|
|
48
|
+
env_var = os.getenv(ENV_VARS[key])
|
|
49
|
+
if env_var is not None:
|
|
50
|
+
return env_var
|
|
51
|
+
|
|
52
|
+
config = read_config()
|
|
53
|
+
return config.get(key)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def clear_all_configurations():
|
|
57
|
+
if os.path.exists(CONFIG_FILE):
|
|
58
|
+
os.remove(CONFIG_FILE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .dataset import DatamintDataset as Dataset
|