changeset 2181:eae006bfeea6 default tip

support images without the "Modality" tag
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 Nov 2024 16:37:46 +0100
parents 356ae7ad47e4
children
files Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 26 14:39:09 2024 +0100
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 26 16:37:46 2024 +0100
@@ -516,13 +516,17 @@
 
       for (size_t i = 0; i < dicom.GetSize(); i++)
       {
-        std::string studyInstanceUid, seriesInstanceUid, modality;
+        std::string modality;
+        if (!dicom.GetResource(i).LookupStringValue(modality, Orthanc::DICOM_TAG_MODALITY, false))
+        {
+          modality = ""; // Arbitrary value if "Modality" is missing
+        }
+
+        std::string studyInstanceUid, seriesInstanceUid;
         if (dicom.GetResource(i).LookupStringValue(
               studyInstanceUid, Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, false) &&
             dicom.GetResource(i).LookupStringValue(
-              seriesInstanceUid, Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, false) &&
-            dicom.GetResource(i).LookupStringValue(
-              modality, Orthanc::DICOM_TAG_MODALITY, false))
+              seriesInstanceUid, Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, false))
         {
           // skip series that should not be displayed
           if (std::find(skipSeriesFromModalities_.begin(), skipSeriesFromModalities_.end(), modality) == skipSeriesFromModalities_.end())