datamint 1.7.2__tar.gz → 1.7.3__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.

Files changed (27) hide show
  1. {datamint-1.7.2 → datamint-1.7.3}/PKG-INFO +1 -1
  2. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/root_api_handler.py +22 -24
  3. {datamint-1.7.2 → datamint-1.7.3}/pyproject.toml +1 -1
  4. {datamint-1.7.2 → datamint-1.7.3}/README.md +0 -0
  5. {datamint-1.7.2 → datamint-1.7.3}/datamint/__init__.py +0 -0
  6. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/annotation_api_handler.py +0 -0
  7. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/api_handler.py +0 -0
  8. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/base_api_handler.py +0 -0
  9. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/dto/annotation_dto.py +0 -0
  10. {datamint-1.7.2 → datamint-1.7.3}/datamint/apihandler/exp_api_handler.py +0 -0
  11. {datamint-1.7.2 → datamint-1.7.3}/datamint/client_cmd_tools/__init__.py +0 -0
  12. {datamint-1.7.2 → datamint-1.7.3}/datamint/client_cmd_tools/datamint_config.py +0 -0
  13. {datamint-1.7.2 → datamint-1.7.3}/datamint/client_cmd_tools/datamint_upload.py +0 -0
  14. {datamint-1.7.2 → datamint-1.7.3}/datamint/configs.py +0 -0
  15. {datamint-1.7.2 → datamint-1.7.3}/datamint/dataset/__init__.py +0 -0
  16. {datamint-1.7.2 → datamint-1.7.3}/datamint/dataset/annotation.py +0 -0
  17. {datamint-1.7.2 → datamint-1.7.3}/datamint/dataset/base_dataset.py +0 -0
  18. {datamint-1.7.2 → datamint-1.7.3}/datamint/dataset/dataset.py +0 -0
  19. {datamint-1.7.2 → datamint-1.7.3}/datamint/examples/__init__.py +0 -0
  20. {datamint-1.7.2 → datamint-1.7.3}/datamint/examples/example_projects.py +0 -0
  21. {datamint-1.7.2 → datamint-1.7.3}/datamint/experiment/__init__.py +0 -0
  22. {datamint-1.7.2 → datamint-1.7.3}/datamint/experiment/_patcher.py +0 -0
  23. {datamint-1.7.2 → datamint-1.7.3}/datamint/experiment/experiment.py +0 -0
  24. {datamint-1.7.2 → datamint-1.7.3}/datamint/logging.yaml +0 -0
  25. {datamint-1.7.2 → datamint-1.7.3}/datamint/utils/logging_utils.py +0 -0
  26. {datamint-1.7.2 → datamint-1.7.3}/datamint/utils/torchmetrics.py +0 -0
  27. {datamint-1.7.2 → datamint-1.7.3}/datamint/utils/visualization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamint
3
- Version: 1.7.2
3
+ Version: 1.7.3
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
@@ -239,14 +239,14 @@ class RootAPIHandler(BaseAPIHandler):
239
239
  names = _infinite_gen(names)
240
240
  frame_indices = segfiles.get('frame_index', _infinite_gen(None))
241
241
  for f, name, frame_index in tqdm(zip(fpaths, names, frame_indices),
242
- desc=f"Uploading segmentations for {file_path}",
243
- total=len(fpaths)):
242
+ desc=f"Uploading segmentations for {file_path}",
243
+ total=len(fpaths)):
244
244
  if f is not None:
245
245
  await self._upload_segmentations_async(rid,
246
- file_path=f,
247
- name=name,
248
- frame_index=frame_index,
249
- transpose_segmentation=transpose_segmentation)
246
+ file_path=f,
247
+ name=name,
248
+ frame_index=frame_index,
249
+ transpose_segmentation=transpose_segmentation)
250
250
  return rid
251
251
 
252
252
  tasks = [__upload_single_resource(f, segfiles, metadata_file)
@@ -368,25 +368,26 @@ class RootAPIHandler(BaseAPIHandler):
368
368
  def _is_dicom_report(file_path: str | IO) -> bool:
369
369
  """
370
370
  Check if a DICOM file is a report (e.g., Structured Report).
371
-
371
+
372
372
  Args:
373
373
  file_path: Path to the DICOM file or file-like object.
374
-
374
+
375
375
  Returns:
376
376
  bool: True if the DICOM file is a report, False otherwise.
377
377
  """
378
378
  try:
379
379
  if not is_dicom(file_path):
380
380
  return False
381
-
381
+
382
382
  ds = pydicom.dcmread(file_path, stop_before_pixels=True)
383
383
  if hasattr(file_path, 'seek'):
384
384
  file_path.seek(0)
385
385
  modality = getattr(ds, 'Modality', None)
386
-
386
+
387
387
  # Common report modalities
388
- report_modalities = {'SR', 'DOC', 'KO', 'PR', 'ESR'} # SR=Structured Report, DOC=Document, KO=Key Object, PR=Presentation State
389
-
388
+ # SR=Structured Report, DOC=Document, KO=Key Object, PR=Presentation State
389
+ report_modalities = {'SR', 'DOC', 'KO', 'PR', 'ESR'}
390
+
390
391
  return modality in report_modalities
391
392
  except Exception as e:
392
393
  _LOGGER.warning(f"Error checking if DICOM is a report: {e}")
@@ -445,21 +446,18 @@ class RootAPIHandler(BaseAPIHandler):
445
446
  list[str | Exception]: A list of resource IDs or errors.
446
447
  """
447
448
 
448
- if discard_dicom_reports:
449
- if isinstance(files_path, (str, Path)):
450
- files_path = [files_path]
451
- elif isinstance(files_path, pydicom.dataset.Dataset):
452
- files_path = [files_path]
453
-
454
- old_size = len(files_path)
455
- files_path = [f for f in files_path if not RootAPIHandler._is_dicom_report(f)]
456
- if old_size != len(files_path):
457
- _LOGGER.info(f"Discarded {old_size - len(files_path)} DICOM report files from upload.")
458
-
459
449
  if on_error not in ['raise', 'skip']:
460
450
  raise ValueError("on_error must be either 'raise' or 'skip'")
461
451
 
462
452
  files_path, is_multiple_resources = RootAPIHandler.__process_files_parameter(files_path)
453
+
454
+ ### Discard DICOM reports
455
+ if discard_dicom_reports:
456
+ files_path = [f for f in files_path if not RootAPIHandler._is_dicom_report(f)]
457
+ old_size = len(files_path)
458
+ if old_size is not None and old_size != len(files_path):
459
+ _LOGGER.info(f"Discarded {old_size - len(files_path)} DICOM report files from upload.")
460
+
463
461
  if isinstance(metadata, (str, dict)):
464
462
  _LOGGER.debug("Converting metadatas to a list")
465
463
  metadata = [metadata]
@@ -905,7 +903,7 @@ class RootAPIHandler(BaseAPIHandler):
905
903
  ) -> None:
906
904
  """
907
905
  Download multiple resources and save them to the specified paths.
908
-
906
+
909
907
  Args:
910
908
  resource_ids (list[str]): A list of resource unique ids.
911
909
  save_path (list[str] | str): A list of paths to save the files or a directory path.
@@ -1,7 +1,7 @@
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.7.2"
4
+ version = "1.7.3"
5
5
  dynamic = ["dependencies"]
6
6
  requires-python = ">=3.10"
7
7
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes