diff Framework/Toolbox/Slice.cpp @ 174:a7674c0ae4ac wasm

fix captain rt-dose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Mar 2018 20:22:47 +0100
parents 0a73d76333db
children 7a031ac16b2d
line wrap: on
line diff
--- a/Framework/Toolbox/Slice.cpp	Thu Mar 08 17:58:55 2018 +0100
+++ b/Framework/Toolbox/Slice.cpp	Thu Mar 08 20:22:47 2018 +0100
@@ -51,27 +51,35 @@
   {
     // http://dicom.nema.org/medical/Dicom/2016a/output/chtml/part03/sect_C.8.8.3.2.html
 
-    std::string increment, offsetTag;
+    {
+      std::string increment;
 
-    if (!dataset.CopyToString(increment, Orthanc::DICOM_TAG_FRAME_INCREMENT_POINTER, false) ||
-        !dataset.CopyToString(offsetTag, Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, false))
+      if (dataset.CopyToString(increment, Orthanc::DICOM_TAG_FRAME_INCREMENT_POINTER, false))
+      {
+        Orthanc::Toolbox::ToUpperCase(increment);
+        if (increment != "3004,000C")  // This is the "Grid Frame Offset Vector" tag
+        {
+          LOG(ERROR) << "Bad value for the \"FrameIncrementPointer\" tag";
+          return false;
+        }
+      }
+    }
+
+    std::string offsetTag;
+
+    if (!dataset.CopyToString(offsetTag, Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, false) ||
+        offsetTag.empty())
     {
       LOG(ERROR) << "Cannot read the \"GridFrameOffsetVector\" tag, check you are using Orthanc >= 1.3.1";
       return false;
     }
 
-    Orthanc::Toolbox::ToUpperCase(increment);
-    if (increment != "3004,000C" ||
-        offsetTag.empty())
-    {
-      return false;
-    }
-
     std::vector<std::string> offsets;
     Orthanc::Toolbox::TokenizeString(offsets, offsetTag, '\\');
 
     if (frameCount_ <= 1 ||
-        offsets.size() != frameCount_ ||
+        offsets.size() < frameCount_ ||
+        offsets.size() < 2 ||
         frame >= frameCount_)
     {
       LOG(ERROR) << "No information about the 3D location of some slice(s) in a RT DOSE";