# HG changeset patch # User Sebastien Jodogne # Date 1521132348 -3600 # Node ID a12ca0f4aaaad159936e41dafc1a7b3d8a297d1a # Parent fac46066b933f2b59161cd841704eb0ad42a0936 ImageBuffer3D::GetCoordinates diff -r fac46066b933 -r a12ca0f4aaaa Framework/Volumes/ImageBuffer3D.cpp --- 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(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(GetWidth()) + + axial.GetAxisY() * ps[1] * y * static_cast(GetHeight()) + + axial.GetNormal() * ps[2] * z * static_cast(GetDepth())); + } } diff -r fac46066b933 -r a12ca0f4aaaa Framework/Volumes/ImageBuffer3D.h --- a/Framework/Volumes/ImageBuffer3D.h Thu Mar 15 16:11:45 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.h Thu Mar 15 17:45:48 2018 +0100 @@ -158,6 +158,12 @@ unsigned int y, unsigned int z) const; + // Get the 3D position of a point in the volume, where x, y and z + // lie in the [0;1] range + Vector GetCoordinates(float x, + float y, + float z) const; + class SliceReader : public boost::noncopyable { diff -r fac46066b933 -r a12ca0f4aaaa Framework/Volumes/VolumeReslicer.cpp --- a/Framework/Volumes/VolumeReslicer.cpp Thu Mar 15 16:11:45 2018 +0100 +++ b/Framework/Volumes/VolumeReslicer.cpp Thu Mar 15 17:45:48 2018 +0100 @@ -30,8 +30,6 @@ #include -#include - namespace OrthancStone { // Anonymous namespace to avoid clashes between compilation modules