Mercurial > hg > orthanc-webviewer
comparison Plugin/DecodedImageAdapter.cpp @ 287:ec1af1fdcaca
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 17:33:32 +0100 |
parents | 4e9d30c19b4b |
children | aadbffcee805 |
comparison
equal
deleted
inserted
replaced
286:adb5324ce1e8 | 287:ec1af1fdcaca |
---|---|
23 | 23 |
24 #include "ViewerToolbox.h" | 24 #include "ViewerToolbox.h" |
25 | 25 |
26 #include <Images/ImageBuffer.h> | 26 #include <Images/ImageBuffer.h> |
27 #include <Images/ImageProcessing.h> | 27 #include <Images/ImageProcessing.h> |
28 #include <Logging.h> | |
28 #include <OrthancException.h> | 29 #include <OrthancException.h> |
29 #include <Toolbox.h> | 30 #include <Toolbox.h> |
30 | 31 |
31 #include <boost/lexical_cast.hpp> | 32 #include <boost/lexical_cast.hpp> |
32 #include <boost/algorithm/string/predicate.hpp> | 33 #include <boost/algorithm/string/predicate.hpp> |
286 source.GetHeight() != target.GetHeight()) | 287 source.GetHeight() != target.GetHeight()) |
287 { | 288 { |
288 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize); | 289 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize); |
289 } | 290 } |
290 | 291 |
291 for (unsigned int y = 0; y < source.GetHeight(); y++) | 292 const unsigned int width = source.GetWidth(); |
293 const unsigned int height = source.GetHeight(); | |
294 | |
295 for (unsigned int y = 0; y < height; y++) | |
292 { | 296 { |
293 const uint16_t* p = reinterpret_cast<const uint16_t*>(source.GetConstRow(y)); | 297 const uint16_t* p = reinterpret_cast<const uint16_t*>(source.GetConstRow(y)); |
294 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); | 298 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); |
295 | 299 |
296 for (unsigned int x = 0; x < source.GetWidth(); x++) | 300 for (unsigned int x = 0; x < width; x++) |
297 { | 301 { |
298 q[0] = p[0] >> 8; | 302 q[0] = p[0] >> 8; |
299 q[1] = p[1] >> 8; | 303 q[1] = p[1] >> 8; |
300 q[2] = p[2] >> 8; | 304 q[2] = p[2] >> 8; |
301 p += 3; | 305 p += 3; |
385 float offset = static_cast<float>(target1) - scale * static_cast<float>(source1); | 389 float offset = static_cast<float>(target1) - scale * static_cast<float>(source1); |
386 | 390 |
387 const float minValue = static_cast<float>(std::numeric_limits<TargetType>::min()); | 391 const float minValue = static_cast<float>(std::numeric_limits<TargetType>::min()); |
388 const float maxValue = static_cast<float>(std::numeric_limits<TargetType>::max()); | 392 const float maxValue = static_cast<float>(std::numeric_limits<TargetType>::max()); |
389 | 393 |
390 for (unsigned int y = 0; y < source.GetHeight(); y++) | 394 const unsigned int width = source.GetWidth(); |
395 const unsigned int height = source.GetHeight(); | |
396 | |
397 for (unsigned int y = 0; y < height; y++) | |
391 { | 398 { |
392 const SourceType* p = reinterpret_cast<const SourceType*>(source.GetConstRow(y)); | 399 const SourceType* p = reinterpret_cast<const SourceType*>(source.GetConstRow(y)); |
393 TargetType* q = reinterpret_cast<TargetType*>(target.GetRow(y)); | 400 TargetType* q = reinterpret_cast<TargetType*>(target.GetRow(y)); |
394 | 401 |
395 for (unsigned int x = 0; x < source.GetWidth(); x++, p++, q++) | 402 for (unsigned int x = 0; x < width; x++, p++, q++) |
396 { | 403 { |
397 float v = (scale * static_cast<float>(*p)) + offset; | 404 float v = (scale * static_cast<float>(*p)) + offset; |
398 | 405 |
399 if (v > maxValue) | 406 if (v > maxValue) |
400 { | 407 { |