Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/Framework/Volumes/ImageBuffer3D.cpp Thu Mar 15 16:11:45 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.cpp Thu Mar 15 17:45:48 2018 +0100 @@ -462,4 +462,22 @@ const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); return reinterpret_cast<const uint16_t*>(p) [x]; } + + + Vector ImageBuffer3D::GetCoordinates(float x, + float y, + float z) const + { + Vector ps = GetVoxelDimensions(OrthancStone::VolumeProjection_Axial); + + const CoordinateSystem3D& axial = GetAxialGeometry(); + + Vector origin = (axial.MapSliceToWorldCoordinates(-0.5 * ps[0], -0.5 * ps[1]) - + 0.5 * ps[2] * axial.GetNormal()); + + return (origin + + axial.GetAxisX() * ps[0] * x * static_cast<double>(GetWidth()) + + axial.GetAxisY() * ps[1] * y * static_cast<double>(GetHeight()) + + axial.GetNormal() * ps[2] * z * static_cast<double>(GetDepth())); + } }