datamint 1.7.5__py3-none-any.whl → 1.7.6__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.

@@ -16,6 +16,7 @@ import json
16
16
  from deprecated import deprecated
17
17
  from pathlib import Path
18
18
  from tqdm.auto import tqdm
19
+ from medimgkit.nifti_utils import DEFAULT_NIFTI_MIME
19
20
 
20
21
  _LOGGER = logging.getLogger(__name__)
21
22
  _USER_LOGGER = logging.getLogger('user_logger')
@@ -280,7 +281,7 @@ class AnnotationAPIHandler(BaseAPIHandler):
280
281
  with open(file_path, 'rb') as f:
281
282
  filename = os.path.basename(file_path)
282
283
  form = aiohttp.FormData()
283
- form.add_field('file', f, filename=filename, content_type='application/x-nifti')
284
+ form.add_field('file', f, filename=filename, content_type=DEFAULT_NIFTI_MIME)
284
285
  if model_id is not None:
285
286
  form.add_field('model_id', model_id) # Add model_id if provided
286
287
  if worklist_id is not None:
@@ -7,9 +7,10 @@ import logging
7
7
  import asyncio
8
8
  import aiohttp
9
9
  from medimgkit.dicom_utils import anonymize_dicom, to_bytesio, is_dicom, is_dicom_report
10
- from medimgkit import dicom_utils
10
+ from medimgkit import dicom_utils, standardize_mimetype
11
11
  from medimgkit.io_utils import is_io_object
12
12
  from medimgkit.format_detection import guess_typez, guess_extension, DEFAULT_MIME_TYPE
13
+ from medimgkit.nifti_utils import DEFAULT_NIFTI_MIME, NIFTI_MIMES
13
14
  import pydicom
14
15
  from pathlib import Path
15
16
  from datetime import date
@@ -88,12 +89,17 @@ class RootAPIHandler(BaseAPIHandler):
88
89
  is_a_dicom_file = None
89
90
  if mimetype is None:
90
91
  mimetype_list, ext = guess_typez(file_path, use_magic=True)
91
- mimetype = mimetype_list[-1]
92
- if mimetype == 'application/gzip':
93
- # Special case for gzipped NIfTI files
92
+ for mime in mimetype_list:
93
+ if mime in NIFTI_MIMES:
94
+ mimetype = DEFAULT_NIFTI_MIME
95
+ break
96
+ else:
94
97
  if ext == '.nii.gz' or name.lower().endswith('nii.gz'):
95
- mimetype = 'image/x.nifti'
98
+ mimetype = DEFAULT_NIFTI_MIME
99
+ else:
100
+ mimetype = mimetype_list[-1] if mimetype_list else DEFAULT_MIME_TYPE
96
101
 
102
+ mimetype = standardize_mimetype(mimetype)
97
103
  filename = os.path.basename(name)
98
104
  _LOGGER.debug(f"File name '{filename}' mimetype: {mimetype}")
99
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamint
3
- Version: 1.7.5
3
+ Version: 1.7.6
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.2.1)
22
+ Requires-Dist: medimgkit (>=0.2.2)
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
@@ -1,10 +1,10 @@
1
1
  datamint/__init__.py,sha256=7rKCCsaa4RBRTIfuHB708rai1xwDHLtkFNFJGKYG5D4,757
2
- datamint/apihandler/annotation_api_handler.py,sha256=HnWiG2ebq08mdaazTXVbkuwvh6fmKIKt8uqAOf3Y1jU,57013
2
+ datamint/apihandler/annotation_api_handler.py,sha256=ZJJD_Op8eDtGcpDZOS1DRjqyDUdD3UxvtuNJK9FaPOk,57063
3
3
  datamint/apihandler/api_handler.py,sha256=cdVSddrFCKlF_BJ81LO1aJ0OP49rssjpNEFzJ6Q7YyY,384
4
4
  datamint/apihandler/base_api_handler.py,sha256=HSMi8vN-xU0LLUEh3fgcuO7mXpMsX0wrA5nO9FVvrA4,12207
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=8VanqWbcLLkwQ0y2Z_a5Mqr5knplRCUSi5iRVQeHFzU,58901
7
+ datamint/apihandler/root_api_handler.py,sha256=03eDLFYHzaQi-cv5aonKj7j0KowGK6sU5F_TCx3tRlU,59183
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=890USkrtaH23mNjTRYVHWce2q9jSmkUNHIP_e8fnJRM,29502
@@ -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.7.5.dist-info/METADATA,sha256=vWoLCzDqK33Lzb0DRTLLRAYpYJRX6xmv0p30Lo46Hwg,4100
26
- datamint-1.7.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
- datamint-1.7.5.dist-info/entry_points.txt,sha256=mn5H6jPjO-rY0W0CAZ6Z_KKWhMLvyVaSpoqk77jlTI4,145
28
- datamint-1.7.5.dist-info/RECORD,,
25
+ datamint-1.7.6.dist-info/METADATA,sha256=xq4h5h5nYUIFRNpKleMaEkIrmuHbnLhIdJwm9ucwd8g,4100
26
+ datamint-1.7.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
+ datamint-1.7.6.dist-info/entry_points.txt,sha256=mn5H6jPjO-rY0W0CAZ6Z_KKWhMLvyVaSpoqk77jlTI4,145
28
+ datamint-1.7.6.dist-info/RECORD,,