From 14412320d4514a17d16993123a9a9a6b03f5baa0 Mon Sep 17 00:00:00 2001 From: mdevans Date: Fri, 25 Oct 2024 12:00:43 +0200 Subject: [PATCH] if pydicom debug is on, store incoming datasets to private dir build only windows-2022, macos-13 --- .github/workflows/build.yml | 2 +- src/controller/anonymizer.py | 10 ++++++++++ src/controller/project.py | 2 -- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a8aede..16f9cd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-2022, windows-latest, macos-13, macos-latest, ubuntu-latest] + os: [windows-2022, macos-13] steps: - name: Checkout repository diff --git a/src/controller/anonymizer.py b/src/controller/anonymizer.py index 8c8ca18..9499ee7 100644 --- a/src/controller/anonymizer.py +++ b/src/controller/anonymizer.py @@ -467,6 +467,16 @@ def anonymize(self, source: DICOMNode | str, ds: Dataset) -> str | None: """ self._model_change_flag = True # for autosave manager + # If pydicom logging is on, trace phi UIDs and store incoming phi file in private/source + if self.model.logging_levels.pydicom: + logger.debug(f"=>{ds.PatientID}/{ds.StudyInstanceUID}/{ds.SeriesInstanceUID}/{ds.SOPInstanceUID}") + filename = self.local_storage_path(self.model.private_dir(), ds) + logger.debug(f"SOURCE STORE: {source} => {filename}") + try: + ds.save_as(filename) + except Exception as e: + logger.error(f"Error storing source file: {repr(e)}") + # Calculate date delta from StudyDate and PatientID: date_delta = 0 if hasattr(ds, "StudyDate") and hasattr(ds, "PatientID"): diff --git a/src/controller/project.py b/src/controller/project.py index 9047181..a04c960 100644 --- a/src/controller/project.py +++ b/src/controller/project.py @@ -539,8 +539,6 @@ def _handle_store(self, event: Event): ) return C_SUCCESS - logger.info(f"=>{ds.PatientID}/{ds.StudyInstanceUID}/{ds.SeriesInstanceUID}/{ds.SOPInstanceUID}") - self.anonymizer.anonymize_dataset_ex(remote_scu, ds) return C_SUCCESS