comparison Plugins/Samples/GdcmDecoder/OrthancImageWrapper.cpp @ 1836:2faa2abbf311

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2015 17:40:25 +0100
parents b1a6f49b21dd
children 859224214616
comparison
equal deleted inserted replaced
1835:323dd6402933 1836:2faa2abbf311
26 { 26 {
27 OrthancImageWrapper::OrthancImageWrapper(OrthancPluginContext* context, 27 OrthancImageWrapper::OrthancImageWrapper(OrthancPluginContext* context,
28 OrthancPluginPixelFormat format, 28 OrthancPluginPixelFormat format,
29 uint32_t width, 29 uint32_t width,
30 uint32_t height) : 30 uint32_t height) :
31 context_(context) 31 context_(context),
32 slope_(1),
33 intercept_(0),
34 rowPixelSpacing_(1),
35 columnPixelSpacing_(1)
32 { 36 {
33 image_ = OrthancPluginCreateImage(context_, format, width, height); 37 image_ = OrthancPluginCreateImage(context_, format, width, height);
34 if (image_ == NULL) 38 if (image_ == NULL)
35 { 39 {
36 throw std::runtime_error("Cannot create an image"); 40 throw std::runtime_error("Cannot create an image");
37 } 41 }
38 } 42 }
43
44
45 OrthancImageWrapper::OrthancImageWrapper(OrthancPluginContext* context,
46 GdcmImageDecoder& decoder,
47 unsigned int frameIndex) :
48 context_(context),
49 image_(decoder.Decode(context, frameIndex)),
50 slope_(decoder.GetSlope()),
51 intercept_(decoder.GetIntercept()),
52 rowPixelSpacing_(decoder.GetRowPixelSpacing()),
53 columnPixelSpacing_(decoder.GetColumnPixelSpacing())
54 {
55 }
56
39 57
40 58
41 OrthancImageWrapper::~OrthancImageWrapper() 59 OrthancImageWrapper::~OrthancImageWrapper()
42 { 60 {
43 if (image_ != NULL) 61 if (image_ != NULL)