changeset 174:a7674c0ae4ac wasm

fix captain rt-dose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Mar 2018 20:22:47 +0100
parents 6b0411ac843a
children 15d92d93738b
files Applications/Samples/SingleVolumeApplication.h Framework/Enumerations.cpp Framework/Toolbox/Slice.cpp
diffstat 3 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/SingleVolumeApplication.h	Thu Mar 08 17:58:55 2018 +0100
+++ b/Applications/Samples/SingleVolumeApplication.h	Thu Mar 08 20:22:47 2018 +0100
@@ -213,7 +213,8 @@
         //pet->ScheduleLoadInstance("337876a1-a68a9718-f15abccd-38faafa1-b99b496a"); // IBA 2
         //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb");  // IBA 3
         //pet->ScheduleLoadInstance("269f26f4-0c83eeeb-2e67abbd-5467a40f-f1bec90c");  // 0522c0001 TCIA
-        pet->ScheduleLoadInstance("f080888c-0ab7528a-f7d9c28c-84980eb1-ff3b0ae6");  // Captain
+        pet->ScheduleLoadInstance("f080888c-0ab7528a-f7d9c28c-84980eb1-ff3b0ae6");  // Captain 1
+        //pet->ScheduleLoadInstance("4f78055b-6499a2c5-1e089290-394acc05-3ec781c1");  // Captain 2
 
         std::auto_ptr<StructureSetLoader> rtStruct(new StructureSetLoader(context.GetWebService()));
         //rtStruct->ScheduleLoadInstance("c2ebc17b-6b3548db-5e5da170-b8ecab71-ea03add3");  // 0178023P
--- a/Framework/Enumerations.cpp	Thu Mar 08 17:58:55 2018 +0100
+++ b/Framework/Enumerations.cpp	Thu Mar 08 20:22:47 2018 +0100
@@ -23,13 +23,16 @@
 
 #include <Core/Logging.h>
 #include <Core/OrthancException.h>
+#include <Core/Toolbox.h>
 
 namespace OrthancStone
 {  
   bool StringToSopClassUid(SopClassUid& result,
                            const std::string& source)
   {
-    if (source == "1.2.840.10008.5.1.4.1.1.481.2")
+    std::string s = Orthanc::Toolbox::StripSpaces(source);
+
+    if (s == "1.2.840.10008.5.1.4.1.1.481.2")
     {
       result = SopClassUid_RTDose;
       return true;
--- 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";