Mercurial > hg > orthanc-stone
comparison Framework/Volumes/ImageBuffer3D.cpp @ 141:88bca952cb17 wasm
ImageBuffer3D::GetPixelGrayscale8
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Jan 2018 17:23:21 +0100 |
parents | 22628d37ef5c |
children | 58c545177c1c |
comparison
equal
deleted
inserted
replaced
140:2115530d3703 | 141:88bca952cb17 |
---|---|
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, | |
426 unsigned int y, | |
427 unsigned int z) const | |
428 { | |
429 if (format_ != Orthanc::PixelFormat_Grayscale8) | |
430 { | |
431 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
432 } | |
433 | |
434 if (x >= width_ || | |
435 y >= height_ || | |
436 z >= depth_) | |
437 { | |
438 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
439 } | |
440 | |
441 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); | |
442 | |
443 return reinterpret_cast<const uint8_t*>(p) [x]; | |
444 } | |
445 | |
446 | |
425 uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, | 447 uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, |
426 unsigned int y, | 448 unsigned int y, |
427 unsigned int z) const | 449 unsigned int z) const |
428 { | 450 { |
429 if (format_ != Orthanc::PixelFormat_Grayscale16) | 451 if (format_ != Orthanc::PixelFormat_Grayscale16) |
440 | 462 |
441 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); | 463 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); |
442 | 464 |
443 return reinterpret_cast<const uint16_t*>(p) [x]; | 465 return reinterpret_cast<const uint16_t*>(p) [x]; |
444 } | 466 } |
445 | |
446 } | 467 } |