datamint 1.8.0__py3-none-any.whl → 1.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.

Potentially problematic release.


This version of datamint might be problematic. Click here for more details.

@@ -8,7 +8,7 @@ import asyncio
8
8
  import aiohttp
9
9
  from medimgkit.dicom_utils import anonymize_dicom, to_bytesio, is_dicom, is_dicom_report
10
10
  from medimgkit import dicom_utils, standardize_mimetype
11
- from medimgkit.io_utils import is_io_object
11
+ from medimgkit.io_utils import is_io_object, peek
12
12
  from medimgkit.format_detection import guess_typez, guess_extension, DEFAULT_MIME_TYPE
13
13
  from medimgkit.nifti_utils import DEFAULT_NIFTI_MIME, NIFTI_MIMES
14
14
  import pydicom
@@ -103,16 +103,22 @@ class RootAPIHandler(BaseAPIHandler):
103
103
  filename = os.path.basename(name)
104
104
  _LOGGER.debug(f"File name '{filename}' mimetype: {mimetype}")
105
105
 
106
- if anonymize:
107
- if is_a_dicom_file == True or is_dicom(file_path):
108
- ds = pydicom.dcmread(file_path)
106
+ if is_a_dicom_file == True or is_dicom(file_path):
107
+ if tags is None:
108
+ tags = []
109
+ else:
110
+ tags = list(tags)
111
+ ds = pydicom.dcmread(file_path)
112
+ if anonymize:
109
113
  _LOGGER.info(f"Anonymizing {file_path}")
110
114
  ds = anonymize_dicom(ds, retain_codes=anonymize_retain_codes)
111
- # make the dicom `ds` object a file-like object in order to avoid unnecessary disk writes
112
- f = to_bytesio(ds, name)
113
- else:
114
- _LOGGER.warning(f"File {file_path} is not a dicom file. Skipping anonymization.")
115
- f = _open_io(file_path)
115
+ lat = dicom_utils.get_dicom_laterality(ds)
116
+ if lat == 'L':
117
+ tags.append("left")
118
+ elif lat == 'R':
119
+ tags.append("right")
120
+ # make the dicom `ds` object a file-like object in order to avoid unnecessary disk writes
121
+ f = to_bytesio(ds, name)
116
122
  else:
117
123
  f = _open_io(file_path)
118
124
 
@@ -437,7 +443,7 @@ class RootAPIHandler(BaseAPIHandler):
437
443
  if assemble_dicoms:
438
444
  files_path, assembled = self._assemble_dicoms(files_path)
439
445
  assemble_dicoms = assembled
440
-
446
+
441
447
  if segmentation_files is not None:
442
448
  if assemble_dicoms:
443
449
  raise NotImplementedError("Segmentation files cannot be uploaded when assembling dicoms yet.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamint
3
- Version: 1.8.0
3
+ Version: 1.9.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
@@ -19,7 +19,7 @@ Requires-Dist: humanize (>=4.0.0,<5.0.0)
19
19
  Requires-Dist: lazy-loader (>=0.3.0)
20
20
  Requires-Dist: lightning
21
21
  Requires-Dist: matplotlib
22
- Requires-Dist: medimgkit (>=0.3.1)
22
+ Requires-Dist: medimgkit (>=0.4.4)
23
23
  Requires-Dist: nest-asyncio (>=1.0.0,<2.0.0)
24
24
  Requires-Dist: nibabel (>=4.0.0)
25
25
  Requires-Dist: numpy
@@ -4,7 +4,7 @@ datamint/apihandler/api_handler.py,sha256=cdVSddrFCKlF_BJ81LO1aJ0OP49rssjpNEFzJ6
4
4
  datamint/apihandler/base_api_handler.py,sha256=GQuJS3FFjxPi-2vkJtbHeNKywoa-PWa3Qvw3NGRzxug,12206
5
5
  datamint/apihandler/dto/annotation_dto.py,sha256=qId1RK1VO7dXrvGJ7dqJ31jBQB7Z8yy5x0tLSiMxTB4,7105
6
6
  datamint/apihandler/exp_api_handler.py,sha256=hFUgUgBc5rL7odK7gTW3MnrvMY1pVfJUpUdzRNobMQE,6226
7
- datamint/apihandler/root_api_handler.py,sha256=03eDLFYHzaQi-cv5aonKj7j0KowGK6sU5F_TCx3tRlU,59183
7
+ datamint/apihandler/root_api_handler.py,sha256=_vgIjqt7jb1yUkhyMez1Tg-vs4xmExby4TqWnfQG4OI,59320
8
8
  datamint/client_cmd_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  datamint/client_cmd_tools/datamint_config.py,sha256=md7dnWrbl10lPtXKbmD9yo6onLJsajeG8Vz0ZWH1v4M,8181
10
10
  datamint/client_cmd_tools/datamint_upload.py,sha256=J62xBDTaLxwBFWDmuXhzgbmZfPWaAZLr7CKsbqgTI7U,31389
@@ -22,7 +22,7 @@ datamint/logging.yaml,sha256=a5dsATpul7QHeUHB2TjABFjWaPXBMbO--dgn8GlRqwk,483
22
22
  datamint/utils/logging_utils.py,sha256=DvoA35ATYG3JTwfXEXYawDyKRfHeCrH0a9czfkmz8kM,1851
23
23
  datamint/utils/torchmetrics.py,sha256=lwU0nOtsSWfebyp7dvjlAggaqXtj5ohSEUXOg3L0hJE,2837
24
24
  datamint/utils/visualization.py,sha256=yaUVAOHar59VrGUjpAWv5eVvQSfztFG0eP9p5Vt3l-M,4470
25
- datamint-1.8.0.dist-info/METADATA,sha256=wkOXaU-02ah0wNosREQqODM-H9NmdEw1L3sQ3F9gFW8,4100
26
- datamint-1.8.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
- datamint-1.8.0.dist-info/entry_points.txt,sha256=mn5H6jPjO-rY0W0CAZ6Z_KKWhMLvyVaSpoqk77jlTI4,145
28
- datamint-1.8.0.dist-info/RECORD,,
25
+ datamint-1.9.0.dist-info/METADATA,sha256=M1oMNcVYjTVV8tfZcxxcPFijib04QC8Zz9VBQLR7tXg,4100
26
+ datamint-1.9.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
+ datamint-1.9.0.dist-info/entry_points.txt,sha256=mn5H6jPjO-rY0W0CAZ6Z_KKWhMLvyVaSpoqk77jlTI4,145
28
+ datamint-1.9.0.dist-info/RECORD,,