# HG changeset patch # User Benjamin Golinvaux # Date 1591096600 -7200 # Node ID dad6a2fe6fc761cfbd56471966095944d825fca0 # Parent f3f4cd58fde49af772995bbcce0c9c0dcd56ead7 Added setters to control relative priority of CT series loader requests. diff -r f3f4cd58fde4 -r dad6a2fe6fc7 Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp --- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Tue Jun 02 12:34:27 2020 +0200 +++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Tue Jun 02 13:16:40 2020 +0200 @@ -322,7 +322,7 @@ { std::unique_ptr lock(loadersContext_.Lock()); boost::shared_ptr observer(GetSharedObserver()); - lock->Schedule(observer, 0, command.release()); // TODO: priority! + lock->Schedule(observer, sliceSchedulingPriority_, command.release()); } } else @@ -479,6 +479,33 @@ SetSliceContent(GetSliceIndexPayload(message.GetOrigin()), message.GetImage(), quality); } + + void OrthancSeriesVolumeProgressiveLoader::SetMetadataSchedulingPriority(int p) + { + medadataSchedulingPriority_ = p; + } + + int OrthancSeriesVolumeProgressiveLoader::GetMetadataSchedulingPriority() const + { + return medadataSchedulingPriority_; + } + + void OrthancSeriesVolumeProgressiveLoader::SetSliceSchedulingPriority(int p) + { + sliceSchedulingPriority_ = p; + } + + int OrthancSeriesVolumeProgressiveLoader::GetSliceSchedulingPriority() const + { + return sliceSchedulingPriority_; + } + + void OrthancSeriesVolumeProgressiveLoader::SetSchedulingPriority(int p) + { + medadataSchedulingPriority_ = p; + sliceSchedulingPriority_ = p; + } + OrthancSeriesVolumeProgressiveLoader::OrthancSeriesVolumeProgressiveLoader( OrthancStone::ILoadersContext& loadersContext, boost::shared_ptr volume, @@ -490,6 +517,8 @@ , volume_(volume) , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory) , volumeImageReadyInHighQuality_(false) + , medadataSchedulingPriority_(0) + , sliceSchedulingPriority_(0) { } @@ -560,7 +589,7 @@ { std::unique_ptr lock(loadersContext_.Lock()); boost::shared_ptr observer(GetSharedObserver()); - lock->Schedule(observer, 0, command.release()); //TODO: priority! + lock->Schedule(observer, medadataSchedulingPriority_, command.release()); } } } diff -r f3f4cd58fde4 -r dad6a2fe6fc7 Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h --- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h Tue Jun 02 12:34:27 2020 +0200 +++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h Tue Jun 02 13:16:40 2020 +0200 @@ -131,6 +131,12 @@ boost::shared_ptr slicePostProcessor_; + /** See priority setters/getters below */ + int medadataSchedulingPriority_; + + /** See priority setters/getters below */ + int sliceSchedulingPriority_; + OrthancSeriesVolumeProgressiveLoader( OrthancStone::ILoadersContext& loadersContext, boost::shared_ptr volume, @@ -151,6 +157,28 @@ void SetSimultaneousDownloads(unsigned int count); + /** + Sets the relative priority of the requests for metadata. + - if p < PRIORITY_HIGH (-1) , the requests will be high priority + - if PRIORITY_LOW (100) > p > PRIORITY_HIGH , the requests will be medium priority + - if p > PRIORITY_LOW , the requests will be low priority + + Default is 0 (medium) + */ + void SetMetadataSchedulingPriority(int p); + + /** @see SetMetadataSchedulingPriority */ + int GetMetadataSchedulingPriority() const; + + /** Same as SetMetadataSchedulingPriority, for slices. Default is 0. */ + void SetSliceSchedulingPriority(int p); + + /** @see SetSliceSchedulingPriority */ + int GetSliceSchedulingPriority() const; + + /** Sets priorities for all requests. @see SetMetadataSchedulingPriority */ + void SetSchedulingPriority(int p); + void SetDicomSlicePostProcessor(boost::shared_ptr slicePostProcessor) { // this will delete the previously stored slice processor, if any diff -r f3f4cd58fde4 -r dad6a2fe6fc7 Samples/Common/RtViewerApp.cpp --- a/Samples/Common/RtViewerApp.cpp Tue Jun 02 12:34:27 2020 +0200 +++ b/Samples/Common/RtViewerApp.cpp Tue Jun 02 13:16:40 2020 +0200 @@ -119,6 +119,10 @@ // "false" means only using hi quality // TODO: add flag for quality ctLoader_ = OrthancSeriesVolumeProgressiveLoader::Create(*loadersContext_, ctVolume_, true); + + // better priority for CT vs dose and struct + ctLoader_->SetSchedulingPriority(-100); + // we need to store the CT loader to ask from geometry details later on when geometry is loaded geometryProvider_ = ctLoader_;