changeset 2206:efaf25d1f131 dicom-sr

preparing integration into dicom-sr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Apr 2025 13:44:56 +0200 (3 weeks ago)
parents 9cf65929ec25
children 02cee9f4c147
files Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp
diffstat 1 files changed, 25 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Apr 22 13:02:39 2025 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Apr 22 13:44:56 2025 +0200
@@ -289,6 +289,8 @@
   {
   }
 
+  virtual FramesCollectionType GetType() const = 0;
+
   virtual size_t GetFramesCount() const = 0;
 
   virtual const OrthancStone::DicomInstanceParameters& GetInstanceOfFrame(size_t frameIndex) const = 0;
@@ -303,13 +305,6 @@
                                 const OrthancStone::Vector& point,
                                 double maximumDistance) const = 0;
 
-  virtual OrthancStone::ISceneLayer* ExtractAnnotations(const std::string& sopInstanceUid,
-                                                        unsigned int frameNumber,
-                                                        double originX,
-                                                        double originY,
-                                                        double pixelSpacingX,
-                                                        double pixelSpacingY) const = 0;
-
   static OrthancStone::CoordinateSystem3D GetFrameGeometry(const IFramesCollection& frames,
                                                            size_t frameIndex)
   {
@@ -336,6 +331,11 @@
     }
   }
 
+  virtual FramesCollectionType GetType() const ORTHANC_OVERRIDE
+  {
+    return FramesCollectionType_None;
+  }
+
   virtual size_t GetFramesCount() const ORTHANC_OVERRIDE
   {
     return frames_->GetFramesCount();
@@ -364,16 +364,6 @@
   {
     return frames_->FindClosestFrame(frameIndex, point, maximumDistance);
   }
-
-  virtual OrthancStone::ISceneLayer* ExtractAnnotations(const std::string& sopInstanceUid,
-                                                        unsigned int frameNumber,
-                                                        double originX,
-                                                        double originY,
-                                                        double pixelSpacingX,
-                                                        double pixelSpacingY) const ORTHANC_OVERRIDE
-  {
-    return NULL;
-  }
 };
 
 
@@ -475,6 +465,11 @@
     Finalize();
   }
 
+  virtual FramesCollectionType GetType() const ORTHANC_OVERRIDE
+  {
+    return FramesCollectionType_DicomSR;
+  }
+
   virtual size_t GetFramesCount() const ORTHANC_OVERRIDE
   {
     return frames_.size();
@@ -527,12 +522,12 @@
     return found;
   }
 
-  virtual OrthancStone::ISceneLayer* ExtractAnnotations(const std::string& sopInstanceUid,
-                                                        unsigned int frameNumber,
-                                                        double originX,
-                                                        double originY,
-                                                        double pixelSpacingX,
-                                                        double pixelSpacingY) const ORTHANC_OVERRIDE
+  OrthancStone::ISceneLayer* ExtractAnnotations(const std::string& sopInstanceUid,
+                                                unsigned int frameNumber,
+                                                double originX,
+                                                double originY,
+                                                double pixelSpacingX,
+                                                double pixelSpacingY) const
   {
     std::unique_ptr<OrthancStone::MacroSceneLayer> layer(new OrthancStone::MacroSceneLayer);
 
@@ -2997,11 +2992,13 @@
 
     std::unique_ptr<OrthancStone::ISceneLayer> structuredReportAnnotations;
 
-    if (frames_.get() != NULL)
-    {
-      structuredReportAnnotations.reset(frames_->ExtractAnnotations(instance.GetSopInstanceUid(), frameIndex,
-                                                                    layer->GetOriginX(), layer->GetOriginY(),
-                                                                    layer->GetPixelSpacingX(), layer->GetPixelSpacingY()));
+    if (frames_.get() != NULL &&
+        frames_->GetType() == FramesCollectionType_DicomSR)
+    {
+      const DicomStructuredReportFrames& sr = dynamic_cast<const DicomStructuredReportFrames&>(*frames_);
+      structuredReportAnnotations.reset(sr.ExtractAnnotations(instance.GetSopInstanceUid(), frameIndex,
+                                                              layer->GetOriginX(), layer->GetOriginY(),
+                                                              layer->GetPixelSpacingX(), layer->GetPixelSpacingY()));
     }