Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomParsing/DicomModification.cpp @ 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 | 43e613a7756b |
children | df4a90a65af9 |
comparison
equal
deleted
inserted
replaced
5079:4366b4c41441 | 5086:0b27bbd19b1f |
---|---|
924 | 924 |
925 // Sanity checks at the patient level | 925 // Sanity checks at the patient level |
926 bool isReplacedPatientId = (IsReplaced(DICOM_TAG_PATIENT_ID) || | 926 bool isReplacedPatientId = (IsReplaced(DICOM_TAG_PATIENT_ID) || |
927 uids_.find(DICOM_TAG_PATIENT_ID) != uids_.end()); | 927 uids_.find(DICOM_TAG_PATIENT_ID) != uids_.end()); |
928 | 928 |
929 if (level_ == ResourceType_Patient && !isReplacedPatientId) | |
930 { | |
931 throw OrthancException(ErrorCode_BadRequest, | |
932 "When modifying a patient, her PatientID is required to be modified"); | |
933 } | |
934 | |
935 if (!allowManualIdentifiers_) | 929 if (!allowManualIdentifiers_) |
936 { | 930 { |
937 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | 931 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
938 { | 932 { |
939 throw OrthancException(ErrorCode_BadRequest, | 933 throw OrthancException(ErrorCode_BadRequest, |
953 } | 947 } |
954 } | 948 } |
955 | 949 |
956 | 950 |
957 // Sanity checks at the study level | 951 // Sanity checks at the study level |
958 if (level_ == ResourceType_Study && isReplacedPatientId) | |
959 { | |
960 throw OrthancException(ErrorCode_BadRequest, | |
961 "When modifying a study, the parent PatientID cannot be manually modified"); | |
962 } | |
963 | |
964 if (!allowManualIdentifiers_) | 952 if (!allowManualIdentifiers_) |
965 { | 953 { |
966 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | 954 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
967 { | 955 { |
968 throw OrthancException(ErrorCode_BadRequest, | 956 throw OrthancException(ErrorCode_BadRequest, |
976 } | 964 } |
977 } | 965 } |
978 | 966 |
979 | 967 |
980 // Sanity checks at the series level | 968 // Sanity checks at the series level |
981 if (level_ == ResourceType_Series && isReplacedPatientId) | |
982 { | |
983 throw OrthancException(ErrorCode_BadRequest, | |
984 "When modifying a series, the parent PatientID cannot be manually modified"); | |
985 } | |
986 | |
987 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | |
988 { | |
989 throw OrthancException(ErrorCode_BadRequest, | |
990 "When modifying a series, the parent StudyInstanceUID cannot be manually modified"); | |
991 } | |
992 | |
993 if (!allowManualIdentifiers_) | 969 if (!allowManualIdentifiers_) |
994 { | 970 { |
995 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) | 971 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
996 { | 972 { |
997 throw OrthancException(ErrorCode_BadRequest, | 973 throw OrthancException(ErrorCode_BadRequest, |
998 "When modifying a series, the SopInstanceUID cannot be manually modified"); | 974 "When modifying a series, the SopInstanceUID cannot be manually modified"); |
999 } | 975 } |
1000 } | |
1001 | |
1002 | |
1003 // Sanity checks at the instance level | |
1004 if (level_ == ResourceType_Instance && isReplacedPatientId) | |
1005 { | |
1006 throw OrthancException(ErrorCode_BadRequest, | |
1007 "When modifying an instance, the parent PatientID cannot be manually modified"); | |
1008 } | |
1009 | |
1010 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | |
1011 { | |
1012 throw OrthancException(ErrorCode_BadRequest, | |
1013 "When modifying an instance, the parent StudyInstanceUID cannot be manually modified"); | |
1014 } | |
1015 | |
1016 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | |
1017 { | |
1018 throw OrthancException(ErrorCode_BadRequest, | |
1019 "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified"); | |
1020 } | 976 } |
1021 | 977 |
1022 // (0) Create a summary of the source file, if a custom generator | 978 // (0) Create a summary of the source file, if a custom generator |
1023 // is provided | 979 // is provided |
1024 if (identifierGenerator_ != NULL) | 980 if (identifierGenerator_ != NULL) |