diff Framework/Loaders/DicomStructureSetLoader.h @ 1019:29f5f2031310

Added a way to specificy which structures are to be initially displayed (the default being ALL structures displayed) + the loader maintains a list of structure display state, that can be modified continuously + the cache now takes the initial list of structure into account for computing the entry + added methods to change the loaded structure visibility + disabled the alternate loaders (DicomStructureSetLoader2 and friends) + disabled corresponding tests
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 27 Sep 2019 13:32:05 +0200
parents 50e5acf5553b
children 7014c2397b45
line wrap: on
line diff
--- a/Framework/Loaders/DicomStructureSetLoader.h	Thu Sep 26 09:22:27 2019 +0200
+++ b/Framework/Loaders/DicomStructureSetLoader.h	Fri Sep 27 13:32:05 2019 +0200
@@ -25,6 +25,8 @@
 #include "../Volumes/IVolumeSlicer.h"
 #include "LoaderStateMachine.h"
 
+#include <vector>
+
 namespace OrthancStone
 {
   class DicomStructureSetLoader :
@@ -48,16 +50,46 @@
 
     // will be set to true once the loading is finished
     bool                              structuresReady_;
-    
+
+    /**
+    At load time, these strings is used to initialize the 
+    structureVisibility_ vector.
+
+    As a special case, if initiallyVisibleStructures_ is empty, ALL structures
+    will be made visible.
+    */
+    std::vector<std::string> initiallyVisibleStructures_;
+
+    /**
+    Contains the "Should this structure be displayed?" flag for all structures.
+    Only filled when structures are loaded.
+
+    Changing this value directly affects the rendering
+    */
+    std::vector<bool>                  structureVisibility_;
+
   public:
     ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, StructuresReady, DicomStructureSetLoader);
 
     DicomStructureSetLoader(IOracle& oracle,
                             IObservable& oracleObservable);    
     
+    DicomStructureSet* GetContent()
+    {
+      return content_.get();
+    }
+
+    void SetStructureDisplayState(size_t structureIndex, bool display);
+    
+    bool GetStructureDisplayState(size_t structureIndex) const
+    {
+      return structureVisibility_.at(structureIndex);
+    }
+
     ~DicomStructureSetLoader();
     
-    void LoadInstance(const std::string& instanceId);
+    void LoadInstance(const std::string& instanceId, 
+                      const std::vector<std::string>& initiallyVisibleStructures = std::vector<std::string>());
 
     virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE;