changeset 338:c86dba636bc4

fix frame numbering
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Jun 2019 15:16:37 +0200
parents 496573be1794
children 21abf59cd7f0
files Plugin/Plugin.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Mon Jun 24 17:15:59 2019 +0200
+++ b/Plugin/Plugin.cpp	Tue Jun 25 15:16:37 2019 +0200
@@ -432,9 +432,11 @@
       std::map<std::string, std::string> headers;
       headers["Accept"] = Orthanc::EnumerationToString(mime);
 
+      // NB: In DICOMweb, the "frame" parameter is in the range [1..N], whereas
+      // Orthanc uses range [0..N-1], hence the "-1" below
       OrthancPlugins::MemoryBuffer buffer;
       if (buffer.RestApiGet("/instances/" + instanceId + "/frames/" +
-                            boost::lexical_cast<std::string>(frame) + "/preview", headers, false))
+                            boost::lexical_cast<std::string>(frame - 1) + "/preview", headers, false))
       {
         OrthancPluginAnswerBuffer(context, output, buffer.GetData(),
                                   buffer.GetSize(), Orthanc::EnumerationToString(mime));
@@ -448,7 +450,7 @@
                               const char* url,
                               const OrthancPluginHttpRequest* request)
 {
-  AnswerFrameRendered(output, 0, request);
+  AnswerFrameRendered(output, 1 /* first frame */, request);
 }