Mercurial > hg > orthanc-webviewer
comparison Plugin/DecodedImageAdapter.cpp @ 103:d5396fcd80bb refactoring
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Nov 2015 12:04:23 +0100 |
parents | 21123729ac71 |
children | 3809121c3290 |
comparison
equal
deleted
inserted
replaced
102:21123729ac71 | 103:d5396fcd80bb |
---|---|
31 #include <boost/lexical_cast.hpp> | 31 #include <boost/lexical_cast.hpp> |
32 #include <boost/algorithm/string/predicate.hpp> | 32 #include <boost/algorithm/string/predicate.hpp> |
33 #include <json/writer.h> | 33 #include <json/writer.h> |
34 #include <boost/regex.hpp> | 34 #include <boost/regex.hpp> |
35 | 35 |
36 | |
36 namespace OrthancPlugins | 37 namespace OrthancPlugins |
37 { | 38 { |
38 bool DecodedImageAdapter::ParseUri(CompressionType& type, | 39 bool DecodedImageAdapter::ParseUri(CompressionType& type, |
39 uint8_t& compressionLevel, | 40 uint8_t& compressionLevel, |
40 std::string& instanceId, | 41 std::string& instanceId, |
166 std::string tmp; | 167 std::string tmp; |
167 if (GetStringTag(tmp, tags, tag)) | 168 if (GetStringTag(tmp, tags, tag)) |
168 { | 169 { |
169 try | 170 try |
170 { | 171 { |
171 return boost::lexical_cast<float>(tmp); | 172 return boost::lexical_cast<float>(Orthanc::Toolbox::StripSpaces(tmp)); |
172 } | 173 } |
173 catch (boost::bad_lexical_cast&) | 174 catch (boost::bad_lexical_cast&) |
174 { | 175 { |
175 } | 176 } |
176 } | 177 } |
229 default: | 230 default: |
230 return false; | 231 return false; |
231 } | 232 } |
232 | 233 |
233 float slope = GetFloatTag(tags, "0028,1053", 1.0f); | 234 float slope = GetFloatTag(tags, "0028,1053", 1.0f); |
234 float intercept = GetFloatTag(tags, "0028,1052", 1.0f); | 235 float intercept = GetFloatTag(tags, "0028,1052", 0.0f); |
235 | 236 |
236 result["slope"] = slope; | 237 result["slope"] = slope; |
237 result["intercept"] = intercept; | 238 result["intercept"] = intercept; |
238 result["rows"] = image.GetHeight(); | 239 result["rows"] = image.GetHeight(); |
239 result["columns"] = image.GetWidth(); | 240 result["columns"] = image.GetWidth(); |
249 | 250 |
250 if (tokens.size() >= 2) | 251 if (tokens.size() >= 2) |
251 { | 252 { |
252 try | 253 try |
253 { | 254 { |
254 result["columnPixelSpacing"] = boost::lexical_cast<float>(tokens[1]); | 255 result["columnPixelSpacing"] = boost::lexical_cast<float>(Orthanc::Toolbox::StripSpaces(tokens[1])); |
255 result["rowPixelSpacing"] = boost::lexical_cast<float>(tokens[0]); | 256 result["rowPixelSpacing"] = boost::lexical_cast<float>(Orthanc::Toolbox::StripSpaces(tokens[0])); |
256 ok = true; | 257 ok = true; |
257 } | 258 } |
258 catch (boost::bad_lexical_cast&) | 259 catch (boost::bad_lexical_cast&) |
259 { | 260 { |
260 } | 261 } |