diff Framework/Toolbox/OrthancSlicesLoader.cpp @ 94:7b14c12a3be5 wasm

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 May 2017 18:03:30 +0200
parents 5945e81734a3
children d18dcc963930
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp	Mon May 29 17:28:31 2017 +0200
+++ b/Framework/Toolbox/OrthancSlicesLoader.cpp	Mon May 29 18:03:30 2017 +0200
@@ -376,7 +376,7 @@
     {
       NotifySliceImageError(operation);
       return;
-    }          
+    }
 
     bool isSigned = false;
     bool isStretched = info["Stretched"].asBool();
@@ -385,7 +385,8 @@
     {
       if (info["IsSigned"].type() != Json::booleanValue)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
+        NotifySliceImageError(operation);
+        return;
       }          
       else
       {
@@ -397,6 +398,7 @@
     Orthanc::Toolbox::DecodeBase64(jpeg, info["PixelData"].asString());
 
     std::auto_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader);
+
     try
     {
       reader->ReadFromMemory(jpeg);
@@ -482,6 +484,8 @@
     float offset = static_cast<float>(stretchLow) / scaling;
       
     Orthanc::ImageProcessing::Convert(*image, *reader);
+    reader.reset(NULL);
+    
     Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling);
 
     NotifySliceImageSuccess(operation, image.release());
@@ -625,7 +629,7 @@
     
     // This requires the official Web viewer plugin to be installed!
     const Slice& slice = GetSlice(index);
-    std::string uri = ("web-viewer/instances/jpeg" + 
+    std::string uri = ("/web-viewer/instances/jpeg" + 
                        boost::lexical_cast<std::string>(value) + 
                        "-" + slice.GetOrthancInstanceId() + "_" + 
                        boost::lexical_cast<std::string>(slice.GetFrame()));