Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/SlicesSorter.cpp @ 1015:24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Sep 2019 11:16:25 +0200 |
parents | a7351ad54960 |
children | 34ee7204fde3 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
1014:86a18d201e27 | 1015:24fecc02bfb1 |
---|---|
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 return spacingZ; | 327 return spacingZ; |
328 } | 328 } |
329 | |
330 | |
331 bool SlicesSorter::AreAllSlicesDistinct() const | |
332 { | |
333 if (GetSlicesCount() <= 1) | |
334 { | |
335 return true; | |
336 } | |
337 else | |
338 { | |
339 const OrthancStone::CoordinateSystem3D& reference = GetSliceGeometry(0); | |
340 double previousPosition = reference.ProjectAlongNormal(GetSliceGeometry(0).GetOrigin()); | |
341 | |
342 for (size_t i = 1; i < GetSlicesCount(); i++) | |
343 { | |
344 double position = reference.ProjectAlongNormal(GetSliceGeometry(i).GetOrigin()); | |
345 | |
346 if (OrthancStone::LinearAlgebra::IsNear(position, previousPosition, 0.001 /* tolerance expressed in mm */)) | |
347 { | |
348 return false; | |
349 } | |
350 | |
351 previousPosition = position; | |
352 } | |
353 | |
354 return true; | |
355 } | |
356 } | |
329 } | 357 } |