comparison Framework/Volumes/ImageBuffer3D.cpp @ 143:58c545177c1c wasm

optimization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jan 2018 15:16:19 +0100
parents 88bca952cb17
children a053ca7fa5c6
comparison
equal deleted inserted replaced
142:f19194a11c1d 143:58c545177c1c
420 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 420 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
421 } 421 }
422 } 422 }
423 423
424 424
425 uint8_t ImageBuffer3D::GetPixelGrayscale8(unsigned int x, 425 uint8_t ImageBuffer3D::GetVoxelGrayscale8(unsigned int x,
426 unsigned int y, 426 unsigned int y,
427 unsigned int z) const 427 unsigned int z) const
428 { 428 {
429 if (format_ != Orthanc::PixelFormat_Grayscale8) 429 if (format_ != Orthanc::PixelFormat_Grayscale8)
430 { 430 {
437 { 437 {
438 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 438 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
439 } 439 }
440 440
441 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); 441 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z));
442
443 return reinterpret_cast<const uint8_t*>(p) [x]; 442 return reinterpret_cast<const uint8_t*>(p) [x];
444 } 443 }
445 444
446 445
447 uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, 446 uint16_t ImageBuffer3D::GetVoxelGrayscale16(unsigned int x,
448 unsigned int y, 447 unsigned int y,
449 unsigned int z) const 448 unsigned int z) const
450 { 449 {
451 if (format_ != Orthanc::PixelFormat_Grayscale16) 450 if (format_ != Orthanc::PixelFormat_Grayscale16)
452 { 451 {
459 { 458 {
460 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 459 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
461 } 460 }
462 461
463 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); 462 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z));
464
465 return reinterpret_cast<const uint16_t*>(p) [x]; 463 return reinterpret_cast<const uint16_t*>(p) [x];
466 } 464 }
467 } 465 }