Mercurial > hg > orthanc-stone
comparison Framework/Volumes/VolumeImageGeometry.cpp @ 1170:1644de437a7b broker
fixes related to swapped normal in sagittal geometry
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 Nov 2019 13:09:15 +0100 |
parents | 19b1c8caade4 |
children | 0ca50d275b9a |
comparison
equal
deleted
inserted
replaced
1167:ad4e21df4e40 | 1170:1644de437a7b |
---|---|
294 z *= static_cast<double>(projectionDepth); | 294 z *= static_cast<double>(projectionDepth); |
295 if (z < 0) | 295 if (z < 0) |
296 { | 296 { |
297 return false; | 297 return false; |
298 } | 298 } |
299 | |
300 unsigned int d = static_cast<unsigned int>(std::floor(z)); | |
301 if (d >= projectionDepth) | |
302 { | |
303 return false; | |
304 } | |
305 else | 299 else |
306 { | 300 { |
307 slice = d; | 301 unsigned int d = static_cast<unsigned int>(std::floor(z)); |
308 return true; | 302 if (d >= projectionDepth) |
303 { | |
304 return false; | |
305 } | |
306 else | |
307 { | |
308 slice = d; | |
309 return true; | |
310 } | |
309 } | 311 } |
310 } | 312 } |
311 | 313 |
312 | 314 |
313 CoordinateSystem3D VolumeImageGeometry::GetProjectionSlice(VolumeProjection projection, | 315 CoordinateSystem3D VolumeImageGeometry::GetProjectionSlice(VolumeProjection projection, |
319 } | 321 } |
320 | 322 |
321 Vector dim = GetVoxelDimensions(projection); | 323 Vector dim = GetVoxelDimensions(projection); |
322 CoordinateSystem3D plane = GetProjectionGeometry(projection); | 324 CoordinateSystem3D plane = GetProjectionGeometry(projection); |
323 | 325 |
324 plane.SetOrigin(plane.GetOrigin() + static_cast<double>(z) * plane.GetNormal() * dim[2]); | 326 Vector normal = plane.GetNormal(); |
327 if (projection == VolumeProjection_Sagittal) | |
328 { | |
329 /** | |
330 * WARNING: In sagittal geometry, the normal points to REDUCING | |
331 * X-axis in the 3D world. This is necessary to keep the | |
332 * right-hand coordinate system. Hence the negation. | |
333 **/ | |
334 normal = -normal; | |
335 } | |
336 | |
337 plane.SetOrigin(plane.GetOrigin() + static_cast<double>(z) * dim[2] * normal); | |
325 | 338 |
326 return plane; | 339 return plane; |
327 } | 340 } |
328 | 341 |
329 std::ostream& operator<<(std::ostream& s, const VolumeImageGeometry& v) | 342 std::ostream& operator<<(std::ostream& s, const VolumeImageGeometry& v) |