comparison Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp @ 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 afdd5be8731c
children 30deba7bc8e2
comparison
equal deleted inserted replaced
1447:f3f4cd58fde4 1448:dad6a2fe6fc7
320 command->AcquirePayload(new Orthanc::SingleValueObject<unsigned int>(sliceIndex)); 320 command->AcquirePayload(new Orthanc::SingleValueObject<unsigned int>(sliceIndex));
321 321
322 { 322 {
323 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); 323 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock());
324 boost::shared_ptr<IObserver> observer(GetSharedObserver()); 324 boost::shared_ptr<IObserver> observer(GetSharedObserver());
325 lock->Schedule(observer, 0, command.release()); // TODO: priority! 325 lock->Schedule(observer, sliceSchedulingPriority_, command.release());
326 } 326 }
327 } 327 }
328 else 328 else
329 { 329 {
330 // loading is finished! 330 // loading is finished!
475 default: 475 default:
476 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 476 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
477 } 477 }
478 478
479 SetSliceContent(GetSliceIndexPayload(message.GetOrigin()), message.GetImage(), quality); 479 SetSliceContent(GetSliceIndexPayload(message.GetOrigin()), message.GetImage(), quality);
480 }
481
482
483 void OrthancSeriesVolumeProgressiveLoader::SetMetadataSchedulingPriority(int p)
484 {
485 medadataSchedulingPriority_ = p;
486 }
487
488 int OrthancSeriesVolumeProgressiveLoader::GetMetadataSchedulingPriority() const
489 {
490 return medadataSchedulingPriority_;
491 }
492
493 void OrthancSeriesVolumeProgressiveLoader::SetSliceSchedulingPriority(int p)
494 {
495 sliceSchedulingPriority_ = p;
496 }
497
498 int OrthancSeriesVolumeProgressiveLoader::GetSliceSchedulingPriority() const
499 {
500 return sliceSchedulingPriority_;
501 }
502
503 void OrthancSeriesVolumeProgressiveLoader::SetSchedulingPriority(int p)
504 {
505 medadataSchedulingPriority_ = p;
506 sliceSchedulingPriority_ = p;
480 } 507 }
481 508
482 OrthancSeriesVolumeProgressiveLoader::OrthancSeriesVolumeProgressiveLoader( 509 OrthancSeriesVolumeProgressiveLoader::OrthancSeriesVolumeProgressiveLoader(
483 OrthancStone::ILoadersContext& loadersContext, 510 OrthancStone::ILoadersContext& loadersContext,
484 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume, 511 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume,
488 , progressiveQuality_(progressiveQuality) 515 , progressiveQuality_(progressiveQuality)
489 , simultaneousDownloads_(4) 516 , simultaneousDownloads_(4)
490 , volume_(volume) 517 , volume_(volume)
491 , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory) 518 , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory)
492 , volumeImageReadyInHighQuality_(false) 519 , volumeImageReadyInHighQuality_(false)
520 , medadataSchedulingPriority_(0)
521 , sliceSchedulingPriority_(0)
493 { 522 {
494 } 523 }
495 524
496 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> 525 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader>
497 OrthancSeriesVolumeProgressiveLoader::Create( 526 OrthancSeriesVolumeProgressiveLoader::Create(
558 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); 587 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand);
559 command->SetUri("/series/" + seriesId + "/instances-tags"); 588 command->SetUri("/series/" + seriesId + "/instances-tags");
560 { 589 {
561 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); 590 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock());
562 boost::shared_ptr<IObserver> observer(GetSharedObserver()); 591 boost::shared_ptr<IObserver> observer(GetSharedObserver());
563 lock->Schedule(observer, 0, command.release()); //TODO: priority! 592 lock->Schedule(observer, medadataSchedulingPriority_, command.release());
564 } 593 }
565 } 594 }
566 } 595 }
567 596
568 597