Mercurial > hg > orthanc-webviewer
comparison Plugin/Plugin.cpp @ 100:f5b1a9267da0 refactoring
remove unused classes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Nov 2015 21:45:21 +0100 |
parents | 46ec13a1177c |
children | 21123729ac71 |
comparison
equal
deleted
inserted
replaced
99:46ec13a1177c | 100:f5b1a9267da0 |
---|---|
25 | 25 |
26 #include "../Orthanc/Core/OrthancException.h" | 26 #include "../Orthanc/Core/OrthancException.h" |
27 #include "ViewerToolbox.h" | 27 #include "ViewerToolbox.h" |
28 #include "ViewerPrefetchPolicy.h" | 28 #include "ViewerPrefetchPolicy.h" |
29 #include "DecodedImageAdapter.h" | 29 #include "DecodedImageAdapter.h" |
30 #include "InstanceInformationAdapter.h" | |
31 #include "SeriesInformationAdapter.h" | 30 #include "SeriesInformationAdapter.h" |
32 #include "../Orthanc/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.h" | 31 #include "../Orthanc/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.h" |
33 #include "../Orthanc/Core/Toolbox.h" | 32 #include "../Orthanc/Core/Toolbox.h" |
34 | 33 |
35 | 34 |
74 std::auto_ptr<Orthanc::IDynamicObject> obj(cache->newInstances_.Dequeue(100)); | 73 std::auto_ptr<Orthanc::IDynamicObject> obj(cache->newInstances_.Dequeue(100)); |
75 if (obj.get() != NULL) | 74 if (obj.get() != NULL) |
76 { | 75 { |
77 const std::string& instanceId = dynamic_cast<DynamicString&>(*obj).GetValue(); | 76 const std::string& instanceId = dynamic_cast<DynamicString&>(*obj).GetValue(); |
78 | 77 |
79 // On the reception of a new instance, precompute its spatial position | 78 // On the reception of a new instance, indalidate the parent series of the instance |
80 cache->GetScheduler().Prefetch(OrthancPlugins::CacheBundle_InstanceInformation, instanceId); | |
81 | |
82 // Indalidate the parent series of the instance | |
83 std::string uri = "/instances/" + std::string(instanceId); | 79 std::string uri = "/instances/" + std::string(instanceId); |
84 Json::Value instance; | 80 Json::Value instance; |
85 if (OrthancPlugins::GetJsonFromOrthanc(instance, context_, uri)) | 81 if (OrthancPlugins::GetJsonFromOrthanc(instance, context_, uri)) |
86 { | 82 { |
87 std::string seriesId = instance["ParentSeries"].asString(); | 83 std::string seriesId = instance["ParentSeries"].asString(); |
441 /* Create the cache */ | 437 /* Create the cache */ |
442 cache_ = new CacheContext(cachePath.string()); | 438 cache_ = new CacheContext(cachePath.string()); |
443 cache_->GetScheduler().RegisterPolicy(new ViewerPrefetchPolicy(context_)); | 439 cache_->GetScheduler().RegisterPolicy(new ViewerPrefetchPolicy(context_)); |
444 cache_->GetScheduler().Register(CacheBundle_SeriesInformation, | 440 cache_->GetScheduler().Register(CacheBundle_SeriesInformation, |
445 new SeriesInformationAdapter(context_, cache_->GetScheduler()), 1); | 441 new SeriesInformationAdapter(context_, cache_->GetScheduler()), 1); |
446 cache_->GetScheduler().Register(CacheBundle_InstanceInformation, | |
447 new InstanceInformationAdapter(context_), 1); | |
448 cache_->GetScheduler().Register(CacheBundle_DecodedImage, | 442 cache_->GetScheduler().Register(CacheBundle_DecodedImage, |
449 new DecodedImageAdapter(context_), decodingThreads); | 443 new DecodedImageAdapter(context_), decodingThreads); |
450 | 444 |
451 | 445 |
452 /* Set the quotas */ | 446 /* Set the quotas */ |
453 cache_->GetScheduler().SetQuota(CacheBundle_SeriesInformation, 1000, 0); // Keep info about 1000 series | 447 cache_->GetScheduler().SetQuota(CacheBundle_SeriesInformation, 1000, 0); // Keep info about 1000 series |
454 cache_->GetScheduler().SetQuota(CacheBundle_InstanceInformation, 10000, 0); // Keep info about 10,000 instances | |
455 | 448 |
456 message = "Web viewer using a cache of " + boost::lexical_cast<std::string>(cacheSize) + " MB"; | 449 message = "Web viewer using a cache of " + boost::lexical_cast<std::string>(cacheSize) + " MB"; |
457 OrthancPluginLogWarning(context_, message.c_str()); | 450 OrthancPluginLogWarning(context_, message.c_str()); |
458 | 451 |
459 cache_->GetScheduler().SetQuota(CacheBundle_DecodedImage, 0, static_cast<uint64_t>(cacheSize) * 1024 * 1024); | 452 cache_->GetScheduler().SetQuota(CacheBundle_DecodedImage, 0, static_cast<uint64_t>(cacheSize) * 1024 * 1024); |