changeset 4:c34ecc350b32

upgraded the node docker image
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Jun 2023 22:21:46 +0200
parents fdb8c6c420d0
children 8c1fe0ca24f5
files Resources/CreateOHIFDist/Dockerfile Resources/CreateOHIFDist/build.sh Sources/Plugin.cpp
diffstat 3 files changed, 61 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CreateOHIFDist/Dockerfile	Thu Jun 15 21:18:34 2023 +0200
+++ b/Resources/CreateOHIFDist/Dockerfile	Thu Jun 15 22:21:46 2023 +0200
@@ -17,7 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-FROM node:19.7.0-bullseye-slim
+FROM node:20.3.0-bullseye-slim
 
 MAINTAINER Sebastien Jodogne <s.jodogne@gmail.com>
 LABEL Description="Orthanc, free DICOM server" Vendor="The Orthanc project"
--- a/Resources/CreateOHIFDist/build.sh	Thu Jun 15 21:18:34 2023 +0200
+++ b/Resources/CreateOHIFDist/build.sh	Thu Jun 15 22:21:46 2023 +0200
@@ -30,7 +30,7 @@
 tar xvf /source/$1.tar.gz
 
 cd /tmp/$1
-yarn install --frozen-lockfile
-QUICK_BUILD=true PUBLIC_URL=./ yarn run build
+HOME=/tmp yarn install --frozen-lockfile
+HOME=/tmp QUICK_BUILD=true PUBLIC_URL=./ yarn run build
 
 cp -r /tmp/$1/platform/app/dist/* /target
--- a/Sources/Plugin.cpp	Thu Jun 15 21:18:34 2023 +0200
+++ b/Sources/Plugin.cpp	Thu Jun 15 22:21:46 2023 +0200
@@ -26,8 +26,10 @@
 
 #include <DicomFormat/DicomMap.h>
 #include <Logging.h>
+#include <SerializationToolbox.h>
 #include <SystemToolbox.h>
 #include <Toolbox.h>
+#include <Compression/GzipCompressor.h>
 
 #include <EmbeddedResources.h>
 
@@ -261,16 +263,55 @@
               break;
 
             case DataType_Integer:
-              target[tag] = boost::lexical_cast<int>(value.asString());
+            {
+              int32_t v;
+              if (Orthanc::SerializationToolbox::ParseInteger32(v, value.asString()))
+              {
+                target[tag] = v;
+              }
               break;
+            }
 
             case DataType_Float:
-              target[tag] = boost::lexical_cast<float>(value.asString());
+            {
+              float v;
+              if (Orthanc::SerializationToolbox::ParseFloat(v, value.asString()))
+              {
+                target[tag] = v;
+              }
               break;
+            }
+
+            case DataType_ListOfStrings:
+            {
+              std::vector<std::string> tokens;
+              Orthanc::Toolbox::TokenizeString(tokens, value.asString(), '\\');
+              target[tag] = Json::arrayValue;
+              for (size_t i = 0; i < tokens.size(); i++)
+              {
+                target[tag].append(tokens[i]);
+              }
+              break;
+            }
+
+            case DataType_ListOfFloats:
+            {
+              std::vector<std::string> tokens;
+              Orthanc::Toolbox::TokenizeString(tokens, value.asString(), '\\');
+              target[tag] = Json::arrayValue;
+              for (size_t i = 0; i < tokens.size(); i++)
+              {
+                float v;
+                if (Orthanc::SerializationToolbox::ParseFloat(v, tokens[i]))
+                {
+                  target[tag].append(v);
+                }
+              }
+              break;
+            }
 
             default:
-              // TODO
-              break;
+              throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
           }
         }
 
@@ -280,9 +321,6 @@
       }
     }
   }
-  
-  //Orthanc::DicomMap m;
-  
 }
 
 
@@ -338,8 +376,20 @@
     {
       /*{
         Json::Value v;
-        GetOhifDicomTags(v, "4368e7c1-33f7303d-5fc9fcc6-6e5fde31-6959b209");
+        GetOhifDicomTags(v, "54bfd747-407e46b1-ef106fdd-dc19e482-ff8dbe02");
         std::cout << v.toStyledString();
+        std::string s;
+        Orthanc::Toolbox::WriteFastJson(s, v);
+        std::cout << s.size() << std::endl;
+
+        Orthanc::GzipCompressor c;
+        std::string ss;
+        Orthanc::IBufferCompressor::Compress(ss, c, s);
+        std::cout << ss.size() << std::endl;
+
+        std::string sss;
+        Orthanc::Toolbox::EncodeBase64(sss, ss);
+        std::cout << sss.size() << std::endl;
         }*/
       
       Json::Value info;