# HG changeset patch # User Benjamin Golinvaux # Date 1589894987 -7200 # Node ID 96044a18b98d7f3d11be921123546bb2e3d89fb1 # Parent 297e57d3508c7de7c9ecfd856585bf0b4ef224b2 DicomStructureSetLoader instances are now indexed by their instanceid AND a uniquekey that is passed (*not* depending on the initially visible structures anymore) diff -r 297e57d3508c -r 96044a18b98d Framework/Loaders/LoaderCache.cpp --- a/Framework/Loaders/LoaderCache.cpp Tue May 19 15:28:55 2020 +0200 +++ b/Framework/Loaders/LoaderCache.cpp Tue May 19 15:29:47 2020 +0200 @@ -187,21 +187,25 @@ return s.str(); } } - - boost::shared_ptr - LoaderCache::GetDicomStructureSetLoader( + + std::string LoaderCache::BuildDicomStructureSetLoaderKey( + const std::string& instanceUuid, + const std::string& uniqueKey) + { + return instanceUuid + "_" + uniqueKey; + } + + boost::shared_ptr LoaderCache::GetDicomStructureSetLoader( std::string inInstanceUuid, - const std::vector& initiallyVisibleStructures) + const std::vector& 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()) diff -r 297e57d3508c -r 96044a18b98d Framework/Loaders/LoaderCache.h --- a/Framework/Loaders/LoaderCache.h Tue May 19 15:28:55 2020 +0200 +++ b/Framework/Loaders/LoaderCache.h Tue May 19 15:29:47 2020 +0200 @@ -60,10 +60,24 @@ boost::shared_ptr GetMultiframeVolumeLoader(std::string instanceUuid); + /** + The DicomStructureSetLoader instances are stored in a map and indexed + by a key built from instanceUuid and uniqueKey. + + If instanceUuid and uniqueKey correspond to an already existing loader, it is returned. + + Please note that initiallyVisibleStructures is only used if the call results in the creation + of a new loader. In that case, the value is passed to the constructor. + */ boost::shared_ptr GetDicomStructureSetLoader( std::string instanceUuid, - const std::vector& initiallyVisibleStructures); + const std::vector& initiallyVisibleStructures, + const std::string& uniqueKey = ""); + + std::string BuildDicomStructureSetLoaderKey( + const std::string& instanceUuid, + const std::string& uniqueKey = ""); void ClearCache();