comparison Framework/Volumes/ImageBuffer3D.cpp @ 187:a12ca0f4aaaa wasm

ImageBuffer3D::GetCoordinates
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Mar 2018 17:45:48 +0100
parents a053ca7fa5c6
children 371da7fe2c0e
comparison
equal deleted inserted replaced
186:fac46066b933 187:a12ca0f4aaaa
460 } 460 }
461 461
462 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); 462 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z));
463 return reinterpret_cast<const uint16_t*>(p) [x]; 463 return reinterpret_cast<const uint16_t*>(p) [x];
464 } 464 }
465
466
467 Vector ImageBuffer3D::GetCoordinates(float x,
468 float y,
469 float z) const
470 {
471 Vector ps = GetVoxelDimensions(OrthancStone::VolumeProjection_Axial);
472
473 const CoordinateSystem3D& axial = GetAxialGeometry();
474
475 Vector origin = (axial.MapSliceToWorldCoordinates(-0.5 * ps[0], -0.5 * ps[1]) -
476 0.5 * ps[2] * axial.GetNormal());
477
478 return (origin +
479 axial.GetAxisX() * ps[0] * x * static_cast<double>(GetWidth()) +
480 axial.GetAxisY() * ps[1] * y * static_cast<double>(GetHeight()) +
481 axial.GetNormal() * ps[2] * z * static_cast<double>(GetDepth()));
482 }
465 } 483 }