diff Framework/Loaders/LoaderCache.cpp @ 1440:49f31fa332b3 loader-injection-feature

Merge from default.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 26 May 2020 09:52:09 +0200
parents 4e233e3ea53b
children 30deba7bc8e2
line wrap: on
line diff
--- a/Framework/Loaders/LoaderCache.cpp	Tue May 19 07:39:03 2020 +0200
+++ b/Framework/Loaders/LoaderCache.cpp	Tue May 26 09:52:09 2020 +0200
@@ -164,44 +164,24 @@
     }
   }
   
-  /**
-  This method allows to convert a list of string into a string by 
-  sorting the strings then joining them
-  */
-  static std::string SortAndJoin(const std::vector<std::string>& stringList)
+  std::string LoaderCache::BuildDicomStructureSetLoaderKey(
+    const std::string& instanceUuid,
+    const std::string& uniqueKey)
   {
-    if (stringList.size() == 0)
-    {
-      return "";
-    } 
-    else
-    {
-      std::vector<std::string> sortedStringList = stringList;
-      std::sort(sortedStringList.begin(), sortedStringList.end());
-      std::stringstream s;
-      s << sortedStringList[0];
-      for (size_t i = 1; i < sortedStringList.size(); ++i)
-      {
-        s << "-" << sortedStringList[i];
-      }
-      return s.str();
-    }
+    return instanceUuid + "_" + uniqueKey;
   }
-  
-  boost::shared_ptr<DicomStructureSetLoader> 
-    LoaderCache::GetDicomStructureSetLoader(
+
+  boost::shared_ptr<DicomStructureSetLoader> LoaderCache::GetDicomStructureSetLoader(
       std::string inInstanceUuid, 
-      const std::vector<std::string>& initiallyVisibleStructures)
+      const std::vector<std::string>& initiallyVisibleStructures,
+      const std::string& uniqueKey)
   {
     try
     {
       // normalize keys a little
       NormalizeUuid(inInstanceUuid);
 
-      std::string initiallyVisibleStructuresKey = 
-        SortAndJoin(initiallyVisibleStructures);
-
-      std::string entryKey = inInstanceUuid + "_" + initiallyVisibleStructuresKey;
+      std::string entryKey = BuildDicomStructureSetLoaderKey(inInstanceUuid, uniqueKey);
 
       // find in cache
       if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end())