changeset 2131:bb199bccdc45

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Nov 2016 10:49:45 +0100
parents 72cb107a7346
children a43708636890
files OrthancServer/DicomInstanceToStore.cpp OrthancServer/DicomProtocol/DicomUserConnection.cpp OrthancServer/FromDcmtkBridge.cpp OrthancServer/FromDcmtkBridge.h OrthancServer/Internals/DicomFrameIndex.cpp OrthancServer/Internals/DicomImageDecoder.cpp OrthancServer/Internals/FindScp.cpp OrthancServer/Internals/MoveScp.cpp OrthancServer/Internals/StoreScp.cpp OrthancServer/OrthancInitialization.cpp OrthancServer/OrthancInitialization.h OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/ParsedDicomFile.cpp
diffstat 13 files changed, 53 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/DicomInstanceToStore.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -104,15 +104,15 @@
     if (!summary_.HasContent())
     {
       summary_.Allocate();
-      FromDcmtkBridge::ExtractDicomSummary(summary_.GetContent(), 
-                                           *parsed_.GetContent().GetDcmtkObject().getDataset());
+      Configuration::ExtractDicomSummary(summary_.GetContent(), 
+                                         *parsed_.GetContent().GetDcmtkObject().getDataset());
     }
     
     if (!json_.HasContent())
     {
       json_.Allocate();
-      FromDcmtkBridge::ExtractDicomAsJson(json_.GetContent(), 
-                                          *parsed_.GetContent().GetDcmtkObject().getDataset());
+      Configuration::ExtractDicomAsJson(json_.GetContent(), 
+                                        *parsed_.GetContent().GetDcmtkObject().getDataset());
     }
   }
 
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -398,7 +398,7 @@
       else
       {
         DicomMap m;
-        FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers);
+        Configuration::ExtractDicomSummary(m, *responseIdentifiers);
 
         if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
         {
--- a/OrthancServer/FromDcmtkBridge.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -882,9 +882,10 @@
                                            DcmDataset& dataset,
                                            DicomToJsonFormat format,
                                            DicomToJsonFlags flags,
-                                           unsigned int maxStringLength)
+                                           unsigned int maxStringLength,
+                                           Encoding defaultEncoding)
   {
-    Encoding encoding = DetectEncoding(dataset, Configuration::GetDefaultEncoding());
+    Encoding encoding = DetectEncoding(dataset, defaultEncoding);
 
     target = Json::objectValue;
     DatasetToJson(target, dataset, format, flags, maxStringLength, encoding);
--- a/OrthancServer/FromDcmtkBridge.h	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.h	Tue Nov 08 10:49:45 2016 +0100
@@ -33,7 +33,6 @@
 #pragma once
 
 #include "ServerEnumerations.h"
-#include "OrthancInitialization.h"
 
 #include "../Core/DicomFormat/DicomElement.h"
 #include "../Core/DicomFormat/DicomMap.h"
@@ -58,6 +57,7 @@
 #endif
 
     friend class ParsedDicomFile;
+    friend class Configuration;
 
   private:
     FromDcmtkBridge();  // Pure static class
@@ -85,7 +85,8 @@
                                    DcmDataset& dataset,
                                    DicomToJsonFormat format,
                                    DicomToJsonFlags flags,
-                                   unsigned int maxStringLength);
+                                   unsigned int maxStringLength,
+                                   Encoding defaultEncoding);
 
   public:
     static void InitializeDictionary();
@@ -100,12 +101,6 @@
     static Encoding DetectEncoding(DcmItem& dataset,
                                    Encoding defaultEncoding);
 
-    static void ExtractDicomSummary(DicomMap& target, 
-                                    DcmItem& dataset)
-    {
-      ExtractDicomSummary(target, dataset, ORTHANC_MAXIMUM_TAG_LENGTH, Configuration::GetDefaultEncoding());
-    }
-
     static DicomTag Convert(const DcmTag& tag);
 
     static DicomTag GetTag(const DcmElement& element);
@@ -117,12 +112,6 @@
                                           unsigned int maxStringLength,
                                           Encoding encoding);
 
