Mercurial > hg > orthanc-stone
changeset 136:a06ad9d7406e wasm
ISlicedVolume::NotifyVolumeReady
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jan 2018 12:49:54 +0100 |
parents | e2fe9352f240 |
children | a30ff4866a1e |
files | Framework/Volumes/ISlicedVolume.h Framework/Volumes/SlicedVolumeBase.cpp Framework/Volumes/SlicedVolumeBase.h Framework/dev.h Platforms/Generic/CMakeLists.txt |
diffstat | 5 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Volumes/ISlicedVolume.h Tue Jan 02 09:56:08 2018 +0100 +++ b/Framework/Volumes/ISlicedVolume.h Tue Jan 16 12:49:54 2018 +0100 @@ -48,6 +48,9 @@ virtual void NotifySliceChange(const ISlicedVolume& volume, const size_t& sliceIndex, const Slice& slice) = 0; + + // Triggered when the geometry *and* the content of the volume are available + virtual void NotifyVolumeReady(const ISlicedVolume& volume) = 0; }; virtual ~ISlicedVolume()
--- a/Framework/Volumes/SlicedVolumeBase.cpp Tue Jan 02 09:56:08 2018 +0100 +++ b/Framework/Volumes/SlicedVolumeBase.cpp Tue Jan 16 12:49:54 2018 +0100 @@ -43,4 +43,9 @@ { observers_.Apply(*this, &IObserver::NotifySliceChange, sliceIndex, slice); } + + void SlicedVolumeBase::NotifyVolumeReady() + { + observers_.Apply(*this, &IObserver::NotifyVolumeReady); + } }
--- a/Framework/Volumes/SlicedVolumeBase.h Tue Jan 02 09:56:08 2018 +0100 +++ b/Framework/Volumes/SlicedVolumeBase.h Tue Jan 16 12:49:54 2018 +0100 @@ -43,6 +43,8 @@ virtual void NotifySliceChange(const size_t& sliceIndex, const Slice& slice); + virtual void NotifyVolumeReady(); + public: virtual void Register(IObserver& observer) {
--- a/Framework/dev.h Tue Jan 02 09:56:08 2018 +0100 +++ b/Framework/dev.h Tue Jan 16 12:49:54 2018 +0100 @@ -39,6 +39,7 @@ namespace OrthancStone { + // TODO: Handle errors while loading class OrthancVolumeImage : public SlicedVolumeBase, private OrthancSlicesLoader::ICallback @@ -48,6 +49,7 @@ std::auto_ptr<ImageBuffer3D> image_; std::auto_ptr<DownloadStack> downloadStack_; bool computeRange_; + size_t pendingSlices_; void ScheduleSliceDownload() { @@ -158,6 +160,7 @@ image_->Clear(); downloadStack_.reset(new DownloadStack(loader.GetSliceCount())); + pendingSlices_ = loader.GetSliceCount(); for (unsigned int i = 0; i < 4; i++) // Limit to 4 simultaneous downloads { @@ -186,7 +189,17 @@ Orthanc::ImageProcessing::Copy(writer.GetAccessor(), *image); } - SlicedVolumeBase::NotifySliceChange(sliceIndex, slice); + SlicedVolumeBase::NotifySliceChange(sliceIndex, slice); + + if (pendingSlices_ == 1) + { + SlicedVolumeBase::NotifyVolumeReady(); + pendingSlices_ = 0; + } + else if (pendingSlices_ > 1) + { + pendingSlices_ -= 1; + } ScheduleSliceDownload(); } @@ -204,7 +217,8 @@ OrthancVolumeImage(IWebService& orthanc, bool computeRange) : loader_(*this, orthanc), - computeRange_(computeRange) + computeRange_(computeRange), + pendingSlices_(0) { }
--- a/Platforms/Generic/CMakeLists.txt Tue Jan 02 09:56:08 2018 +0100 +++ b/Platforms/Generic/CMakeLists.txt Tue Jan 16 12:49:54 2018 +0100 @@ -9,7 +9,7 @@ include(../../Resources/CMake/OrthancStoneParameters.cmake) SET(ORTHANC_SANDBOXED OFF) -SET(ORTHANC_BOOST_COMPONENTS program_options) +LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) SET(ENABLE_CRYPTO_OPTIONS ON) SET(ENABLE_GOOGLE_TEST ON) SET(ENABLE_WEB_CLIENT ON)