Mercurial > hg > orthanc-stone
diff Framework/Toolbox/OrthancSlicesLoader.cpp @ 99:efd9ef2b67f1 wasm
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 May 2017 21:08:31 +0200 |
parents | d18dcc963930 |
children | 166a555becbf |
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp Tue May 30 15:02:24 2017 +0200 +++ b/Framework/Toolbox/OrthancSlicesLoader.cpp Tue May 30 21:08:31 2017 +0200 @@ -197,9 +197,9 @@ void OrthancSlicesLoader::NotifySliceImageSuccess(const Operation& operation, - Orthanc::ImageAccessor* image) const + std::auto_ptr<Orthanc::ImageAccessor>& image) const { - if (image == NULL) + if (image.get() == NULL) { throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); } @@ -313,13 +313,12 @@ const void* answer, size_t size) { - std::auto_ptr<Orthanc::PngReader> image(new Orthanc::PngReader); + std::auto_ptr<Orthanc::ImageAccessor> image; - bool ok = false; - try { - image->ReadFromMemory(answer, size); + image.reset(new Orthanc::PngReader); + dynamic_cast<Orthanc::PngReader&>(*image).ReadFromMemory(answer, size); } catch (Orthanc::OrthancException&) { @@ -348,7 +347,7 @@ } } - NotifySliceImageSuccess(operation, image.release()); + NotifySliceImageSuccess(operation, image); } @@ -398,11 +397,12 @@ std::string jpeg; Orthanc::Toolbox::DecodeBase64(jpeg, info["PixelData"].asString()); - std::auto_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader); + std::auto_ptr<Orthanc::ImageAccessor> reader; try { - reader->ReadFromMemory(jpeg); + reader.reset(new Orthanc::JpegReader); + dynamic_cast<Orthanc::JpegReader&>(*reader).ReadFromMemory(jpeg); } catch (Orthanc::OrthancException&) { @@ -428,7 +428,7 @@ } else { - NotifySliceImageSuccess(operation, reader.release()); + NotifySliceImageSuccess(operation, reader); return; } } @@ -448,7 +448,7 @@ } else { - NotifySliceImageSuccess(operation, reader.release()); + NotifySliceImageSuccess(operation, reader); return; } } @@ -489,7 +489,7 @@ Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling); - NotifySliceImageSuccess(operation, image.release()); + NotifySliceImageSuccess(operation, image); }