Mercurial > hg > orthanc
comparison Plugins/Samples/GdcmDecoder/Plugin.cpp @ 1837:fbc5522023aa
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Nov 2015 17:56:16 +0100 |
parents | b1a6f49b21dd |
children | 859224214616 |
comparison
equal
deleted
inserted
replaced
1836:2faa2abbf311 | 1837:fbc5522023aa |
---|---|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 **/ | 18 **/ |
19 | 19 |
20 | 20 |
21 #include "GdcmDecoderCache.h" | 21 #include "GdcmDecoderCache.h" |
22 #include "OrthancImageWrapper.h" | |
22 | 23 |
23 #include <orthanc/OrthancCPlugin.h> | 24 #include <orthanc/OrthancCPlugin.h> |
24 | 25 |
25 static OrthancPluginContext* context_ = NULL; | 26 static OrthancPluginContext* context_ = NULL; |
26 static OrthancPlugins::GdcmDecoderCache cache_; | 27 static OrthancPlugins::GdcmDecoderCache cache_; |
31 const uint32_t size, | 32 const uint32_t size, |
32 uint32_t frameIndex) | 33 uint32_t frameIndex) |
33 { | 34 { |
34 try | 35 try |
35 { | 36 { |
37 std::auto_ptr<OrthancPlugins::OrthancImageWrapper> image; | |
38 | |
36 #if 0 | 39 #if 0 |
37 // Do not use the cache | 40 // Do not use the cache |
38 OrthancPlugins::GdcmImageDecoder decoder(dicom, size); | 41 OrthancPlugins::GdcmImageDecoder decoder(dicom, size); |
39 *target = decoder.Decode(context_, frameIndex); | 42 image.reset(new OrthancPlugins::OrthancImageWrapper(context_, decoder, frameIndex)); |
40 #else | 43 #else |
41 *target = cache_.Decode(context_, dicom, size, frameIndex); | 44 image.reset(cache_.Decode(context_, dicom, size, frameIndex)); |
42 #endif | 45 #endif |
46 | |
47 *target = image->Release(); | |
43 | 48 |
44 return OrthancPluginErrorCode_Success; | 49 return OrthancPluginErrorCode_Success; |
45 } | 50 } |
46 catch (std::runtime_error& e) | 51 catch (std::runtime_error& e) |
47 { | 52 { |