Mercurial > hg > orthanc-stone
changeset 1448:dad6a2fe6fc7 loader-injection-feature
Added setters to control relative priority of CT series loader requests.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 02 Jun 2020 13:16:40 +0200 |
parents | f3f4cd58fde4 |
children | 11141df26e0d |
files | Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h Samples/Common/RtViewerApp.cpp |
diffstat | 3 files changed, 63 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); boost::shared_ptr<IObserver> 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<OrthancStone::DicomVolumeImage> 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<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); boost::shared_ptr<IObserver> observer(GetSharedObserver()); - lock->Schedule(observer, 0, command.release()); //TODO: priority! + lock->Schedule(observer, medadataSchedulingPriority_, command.release()); } } }
--- 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<ISlicePostProcessor> slicePostProcessor_; + /** See priority setters/getters below */ + int medadataSchedulingPriority_; + + /** See priority setters/getters below */ + int sliceSchedulingPriority_; + OrthancSeriesVolumeProgressiveLoader( OrthancStone::ILoadersContext& loadersContext, boost::shared_ptr<OrthancStone::DicomVolumeImage> 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<ISlicePostProcessor> slicePostProcessor) { // this will delete the previously stored slice processor, if any
--- 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_;