comparison OrthancStone/Sources/Toolbox/SlicesSorter.cpp @ 1640:52b8b96cb55f

cleaning namespaces
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Nov 2020 16:55:22 +0100
parents 59f95b9ea858
children 9ac2a65d4172
comparison
equal deleted inserted replaced
1639:5cdc5b98f14d 1640:52b8b96cb55f
299 // slice: Choose a dummy z-dimension for voxels 299 // slice: Choose a dummy z-dimension for voxels
300 spacing = 1.0; 300 spacing = 1.0;
301 return true; 301 return true;
302 } 302 }
303 303
304 const OrthancStone::CoordinateSystem3D& reference = GetSliceGeometry(0); 304 const CoordinateSystem3D& reference = GetSliceGeometry(0);
305 305
306 double referencePosition = reference.ProjectAlongNormal(reference.GetOrigin()); 306 double referencePosition = reference.ProjectAlongNormal(reference.GetOrigin());
307 307
308 double p = reference.ProjectAlongNormal(GetSliceGeometry(1).GetOrigin()); 308 double p = reference.ProjectAlongNormal(GetSliceGeometry(1).GetOrigin());
309 spacing = p - referencePosition; 309 spacing = p - referencePosition;
315 "Please call the Sort() method before"); 315 "Please call the Sort() method before");
316 } 316 }
317 317
318 for (size_t i = 1; i < GetSlicesCount(); i++) 318 for (size_t i = 1; i < GetSlicesCount(); i++)
319 { 319 {
320 OrthancStone::Vector q = reference.GetOrigin() + spacing * static_cast<double>(i) * reference.GetNormal(); 320 Vector q = reference.GetOrigin() + spacing * static_cast<double>(i) * reference.GetNormal();
321 double d = boost::numeric::ublas::norm_2(q - GetSliceGeometry(i).GetOrigin()); 321 double d = boost::numeric::ublas::norm_2(q - GetSliceGeometry(i).GetOrigin());
322 322
323 if (!OrthancStone::LinearAlgebra::IsNear(d, 0, 0.001 /* tolerance expressed in mm */)) 323 if (!LinearAlgebra::IsNear(d, 0, 0.001 /* tolerance expressed in mm */))
324 { 324 {
325 return false; 325 return false;
326 } 326 }
327 } 327 }
328 328
336 { 336 {
337 return true; 337 return true;
338 } 338 }
339 else 339 else
340 { 340 {
341 const OrthancStone::CoordinateSystem3D& reference = GetSliceGeometry(0); 341 const CoordinateSystem3D& reference = GetSliceGeometry(0);
342 double previousPosition = reference.ProjectAlongNormal(GetSliceGeometry(0).GetOrigin()); 342 double previousPosition = reference.ProjectAlongNormal(GetSliceGeometry(0).GetOrigin());
343 343
344 for (size_t i = 1; i < GetSlicesCount(); i++) 344 for (size_t i = 1; i < GetSlicesCount(); i++)
345 { 345 {
346 double position = reference.ProjectAlongNormal(GetSliceGeometry(i).GetOrigin()); 346 double position = reference.ProjectAlongNormal(GetSliceGeometry(i).GetOrigin());
347 347
348 if (OrthancStone::LinearAlgebra::IsNear(position, previousPosition, 0.001 /* tolerance expressed in mm */)) 348 if (LinearAlgebra::IsNear(position, previousPosition, 0.001 /* tolerance expressed in mm */))
349 { 349 {
350 return false; 350 return false;
351 } 351 }
352 352
353 previousPosition = position; 353 previousPosition = position;