changeset 5086:0b27bbd19b1f

loosen the sanity checks for DICOM modifications
author Alain Mazy <am@osimis.io>
date Mon, 26 Sep 2022 18:11:03 +0200
parents 4366b4c41441
children df4a90a65af9
files NEWS OrthancFramework/Sources/DicomParsing/DicomModification.cpp
diffstat 2 files changed, 13 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Aug 31 10:36:38 2022 +0200
+++ b/NEWS	Mon Sep 26 18:11:03 2022 +0200
@@ -1,3 +1,16 @@
+Pending changes in the mainline
+===============================
+
+REST API
+--------
+
+* Loosen the sanity checks for DICOM modifications:
+  - allow modification of PatientID at study level
+  - allow modification of PatientID, StudyInstanceUID at series level
+  - allow modification of PatientID, StudyInstanceUID, SeriesInstanceUID at instance level
+  - allow modification of a patient without changing her PatientID
+
+
 version 1.11.2 (2022-08-30)
 ===========================
 
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Wed Aug 31 10:36:38 2022 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Mon Sep 26 18:11:03 2022 +0200
@@ -926,12 +926,6 @@
     bool isReplacedPatientId = (IsReplaced(DICOM_TAG_PATIENT_ID) ||
                                 uids_.find(DICOM_TAG_PATIENT_ID) != uids_.end());
     
-    if (level_ == ResourceType_Patient && !isReplacedPatientId)
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying a patient, her PatientID is required to be modified");
-    }
-
     if (!allowManualIdentifiers_)
     {
       if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
@@ -955,12 +949,6 @@
 
 
     // Sanity checks at the study level
-    if (level_ == ResourceType_Study && isReplacedPatientId)
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying a study, the parent PatientID cannot be manually modified");
-    }
-
     if (!allowManualIdentifiers_)
     {
       if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID))
@@ -978,18 +966,6 @@
 
 
     // Sanity checks at the series level
-    if (level_ == ResourceType_Series && isReplacedPatientId)
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying a series, the parent PatientID cannot be manually modified");
-    }
-
-    if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying a series, the parent StudyInstanceUID cannot be manually modified");
-    }
-
     if (!allowManualIdentifiers_)
     {
       if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID))
@@ -999,26 +975,6 @@
       }
     }
 
-
-    // Sanity checks at the instance level
-    if (level_ == ResourceType_Instance && isReplacedPatientId)
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying an instance, the parent PatientID cannot be manually modified");
-    }
-
-    if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying an instance, the parent StudyInstanceUID cannot be manually modified");
-    }
-
-    if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID))
-    {
-      throw OrthancException(ErrorCode_BadRequest,
-                             "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified");
-    }
-
     // (0) Create a summary of the source file, if a custom generator
     // is provided
     if (identifierGenerator_ != NULL)