Mercurial > hg > orthanc-stone
changeset 1438:96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
a uniquekey that is passed (*not* depending on the initially visible structures anymore)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 19 May 2020 15:29:47 +0200 |
parents | 297e57d3508c |
children | 4e233e3ea53b |
files | Framework/Loaders/LoaderCache.cpp Framework/Loaders/LoaderCache.h |
diffstat | 2 files changed, 27 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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<DicomStructureSetLoader> - LoaderCache::GetDicomStructureSetLoader( + + std::string LoaderCache::BuildDicomStructureSetLoaderKey( + const std::string& instanceUuid, + const std::string& uniqueKey) + { + return instanceUuid + "_" + uniqueKey; + } + + 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())
--- 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<OrthancMultiframeVolumeLoader> 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<DicomStructureSetLoader> GetDicomStructureSetLoader( std::string instanceUuid, - const std::vector<std::string>& initiallyVisibleStructures); + const std::vector<std::string>& initiallyVisibleStructures, + const std::string& uniqueKey = ""); + + std::string BuildDicomStructureSetLoaderKey( + const std::string& instanceUuid, + const std::string& uniqueKey = ""); void ClearCache();