Mercurial > hg > orthanc
diff OrthancServer/ServerToolbox.cpp @ 1737:ec66a16aa398
removal of DicomStringValue and DicomNullValue
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 22 Oct 2015 07:52:24 +0200 |
parents | a7c05bbfaf6a |
children | b3de74dec2d5 |
line wrap: on
line diff
--- a/OrthancServer/ServerToolbox.cpp Wed Oct 21 16:52:23 2015 +0200 +++ b/OrthancServer/ServerToolbox.cpp Thu Oct 22 07:52:24 2015 +0200 @@ -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 &&