comparison Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp @ 1840:859224214616

simplification of the sample plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2015 10:34:04 +0100
parents fbc5522023aa
children b1291df2f780
comparison
equal deleted inserted replaced
1839:7f68b04c79e8 1840:859224214616
75 if (decoder_.get() != NULL && 75 if (decoder_.get() != NULL &&
76 size_ == size && 76 size_ == size &&
77 md5_ == md5) 77 md5_ == md5)
78 { 78 {
79 // This is the same image: Reuse the previous decoding 79 // This is the same image: Reuse the previous decoding
80 return new OrthancImageWrapper(context, *decoder_, frameIndex); 80 return new OrthancImageWrapper(context, decoder_->Decode(context, frameIndex));
81 } 81 }
82 } 82 }
83 83
84 // This is not the same image 84 // This is not the same image
85 std::auto_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size)); 85 std::auto_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size));
86 std::auto_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, *decoder, frameIndex)); 86 std::auto_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, decoder->Decode(context, frameIndex)));
87 87
88 { 88 {
89 // Cache the newly created decoder for further use 89 // Cache the newly created decoder for further use
90 boost::mutex::scoped_lock lock(mutex_); 90 boost::mutex::scoped_lock lock(mutex_);
91 decoder_ = decoder; 91 decoder_ = decoder;