changeset 1719:9a1f79d21a3f

added buttons to go to the first and last frames
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Dec 2020 10:42:45 +0100
parents 65c03d33c345
children b8d19f53aaca
files Applications/StoneWebViewer/NOTES.txt Applications/StoneWebViewer/WebApplication/index.html Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp TODO
diffstat 4 files changed, 77 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NOTES.txt	Tue Dec 01 10:21:37 2020 +0100
+++ b/Applications/StoneWebViewer/NOTES.txt	Tue Dec 01 10:42:45 2020 +0100
@@ -16,6 +16,12 @@
   currently support annotations, and will not support Live Share.
 
 
+- The Stone Web viewer has no "timeline" bar to see the position of
+  the current frame in the series. However, pressing the "Ctrl" key
+  together with mouse wheel enables fast move, i.e. this changes the
+  current frame by skipping 1/20th of the frames in the series.
+
+
 - The Stone Web viewer uses the DICOM identifiers, while the Osimis Web
   viewer uses the Orthanc identifiers.
   https://book.orthanc-server.com/faq/orthanc-ids.html
--- a/Applications/StoneWebViewer/WebApplication/index.html	Tue Dec 01 10:21:37 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Tue Dec 01 10:42:45 2020 +0100
@@ -630,13 +630,23 @@
                           {{ cineFramesPerSecond }} fps
                         </label>
                       </div>
-                      <button class="btn btn-primary btn-sm" @click="DecrementFrame()">
-                        <i class="fa fa-chevron-circle-left"></i>
-                      </button>
+                      <div class="btn-group btn-group-sm" role="group">                        
+                        <button class="btn btn-primary" @click="stone.GoToFirstFrame(canvasId)">
+                          <i class="fas fa-fast-backward"></i>
+                        </button>
+                        <button class="btn btn-primary" @click="DecrementFrame()">
+                          <i class="fas fa-step-backward"></i>
+                        </button>
+                      </div>
                       &nbsp;&nbsp;{{ currentFrame }} / {{ numberOfFrames }}&nbsp;&nbsp;
-                      <button class="btn btn-primary btn-sm" @click="IncrementFrame()">
-                        <i class="fa fa-chevron-circle-right"></i>
-                      </button>
+                      <div class="btn-group btn-group-sm" role="group">                        
+                        <button class="btn btn-primary" @click="IncrementFrame()">
+                          <i class="fas fa-step-forward"></i>
+                        </button>
+                        <button class="btn btn-primary" @click="stone.GoToLastFrame(canvasId)">
+                          <i class="fas fa-fast-forward"></i>
+                        </button>
+                      </div>
                       <div class="btn-group btn-group-sm" role="group">                        
                         <button type="button" class="btn btn-primary" @click="CinePlay()">
                           <i class="fas fa-play fa-flip-horizontal"></i>
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Dec 01 10:21:37 2020 +0100
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Dec 01 10:42:45 2020 +0100
@@ -1026,6 +1026,11 @@
     UpdatePrefetch();
   }
 
+  size_t GetFramesCount() const
+  {
+    return framesCount_;
+  }
+
   void SetCircularPrefetch(bool isCircularPrefetch)
   {
     isCircularPrefetch_ = isCircularPrefetch;
@@ -2278,6 +2283,31 @@
 
     return false;
   }
+
+
+  void GoToFirstFrame()
+  {
+    if (cursor_.get() != NULL &&
+        cursor_->GetCurrentIndex() != 0)
+    {
+      cursor_->SetCurrentIndex(0);
+      Redraw();
+    }
+  }
+
+
+  void GoToLastFrame()
+  {
+    if (cursor_.get() != NULL)
+    {
+      size_t last = cursor_->GetFramesCount() - 1;
+      if (cursor_->GetCurrentIndex() != last)
+      {
+        cursor_->SetCurrentIndex(last);
+        Redraw();
+      }
+    }
+  }
   
 
   bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const
@@ -3197,6 +3227,28 @@
 
 
   EMSCRIPTEN_KEEPALIVE
+  void GoToFirstFrame(const char* canvas)
+  {
+    try
+    {
+      GetViewport(canvas)->GoToFirstFrame();
+    }
+    EXTERN_CATCH_EXCEPTIONS;
+  }
+
+
+  EMSCRIPTEN_KEEPALIVE
+  void GoToLastFrame(const char* canvas)
+  {
+    try
+    {
+      GetViewport(canvas)->GoToLastFrame();
+    }
+    EXTERN_CATCH_EXCEPTIONS;
+  }
+
+
+  EMSCRIPTEN_KEEPALIVE
   void ShowReferenceLines(int show)
   {
     try
--- a/TODO	Tue Dec 01 10:21:37 2020 +0100
+++ b/TODO	Tue Dec 01 10:42:45 2020 +0100
@@ -22,6 +22,9 @@
 Wishlist
 --------
 
+* Vertical "timeline" to see the position of the current frame in the
+  series, and to change the current frame by clicking on the timeline.
+
 * Display video files even if the Orthanc REST API is not available
   (using pure DICOMweb). This could possible be done using the
   DICOMweb Bulk Data URI, and/or a dedicated JavaScript video player.