# HG changeset patch # User Sebastien Jodogne # Date 1561452661 -7200 # Node ID 52da6e9335dd4494e0a3e5cb1ec82d048e39ed93 # Parent 4944b03bb9c69b82fed7d332a580bc4c011face8 Allow anonymizing/modifying instances without the PatientID tag diff -r 4944b03bb9c6 -r 52da6e9335dd Core/DicomParsing/ParsedDicomFile.cpp --- a/Core/DicomParsing/ParsedDicomFile.cpp Mon Jun 24 17:46:18 2019 +0200 +++ b/Core/DicomParsing/ParsedDicomFile.cpp Tue Jun 25 10:51:01 2019 +0200 @@ -915,12 +915,23 @@ { std::string patientId, studyUid, seriesUid, instanceUid; - if (!GetTagValue(patientId, DICOM_TAG_PATIENT_ID) || - !GetTagValue(studyUid, DICOM_TAG_STUDY_INSTANCE_UID) || + if (!GetTagValue(patientId, DICOM_TAG_PATIENT_ID)) + { + /** + * If "PatientID" is absent, be tolerant by considering it + * equals the empty string, then proceed. In Orthanc <= 1.5.6, + * an exception "Bad file format" was generated. + * https://groups.google.com/d/msg/orthanc-users/aphG_h1AHVg/rfOTtTPTAgAJ + * https://bitbucket.org/sjodogne/orthanc/commits/4c45e018bd3de3cfa21d6efc6734673aaaee4435 + **/ + patientId.clear(); + } + + if (!GetTagValue(studyUid, DICOM_TAG_STUDY_INSTANCE_UID) || !GetTagValue(seriesUid, DICOM_TAG_SERIES_INSTANCE_UID) || !GetTagValue(instanceUid, DICOM_TAG_SOP_INSTANCE_UID)) { - throw OrthancException(ErrorCode_BadFileFormat, "missing PatientID, StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID"); + throw OrthancException(ErrorCode_BadFileFormat, "missing StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID"); } return DicomInstanceHasher(patientId, studyUid, seriesUid, instanceUid); diff -r 4944b03bb9c6 -r 52da6e9335dd NEWS --- a/NEWS Mon Jun 24 17:46:18 2019 +0200 +++ b/NEWS Tue Jun 25 10:51:01 2019 +0200 @@ -27,6 +27,7 @@ * Allow the serialization of signed 16bpp images in PAM format * HTTP header "Accept-Encoding" is honored for streams without built-in support for compression * The default HTTP timeout is now 60 seconds (instead of 10 seconds in previous versions) +* Allow anonymizing/modifying instances without the PatientID tag * Fix issue #106 (Unable to export preview as jpeg from Lua script) * Fix issue #136 (C-FIND request fails when found DICOM file does not have certain tags) * Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)