Mercurial > hg > orthanc
comparison Core/DicomParsing/ParsedDicomFile.cpp @ 3446:52da6e9335dd
Allow anonymizing/modifying instances without the PatientID tag
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Jun 2019 10:51:01 +0200 |
parents | 4c45e018bd3d |
children | 33cfcc74d1b1 |
comparison
equal
deleted
inserted
replaced
3445:4944b03bb9c6 | 3446:52da6e9335dd |
---|---|
913 | 913 |
914 DicomInstanceHasher ParsedDicomFile::GetHasher() | 914 DicomInstanceHasher ParsedDicomFile::GetHasher() |
915 { | 915 { |
916 std::string patientId, studyUid, seriesUid, instanceUid; | 916 std::string patientId, studyUid, seriesUid, instanceUid; |
917 | 917 |
918 if (!GetTagValue(patientId, DICOM_TAG_PATIENT_ID) || | 918 if (!GetTagValue(patientId, DICOM_TAG_PATIENT_ID)) |
919 !GetTagValue(studyUid, DICOM_TAG_STUDY_INSTANCE_UID) || | 919 { |
920 /** | |
921 * If "PatientID" is absent, be tolerant by considering it | |
922 * equals the empty string, then proceed. In Orthanc <= 1.5.6, | |
923 * an exception "Bad file format" was generated. | |
924 * https://groups.google.com/d/msg/orthanc-users/aphG_h1AHVg/rfOTtTPTAgAJ | |
925 * https://bitbucket.org/sjodogne/orthanc/commits/4c45e018bd3de3cfa21d6efc6734673aaaee4435 | |
926 **/ | |
927 patientId.clear(); | |
928 } | |
929 | |
930 if (!GetTagValue(studyUid, DICOM_TAG_STUDY_INSTANCE_UID) || | |
920 !GetTagValue(seriesUid, DICOM_TAG_SERIES_INSTANCE_UID) || | 931 !GetTagValue(seriesUid, DICOM_TAG_SERIES_INSTANCE_UID) || |
921 !GetTagValue(instanceUid, DICOM_TAG_SOP_INSTANCE_UID)) | 932 !GetTagValue(instanceUid, DICOM_TAG_SOP_INSTANCE_UID)) |
922 { | 933 { |
923 throw OrthancException(ErrorCode_BadFileFormat, "missing PatientID, StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID"); | 934 throw OrthancException(ErrorCode_BadFileFormat, "missing StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID"); |
924 } | 935 } |
925 | 936 |
926 return DicomInstanceHasher(patientId, studyUid, seriesUid, instanceUid); | 937 return DicomInstanceHasher(patientId, studyUid, seriesUid, instanceUid); |
927 } | 938 } |
928 | 939 |