diff OrthancFramework/Sources/DicomParsing/DicomModification.cpp @ 5087:df4a90a65af9

DicomModification::SetAllowManualIdentifiers() has been removed since it was always true -> code cleanup
author Alain Mazy <am@osimis.io>
date Mon, 26 Sep 2022 18:56:40 +0200
parents 0b27bbd19b1f
children 8638522eeda1
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Mon Sep 26 18:11:03 2022 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Mon Sep 26 18:56:40 2022 +0200
@@ -522,7 +522,6 @@
   DicomModification::DicomModification() :
     removePrivateTags_(false),
     level_(ResourceType_Instance),
-    allowManualIdentifiers_(true),
     keepStudyInstanceUid_(false),
     keepSeriesInstanceUid_(false),
     keepSopInstanceUid_(false),
@@ -922,58 +921,6 @@
     }
     
 
-    // Sanity checks at the patient level
-    bool isReplacedPatientId = (IsReplaced(DICOM_TAG_PATIENT_ID) ||
-                                uids_.find(DICOM_TAG_PATIENT_ID) != uids_.end());
-    
-    if (!allowManualIdentifiers_)
-    {
-      if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a patient, the StudyInstanceUID cannot be manually modified");
-      }
-
-      if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a patient, the SeriesInstanceUID cannot be manually modified");
-      }
-
-      if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a patient, the SopInstanceUID cannot be manually modified");
-      }
-    }
-
-
-    // Sanity checks at the study level
-    if (!allowManualIdentifiers_)
-    {
-      if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a study, the SeriesInstanceUID cannot be manually modified");
-      }
-
-      if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a study, the SopInstanceUID cannot be manually modified");
-      }
-    }
-
-
-    // Sanity checks at the series level
-    if (!allowManualIdentifiers_)
-    {
-      if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID))
-      {
-        throw OrthancException(ErrorCode_BadRequest,
-                               "When modifying a series, the SopInstanceUID cannot be manually modified");
-      }
-    }
 
     // (0) Create a summary of the source file, if a custom generator
     // is provided
@@ -1114,17 +1061,6 @@
     }
   }
 
-  void DicomModification::SetAllowManualIdentifiers(bool check)
-  {
-    allowManualIdentifiers_ = check;
-  }
-
-  bool DicomModification::AreAllowManualIdentifiers() const
-  {
-    return allowManualIdentifiers_;
-  }
-
-
   static bool IsDatabaseKey(const DicomTag& tag)
   {
     return (tag == DICOM_TAG_PATIENT_ID ||
@@ -1346,7 +1282,6 @@
 
   static const char* REMOVE_PRIVATE_TAGS = "RemovePrivateTags";
   static const char* LEVEL = "Level";
-  static const char* ALLOW_MANUAL_IDENTIFIERS = "AllowManualIdentifiers";
   static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID";
   static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID";
   static const char* KEEP_SOP_INSTANCE_UID = "KeepSOPInstanceUID";
@@ -1378,7 +1313,6 @@
     value = Json::objectValue;
     value[REMOVE_PRIVATE_TAGS] = removePrivateTags_;
     value[LEVEL] = EnumerationToString(level_);
-    value[ALLOW_MANUAL_IDENTIFIERS] = allowManualIdentifiers_;
     value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_;
     value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_;
     value[KEEP_SOP_INSTANCE_UID] = keepSopInstanceUid_;
@@ -1523,7 +1457,6 @@
   {
     removePrivateTags_ = SerializationToolbox::ReadBoolean(serialized, REMOVE_PRIVATE_TAGS);
     level_ = StringToResourceType(SerializationToolbox::ReadString(serialized, LEVEL).c_str());
-    allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS);
     keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID);
     keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID);
     updateReferencedRelationships_ = SerializationToolbox::ReadBoolean