-    static void ExtractDicomAsJson(Json::Value& target, 
-                                   DcmDataset& dataset)
-    {
-      ExtractDicomAsJson(target, dataset, DicomToJsonFormat_Full, DicomToJsonFlags_Default, ORTHANC_MAXIMUM_TAG_LENGTH);
-    }
-
     static void ExtractHeaderAsJson(Json::Value& target, 
                                     DcmMetaInfo& header,
                                     DicomToJsonFormat format,
--- a/OrthancServer/Internals/DicomFrameIndex.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/Internals/DicomFrameIndex.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -404,7 +404,7 @@
 
     // Extract information about the image structure
     DicomMap tags;
-    FromDcmtkBridge::ExtractDicomSummary(tags, dataset);
+    Configuration::ExtractDicomSummary(tags, dataset);
 
     DicomImageInformation information(tags);
 
--- a/OrthancServer/Internals/DicomImageDecoder.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/Internals/DicomImageDecoder.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -250,7 +250,7 @@
       // See also: http://support.dcmtk.org/wiki/dcmtk/howto/accessing-compressed-data
 
       DicomMap m;
-      FromDcmtkBridge::ExtractDicomSummary(m, dataset);
+      Configuration::ExtractDicomSummary(m, dataset);
 
       /**
        * Create an accessor to the raw values of the DICOM image.
@@ -322,7 +322,7 @@
                                                 bool ignorePhotometricInterpretation)
   {
     DicomMap m;
-    FromDcmtkBridge::ExtractDicomSummary(m, dataset);
+    Configuration::ExtractDicomSummary(m, dataset);
 
     DicomImageInformation info(m);
     PixelFormat format;
--- a/OrthancServer/Internals/FindScp.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/Internals/FindScp.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -179,7 +179,7 @@
               }
 
               DicomMap input;
-              FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
+              Configuration::ExtractDicomSummary(input, *requestIdentifiers);
 
               data.findHandler_->Handle(data.answers_, input, sequencesToReturn,
                                         *data.remoteIp_, *data.remoteAet_,
--- a/OrthancServer/Internals/MoveScp.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/Internals/MoveScp.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -130,7 +130,7 @@
       if (data.lastRequest_ == NULL)
       {
         DicomMap input;
-        FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
+        Configuration::ExtractDicomSummary(input, *requestIdentifiers);
 
         try
         {
--- a/OrthancServer/Internals/StoreScp.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/Internals/StoreScp.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -168,8 +168,8 @@
 
           try
           {
-            FromDcmtkBridge::ExtractDicomSummary(summary, **imageDataSet);
-            FromDcmtkBridge::ExtractDicomAsJson(dicomJson, **imageDataSet);
+            Configuration::ExtractDicomSummary(summary, **imageDataSet);
+            Configuration::ExtractDicomAsJson(dicomJson, **imageDataSet);
 
             if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer, **imageDataSet))
             {
--- a/OrthancServer/OrthancInitialization.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/OrthancInitialization.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -1125,4 +1125,21 @@
 
     return a != b;
   }
+
+
+  void Configuration::ExtractDicomSummary(DicomMap& target, 
+                                          DcmItem& dataset)
+  {
+    FromDcmtkBridge::ExtractDicomSummary(target, dataset, 
+                                         ORTHANC_MAXIMUM_TAG_LENGTH, GetDefaultEncoding());
+  }
+
+  
+  void Configuration::ExtractDicomAsJson(Json::Value& target, 
+                                         DcmDataset& dataset)
+  {
+    FromDcmtkBridge::ExtractDicomAsJson(target, dataset, 
+                                        DicomToJsonFormat_Full, DicomToJsonFlags_Default, 
+                                        ORTHANC_MAXIMUM_TAG_LENGTH, GetDefaultEncoding());
+  }
 }
--- a/OrthancServer/OrthancInitialization.h	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/OrthancInitialization.h	Tue Nov 08 10:49:45 2016 +0100
@@ -46,6 +46,9 @@
 #include "IDatabaseWrapper.h"
 #include "ServerEnumerations.h"
 
+class DcmDataset;
+class DcmItem;
+
 namespace Orthanc
 {
   void OrthancInitialize(const char* configurationFile = NULL);
@@ -127,5 +130,12 @@
     static Encoding GetDefaultEncoding();
 
     static bool HasConfigurationChanged();
+
+
+    static void ExtractDicomSummary(DicomMap& target, 
+                                    DcmItem& dataset);
+
+    static void ExtractDicomAsJson(Json::Value& target, 
+                                   DcmDataset& dataset);
   };
 }
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -33,14 +33,15 @@
 #include "../PrecompiledHeadersServer.h"
 #include "OrthancRestApi.h"
 
+#include "../../Core/HttpServer/HttpContentNegociation.h"
 #include "../../Core/Logging.h"
-#include "../../Core/HttpServer/HttpContentNegociation.h"
-#include "../ServerToolbox.h"
 #include "../FromDcmtkBridge.h"
+#include "../Internals/DicomImageDecoder.h"
+#include "../OrthancInitialization.h"
+#include "../Search/LookupResource.h"
 #include "../ServerContext.h"
+#include "../ServerToolbox.h"
 #include "../SliceOrdering.h"
-#include "../Internals/DicomImageDecoder.h"
-#include "../Search/LookupResource.h"
 
 
 namespace Orthanc
--- a/OrthancServer/ParsedDicomFile.cpp	Tue Nov 08 10:06:16 2016 +0100
+++ b/OrthancServer/ParsedDicomFile.cpp	Tue Nov 08 10:49:45 2016 +0100
@@ -1152,13 +1152,13 @@
                                       unsigned int maxStringLength)
   {
     FromDcmtkBridge::ExtractDicomAsJson(target, *pimpl_->file_->getDataset(),
-                                        format, flags, maxStringLength);
+                                        format, flags, maxStringLength, Configuration::GetDefaultEncoding());
   }
 
 
   void ParsedDicomFile::DatasetToJson(Json::Value& target)
   {
-    FromDcmtkBridge::ExtractDicomAsJson(target, *pimpl_->file_->getDataset());
+    Configuration::ExtractDicomAsJson(target, *pimpl_->file_->getDataset());
   }
 
 
@@ -1263,7 +1263,7 @@
 
   void ParsedDicomFile::Convert(DicomMap& tags)
   {
-    FromDcmtkBridge::ExtractDicomSummary(tags, *pimpl_->file_->getDataset());
+    Configuration::ExtractDicomSummary(tags, *pimpl_->file_->getDataset());
   }