changeset 2075:d84bdcbd8bf1

allow negative values in Grid Frame Offset Vector (3004, 000c)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jul 2023 13:20:20 +0200
parents e160c324c32a
children 990f396484b1
files OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Mon Jul 10 22:06:49 2023 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Tue Jul 11 13:20:20 2023 +0200
@@ -149,7 +149,7 @@
       {
         if (frameOffsets_.size() >= 2)
         {
-          double sliceThickness = frameOffsets_[1] - frameOffsets_[0];
+          double sliceThickness = std::abs(frameOffsets_[1] - frameOffsets_[0]);
           
           if (sliceThickness > 0)
           {
@@ -157,7 +157,7 @@
             
             for (size_t i = 2; i < frameOffsets_.size(); ++i)
             {
-              double currentThickness = frameOffsets_[i] - frameOffsets_[i-1];
+              double currentThickness = std::abs(frameOffsets_[i] - frameOffsets_[i-1]);
               if (!LinearAlgebra::IsNear(sliceThickness, currentThickness))
               {
                 LOG(ERROR) << "Unable to extract slice thickness from GridFrameOffsetVector (3004,000C) (reason: varying spacing)";
@@ -734,7 +734,7 @@
 
       for (size_t i = 1; i + 1 < data_.frameOffsets_.size(); i++)
       {
-        double s = data_.frameOffsets_[i + 1] - data_.frameOffsets_[i];
+        double s = std::abs(data_.frameOffsets_[i + 1] - data_.frameOffsets_[i]);
         if (!LinearAlgebra::IsNear(spacing, s, 0.001))
         {
           return false;