Mercurial > hg > orthanc
comparison PalantirServer/FromDcmtkBridge.cpp @ 2:67a6978503b7
fixing Windows build
author | Jodogne@Laptop |
---|---|
date | Thu, 19 Jul 2012 22:33:27 +0200 |
parents | 3959d33612cc |
children | f6d12037f886 |
comparison
equal
deleted
inserted
replaced
0:3959d33612cc | 2:67a6978503b7 |
---|---|
41 #include <dcmtk/dcmdata/dcvrsl.h> | 41 #include <dcmtk/dcmdata/dcvrsl.h> |
42 #include <dcmtk/dcmdata/dcvrss.h> | 42 #include <dcmtk/dcmdata/dcvrss.h> |
43 #include <dcmtk/dcmdata/dcvrul.h> | 43 #include <dcmtk/dcmdata/dcvrul.h> |
44 #include <dcmtk/dcmdata/dcvrus.h> | 44 #include <dcmtk/dcmdata/dcvrus.h> |
45 | 45 |
46 #include <boost/math/special_functions/round.hpp> | |
46 | 47 |
47 namespace Palantir | 48 namespace Palantir |
48 { | 49 { |
49 void FromDcmtkBridge::Convert(DicomMap& target, DcmDataset& dataset) | 50 void FromDcmtkBridge::Convert(DicomMap& target, DcmDataset& dataset) |
50 { | 51 { |
85 std::string utf8; | 86 std::string utf8; |
86 try | 87 try |
87 { | 88 { |
88 utf8 = boost::locale::conv::to_utf<char>(s, "ISO-8859-1"); // TODO Parameter? | 89 utf8 = boost::locale::conv::to_utf<char>(s, "ISO-8859-1"); // TODO Parameter? |
89 } | 90 } |
90 catch (std::runtime_error& e) | 91 catch (std::runtime_error&) |
91 { | 92 { |
92 // Bad input string or bad encoding | 93 // Bad input string or bad encoding |
93 utf8 = s; | 94 utf8 = s; |
94 } | 95 } |
95 | 96 |
405 for (unsigned int y = 0; y < accessor->GetHeight(); y++) | 406 for (unsigned int y = 0; y < accessor->GetHeight(); y++) |
406 { | 407 { |
407 for (unsigned int x = 0; x < accessor->GetWidth(); x++, result++) | 408 for (unsigned int x = 0; x < accessor->GetWidth(); x++, result++) |
408 { | 409 { |
409 int32_t v = accessor->GetValue(x, y); | 410 int32_t v = accessor->GetValue(x, y); |
410 *result = lround(static_cast<float>(v - min) / static_cast<float>(max - min) * 255.0f); | 411 *result = static_cast<uint8_t>(boost::math::lround(static_cast<float>(v - min) / static_cast<float>(max - min) * 255.0f)); |
411 } | 412 } |
412 } | 413 } |
413 } | 414 } |
414 | 415 |
415 w.WriteToMemory(result, accessor->GetWidth(), accessor->GetHeight(), | 416 w.WriteToMemory(result, accessor->GetWidth(), accessor->GetHeight(), |