Mercurial > hg > orthanc
diff OrthancServer/ServerToolbox.cpp @ 1744:b3de74dec2d5 db-changes
integration mainline->db-changes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 26 Oct 2015 12:30:34 +0100 |
parents | 54d78925cbb6 ec66a16aa398 |
children | 38dda23c7d7d |
line wrap: on
line diff
--- a/OrthancServer/ServerToolbox.cpp Tue Oct 20 17:39:58 2015 +0200 +++ b/OrthancServer/ServerToolbox.cpp Mon Oct 26 12:30:34 2015 +0100 @@ -91,6 +91,21 @@ } + static std::string ValueAsString(const DicomMap& summary, + const DicomTag& tag) + { + const DicomValue& value = summary.GetValue(tag); + if (value.IsNull()) + { + return "(null)"; + } + else + { + return value.GetContent(); + } + } + + void LogMissingRequiredTag(const DicomMap& summary) { std::string s, t; @@ -99,7 +114,7 @@ { if (t.size() > 0) t += ", "; - t += "PatientID=" + summary.GetValue(DICOM_TAG_PATIENT_ID).AsString(); + t += "PatientID=" + ValueAsString(summary, DICOM_TAG_PATIENT_ID); } else { @@ -112,7 +127,7 @@ { if (t.size() > 0) t += ", "; - t += "StudyInstanceUID=" + summary.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString(); + t += "StudyInstanceUID=" + ValueAsString(summary, DICOM_TAG_STUDY_INSTANCE_UID); } else { @@ -125,7 +140,7 @@ { if (t.size() > 0) t += ", "; - t += "SeriesInstanceUID=" + summary.GetValue(DICOM_TAG_SERIES_INSTANCE_UID).AsString(); + t += "SeriesInstanceUID=" + ValueAsString(summary, DICOM_TAG_SERIES_INSTANCE_UID); } else { @@ -138,7 +153,7 @@ { if (t.size() > 0) t += ", "; - t += "SOPInstanceUID=" + summary.GetValue(DICOM_TAG_SOP_INSTANCE_UID).AsString(); + t += "SOPInstanceUID=" + ValueAsString(summary, DICOM_TAG_SOP_INSTANCE_UID); } else { @@ -168,7 +183,12 @@ { const DicomElement& element = flattened.GetElement(i); const DicomTag& tag = element.GetTag(); - database.SetMainDicomTag(resource, tag, element.GetValue().AsString()); + const DicomValue& value = element.GetValue(); + if (!value.IsNull() && + !value.IsBinary()) + { + database.SetMainDicomTag(resource, tag, element.GetValue().GetContent()); + } } } @@ -180,9 +200,10 @@ { const DicomValue* value = tags.TestAndGetValue(tag); if (value != NULL && - !value->IsNull()) + !value->IsNull() && + !value->IsBinary()) { - std::string s = value->AsString(); + std::string s = value->GetContent(); if (tag != DICOM_TAG_PATIENT_ID && tag != DICOM_TAG_STUDY_INSTANCE_UID &&