Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.cpp @ 1775:fca942f4b4a7
fix conversion from voxel centers to texture borders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 May 2021 19:57:50 +0200 |
parents | f302bbddf94d |
children | 748bfa7df18b |
line wrap: on
line diff
--- a/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.cpp Wed May 12 17:43:51 2021 +0200 +++ b/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.cpp Wed May 12 19:57:50 2021 +0200 @@ -87,11 +87,14 @@ const Vector p1 = cuttingPlane.MapSliceToWorldCoordinates(x1, y1); const Vector p2 = cuttingPlane.MapSliceToWorldCoordinates(x1, y2); + // The "0.5" shift is to move from the corner of voxel to the center of the voxel + if (1) { - texture->SetCuttingPlaneTransform(cuttingPlane, p1, - s * cuttingPlane.GetAxisX(), - s * cuttingPlane.GetAxisY()); + texture->SetCuttingPlaneTransform( + cuttingPlane, p1 + 0.5 * s * cuttingPlane.GetAxisX() + 0.5 * s * cuttingPlane.GetAxisY(), + s * cuttingPlane.GetAxisX(), + s * cuttingPlane.GetAxisY()); } else { @@ -100,9 +103,10 @@ * possible for the X axis? **/ - texture->SetCuttingPlaneTransform(cuttingPlane, p2, - s * cuttingPlane.GetAxisX(), - -s * cuttingPlane.GetAxisY()); + texture->SetCuttingPlaneTransform( + cuttingPlane, p2 + 0.5 * s * cuttingPlane.GetAxisX() + 0.5 * s * cuttingPlane.GetAxisY(), + s * cuttingPlane.GetAxisX(), + -s * cuttingPlane.GetAxisY()); } #else