changeset 2090:c2dfc253bd04 dicom-sr

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Nov 2023 19:35:48 +0100
parents 63d77859edee
children 35de56fb6f89
files Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp
diffstat 1 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 07 19:30:44 2023 +0100
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 07 19:35:48 2023 +0100
@@ -422,25 +422,25 @@
 
   void Handle(const OrthancStone::SeriesMetadataLoader::SuccessMessage& message)
   {
-    if (observer_.get() != NULL)
-    {
-      for (size_t i = 0; i < message.GetInstancesCount(); i++)
+    for (size_t i = 0; i < message.GetInstancesCount(); i++)
+    {
+      std::string sopInstanceUid, sopClassUid;
+      if (message.GetInstance(i).LookupStringValue(sopInstanceUid, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false) &&
+          message.GetInstance(i).LookupStringValue(sopClassUid, Orthanc::DICOM_TAG_SOP_CLASS_UID, false) &&
+          OrthancStone::StringToSopClassUid(sopClassUid) == OrthancStone::SopClassUid_ComprehensiveSR)
       {
-        std::string sopInstanceUid, sopClassUid;
-        if (message.GetInstance(i).LookupStringValue(sopInstanceUid, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false) &&
-            message.GetInstance(i).LookupStringValue(sopClassUid, Orthanc::DICOM_TAG_SOP_CLASS_UID, false) &&
-            OrthancStone::StringToSopClassUid(sopClassUid) == OrthancStone::SopClassUid_ComprehensiveSR)
-        {
-          std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock());
-          lock->Schedule(
-            GetSharedObserver(), PRIORITY_NORMAL, OrthancStone::ParseDicomFromWadoCommand::Create(
-              source_, message.GetStudyInstanceUid(), message.GetSeriesInstanceUid(), sopInstanceUid,
-              false /* no transcoding */, Orthanc::DicomTransferSyntax_LittleEndianExplicit /* dummy value */,
-              new InstanceInfo(message.GetStudyInstanceUid(), message.GetSeriesInstanceUid(), OrthancStone::SopClassUid_ComprehensiveSR)));
-          return;
-        }
+        std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock());
+        lock->Schedule(
+          GetSharedObserver(), PRIORITY_NORMAL, OrthancStone::ParseDicomFromWadoCommand::Create(
+            source_, message.GetStudyInstanceUid(), message.GetSeriesInstanceUid(), sopInstanceUid,
+            false /* no transcoding */, Orthanc::DicomTransferSyntax_LittleEndianExplicit /* dummy value */,
+            new InstanceInfo(message.GetStudyInstanceUid(), message.GetSeriesInstanceUid(), OrthancStone::SopClassUid_ComprehensiveSR)));
+        return;
       }
-
+    }
+
+    if (observer_.get() != NULL)
+    {
       observer_->SignalSeriesMetadataLoaded(
         message.GetStudyInstanceUid(), message.GetSeriesInstanceUid());
     }
@@ -557,6 +557,12 @@
             {
               LOG(ERROR) << "YOU " << it->GetSopInstanceUid() << " " << it->GetFrameNumber();
             }
+
+            if (observer_.get() != NULL)
+            {
+              observer_->SignalSeriesMetadataLoaded(
+                info.GetStudyInstanceUid(), info.GetSeriesInstanceUid());
+            }
           }
           catch (Orthanc::OrthancException& e)
           {