# HG changeset patch # User Sebastien Jodogne # Date 1496073810 -7200 # Node ID 7b14c12a3be5bfc89800db799f1961e4b2ef4f78 # Parent 5945e81734a3297379776e143887e28fa85209c3 fix diff -r 5945e81734a3 -r 7b14c12a3be5 Applications/Samples/SingleFrameApplication.h --- a/Applications/Samples/SingleFrameApplication.h Mon May 29 17:28:31 2017 +0200 +++ b/Applications/Samples/SingleFrameApplication.h Mon May 29 18:03:30 2017 +0200 @@ -174,7 +174,7 @@ std::auto_ptr widget(new LayerWidget); -#if 0 +#if 1 std::auto_ptr layer (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); layer->Register(*this); diff -r 5945e81734a3 -r 7b14c12a3be5 Framework/Layers/FrameRenderer.cpp --- a/Framework/Layers/FrameRenderer.cpp Mon May 29 17:28:31 2017 +0200 +++ b/Framework/Layers/FrameRenderer.cpp Mon May 29 18:03:30 2017 +0200 @@ -138,7 +138,7 @@ bool FrameRenderer::RenderLayer(CairoContext& context, const ViewportGeometry& view, const SliceGeometry& viewportSlice) - { + { if (!style_.visible_) { return true; diff -r 5945e81734a3 -r 7b14c12a3be5 Framework/Layers/LayerSourceBase.cpp --- a/Framework/Layers/LayerSourceBase.cpp Mon May 29 17:28:31 2017 +0200 +++ b/Framework/Layers/LayerSourceBase.cpp Mon May 29 18:03:30 2017 +0200 @@ -39,6 +39,10 @@ layer_(layer), slice_(slice) { + if (layer == NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); + } } void operator() (ILayerSource::IObserver& observer, @@ -72,11 +76,6 @@ void LayerSourceBase::NotifyLayerReady(ILayerRenderer* layer, const Slice& slice) { - if (layer == NULL) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); - } - LayerReadyFunctor functor(layer, slice); observers_.Notify(*this, functor); } diff -r 5945e81734a3 -r 7b14c12a3be5 Framework/Toolbox/OrthancSlicesLoader.cpp --- 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 reader(new Orthanc::JpegReader); + try { reader->ReadFromMemory(jpeg); @@ -482,6 +484,8 @@ float offset = static_cast(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(value) + "-" + slice.GetOrthancInstanceId() + "_" + boost::lexical_cast(slice.GetFrame()));