Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
1774:95ece40bb298 | 1775:fca942f4b4a7 |
---|---|
85 const double y2 = reslicer.GetOutputExtent().GetY2(); | 85 const double y2 = reslicer.GetOutputExtent().GetY2(); |
86 | 86 |
87 const Vector p1 = cuttingPlane.MapSliceToWorldCoordinates(x1, y1); | 87 const Vector p1 = cuttingPlane.MapSliceToWorldCoordinates(x1, y1); |
88 const Vector p2 = cuttingPlane.MapSliceToWorldCoordinates(x1, y2); | 88 const Vector p2 = cuttingPlane.MapSliceToWorldCoordinates(x1, y2); |
89 | 89 |
90 // The "0.5" shift is to move from the corner of voxel to the center of the voxel | |
91 | |
90 if (1) | 92 if (1) |
91 { | 93 { |
92 texture->SetCuttingPlaneTransform(cuttingPlane, p1, | 94 texture->SetCuttingPlaneTransform( |
93 s * cuttingPlane.GetAxisX(), | 95 cuttingPlane, p1 + 0.5 * s * cuttingPlane.GetAxisX() + 0.5 * s * cuttingPlane.GetAxisY(), |
94 s * cuttingPlane.GetAxisY()); | 96 s * cuttingPlane.GetAxisX(), |
97 s * cuttingPlane.GetAxisY()); | |
95 } | 98 } |
96 else | 99 else |
97 { | 100 { |
98 /** | 101 /** |
99 * TODO - ONE WAS TO SOMETIMES FLIP the Y axis. Is it also | 102 * TODO - ONE WAS TO SOMETIMES FLIP the Y axis. Is it also |
100 * possible for the X axis? | 103 * possible for the X axis? |
101 **/ | 104 **/ |
102 | 105 |
103 texture->SetCuttingPlaneTransform(cuttingPlane, p2, | 106 texture->SetCuttingPlaneTransform( |
104 s * cuttingPlane.GetAxisX(), | 107 cuttingPlane, p2 + 0.5 * s * cuttingPlane.GetAxisX() + 0.5 * s * cuttingPlane.GetAxisY(), |
105 -s * cuttingPlane.GetAxisY()); | 108 s * cuttingPlane.GetAxisX(), |
109 -s * cuttingPlane.GetAxisY()); | |
106 } | 110 } |
107 | 111 |
108 #else | 112 #else |
109 texture->SetPixelSpacing(s, s); | 113 texture->SetPixelSpacing(s, s); |
110 texture->SetOrigin(reslicer.GetOutputExtent().GetX1() + 0.5 * s, | 114 texture->SetOrigin(reslicer.GetOutputExtent().GetX1() + 0.5 * s, |