changeset 1755:1a775f4ee672

added ability to specify initial slice in BasicFetchingStrategy and using it in OrthancSeriesVolumeProgressiveLoader
author bgo@SHARKNADO.localdomain
date Mon, 26 Apr 2021 12:05:40 +0200
parents 34ab7f643327
children b235999cad69 28979b77ce90
files OrthancStone/Sources/Loaders/BasicFetchingStrategy.cpp OrthancStone/Sources/Loaders/BasicFetchingStrategy.h OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.h
diffstat 4 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/BasicFetchingStrategy.cpp	Mon Apr 26 12:05:02 2021 +0200
+++ b/OrthancStone/Sources/Loaders/BasicFetchingStrategy.cpp	Mon Apr 26 12:05:40 2021 +0200
@@ -42,7 +42,8 @@
     
 
   BasicFetchingStrategy::BasicFetchingStrategy(IFetchingItemsSorter* sorter,   // Takes ownership
-                                               unsigned int maxQuality) :
+                                               unsigned int maxQuality,
+                                               unsigned int initialItem) :
     sorter_(sorter),
     maxQuality_(maxQuality),
     position_(0),
@@ -55,7 +56,7 @@
 
     nextQuality_.resize(sorter_->GetItemsCount(), 0);   // Does not change along calls to "SetCurrent()"
       
-    SetCurrent(0);
+    SetCurrent(initialItem);
   }
 
 
--- a/OrthancStone/Sources/Loaders/BasicFetchingStrategy.h	Mon Apr 26 12:05:02 2021 +0200
+++ b/OrthancStone/Sources/Loaders/BasicFetchingStrategy.h	Mon Apr 26 12:05:40 2021 +0200
@@ -71,7 +71,8 @@
     
   public:
     BasicFetchingStrategy(IFetchingItemsSorter* sorter,   // Takes ownership
-                          unsigned int maxQuality);
+                          unsigned int maxQuality,
+                          unsigned int initialItem = 0);
 
     virtual unsigned int GetItemsCount() const ORTHANC_OVERRIDE
     {
--- a/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon Apr 26 12:05:02 2021 +0200
+++ b/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon Apr 26 12:05:40 2021 +0200
@@ -397,9 +397,14 @@
       if (progressiveQuality_)
         maxQuality = QUALITY_02;
 
+      unsigned int initialSlice = 0;
+      if (startCenter_)
+          initialSlice = static_cast<unsigned int>(slicesCount) / 2;
+
       strategy_.reset(new BasicFetchingStrategy(
         sorter_->CreateSorter(static_cast<unsigned int>(slicesCount)),
-        maxQuality));
+        maxQuality,
+        initialSlice));
 
       assert(simultaneousDownloads_ != 0);
       for (unsigned int i = 0; i < simultaneousDownloads_; i++)
@@ -528,6 +533,7 @@
     : loadersContext_(loadersContext)
     , active_(false)
     , progressiveQuality_(progressiveQuality)
+    , startCenter_(false)
     , simultaneousDownloads_(4)
     , volume_(volume)
     , sorter_(new BasicFetchingItemsSorter::Factory)
@@ -568,6 +574,11 @@
   OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()
   {
     LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()";
+  }
+
+  void OrthancSeriesVolumeProgressiveLoader::SetStartCenter(bool startCenter)
+  {
+      startCenter_ = startCenter;
   }
 
   void OrthancSeriesVolumeProgressiveLoader::SetSimultaneousDownloads(unsigned int count)
--- a/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.h	Mon Apr 26 12:05:02 2021 +0200
+++ b/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.h	Mon Apr 26 12:05:40 2021 +0200
@@ -121,6 +121,7 @@
     ILoadersContext&                                loadersContext_;
     bool                                            active_;
     bool                                            progressiveQuality_;
+    bool                                            startCenter_;
     unsigned int                                    simultaneousDownloads_;
     SeriesGeometry                                  seriesGeometry_;
     boost::shared_ptr<DicomVolumeImage>             volume_;
@@ -154,6 +155,8 @@
 
     virtual ~OrthancSeriesVolumeProgressiveLoader();
 
+    void SetStartCenter(bool startCenter);
+
     void SetSimultaneousDownloads(unsigned int count);
 
     /**