changeset 3196:763738c1f9f6

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Feb 2019 20:55:27 +0100
parents 880e4161c312
children 24a76ed0d8a3
files UnitTestsSources/DicomMapTests.cpp
diffstat 1 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/UnitTestsSources/DicomMapTests.cpp	Tue Feb 05 20:44:26 2019 +0100
+++ b/UnitTestsSources/DicomMapTests.cpp	Tue Feb 05 20:55:27 2019 +0100
@@ -799,7 +799,13 @@
 
         if (!values.empty())
         {
-          // TODO
+          Json::Value content = Json::arrayValue;
+          for (size_t i = 0; i < values.size(); i++)
+          {
+            content.append(FormatTag(values[i]));
+          }
+          
+          node[KEY_VALUE] = content;
         }
       }
     }
@@ -858,13 +864,20 @@
                 {
                   size_t l = tokens[i].size();
 
-                  if (l > 0 &&
-                      tokens[i][l - 1] == '\0')
+                  if (l == 0)
+                  {
+                    node[KEY_VALUE].append(Json::nullValue);
+                  }
+                  else
                   {
-                    tokens[i] = tokens[i].substr(0, l - 1);
+                    if (tokens[i][l - 1] == '\0')
+                    {
+                      tokens[i] = tokens[i].substr(0, l - 1);
+                    }
+
+                    node[KEY_VALUE].append(tokens[i]);
                   }
-
-                  node[KEY_VALUE].append(tokens[i]);
+                  
                   break;
                 }
               }
@@ -891,6 +904,7 @@
 HierarchicalAnonymization/StructuredReports/IM0
 DummyCT.dcm
 Brainix/Epi/IM-0001-0018.dcm
+Issue22.dcm
 
 
 cat << EOF > /tmp/tutu.py
@@ -900,7 +914,7 @@
 print(json.dumps(j, indent=4, sort_keys=True, ensure_ascii=False).encode('utf-8'))
 EOF
 
-DCMDICTPATH=/home/jodogne/Downloads/dcmtk-3.6.4/dcmdata/data/dicom.dic /home/jodogne/Downloads/dcmtk-3.6.4/i/bin/dcm2json ~/Subversion/orthanc-tests/Database/HierarchicalAnonymization/StructuredReports/IM0 | tr -d '\0' | sed 's/\\u0000//g' | sed 's/\.0$//' | python /tmp/tutu.py > /tmp/a.json
+DCMDICTPATH=/home/jodogne/Downloads/dcmtk-3.6.4/dcmdata/data/dicom.dic /home/jodogne/Downloads/dcmtk-3.6.4/i/bin/dcm2json ~/Subversion/orthanc-tests/Database/Issue22.dcm | tr -d '\0' | sed 's/\\u0000//g' | sed 's/\.0$//' | python /tmp/tutu.py > /tmp/a.json
 
 make -j4 && ./UnitTests --gtest_filter=DicomWeb* && python /tmp/tutu.py < /tmp/tutu.json > /tmp/b.json && diff -i /tmp/a.json /tmp/b.json
 
@@ -909,7 +923,7 @@
 TEST(DicomWebJson, Basic)
 {
   std::string content;
-  Orthanc::SystemToolbox::ReadFile(content, "/home/jodogne/Subversion/orthanc-tests/Database/HierarchicalAnonymization/StructuredReports/IM0");
+  Orthanc::SystemToolbox::ReadFile(content, "/home/jodogne/Subversion/orthanc-tests/Database/Issue22.dcm");
 
   Orthanc::ParsedDicomFile dicom(content);