changeset 3118:8849677c2cbc

compatibility with dcmtk 3.6.4
author s.jodogne@gmail.com
date Sun, 13 Jan 2019 20:16:43 +0100
parents c8b75e207a82
children 8f2bda0719f4
files Core/DicomNetworking/Internals/CommandDispatcher.cpp Core/DicomNetworking/Internals/StoreScp.cpp NEWS Plugins/Engine/OrthancPlugins.cpp
diffstat 4 files changed, 44 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Sun Jan 13 17:49:19 2019 +0100
+++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Sun Jan 13 20:16:43 2019 +0100
@@ -83,6 +83,10 @@
 #include "../../PrecompiledHeaders.h"
 #include "CommandDispatcher.h"
 
+#if !defined(DCMTK_VERSION_NUMBER)
+#  error The macro DCMTK_VERSION_NUMBER must be defined
+#endif
+
 #include "FindScp.h"
 #include "StoreScp.h"
 #include "MoveScp.h"
@@ -364,7 +368,11 @@
       UID_RETIRED_UltrasoundImageStorage,
       UID_RETIRED_UltrasoundMultiframeImageStorage,
       UID_RETIRED_VLImageStorage,
+#if DCMTK_VERSION_NUMBER >= 364
+      UID_RETIRED_VLMultiframeImageStorage,
+#else
       UID_RETIRED_VLMultiFrameImageStorage,
+#endif
       UID_RETIRED_XRayAngiographicBiPlaneImageStorage,
       // draft
       UID_DRAFT_SRAudioStorage,
@@ -469,8 +477,16 @@
         DIC_AE calledAet_C;
         DIC_AE remoteIp_C;
         DIC_AE calledIP_C;
-        if (ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() ||
-            ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad())
+
+        if (
+#if DCMTK_VERSION_NUMBER >= 364
+	    ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() ||
+            ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad()
+#else
+	    ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() ||
+            ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad()
+#endif
+	    )
         {
           T_ASC_RejectParameters rej =
             {
@@ -606,7 +622,12 @@
       ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str());
 
       /* acknowledge or reject this association */
+#if DCMTK_VERSION_NUMBER >= 364
+      cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf));
+#else
       cond = ASC_getApplicationContextName(assoc->params, buf);
+#endif
+
       if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0)
       {
         /* reject: the application context name is not supported */
--- a/Core/DicomNetworking/Internals/StoreScp.cpp	Sun Jan 13 17:49:19 2019 +0100
+++ b/Core/DicomNetworking/Internals/StoreScp.cpp	Sun Jan 13 20:16:43 2019 +0100
@@ -83,6 +83,10 @@
 #include "../../PrecompiledHeaders.h"
 #include "StoreScp.h"
 
+#if !defined(DCMTK_VERSION_NUMBER)
+#  error The macro DCMTK_VERSION_NUMBER must be defined
+#endif
+
 #include "../../DicomParsing/FromDcmtkBridge.h"
 #include "../../DicomParsing/ToDcmtkBridge.h"
 #include "../../OrthancException.h"
@@ -188,10 +192,16 @@
           if (rsp->DimseStatus == STATUS_Success)
           {
             // which SOP class and SOP instance ?
+	    
+#if DCMTK_VERSION_NUMBER >= 364
+	    if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sizeof(sopClass),
+						     sopInstance, sizeof(sopInstance), /*opt_correctUIDPadding*/ OFFalse))
+#else
             if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sopInstance, /*opt_correctUIDPadding*/ OFFalse))
+#endif
             {
-              //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName);
-              rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand;
+		//LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName);
+		rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand;
             }
             else if (strcmp(sopClass, req->AffectedSOPClassUID) != 0)
             {
--- a/NEWS	Sun Jan 13 17:49:19 2019 +0100
+++ b/NEWS	Sun Jan 13 20:16:43 2019 +0100
@@ -5,6 +5,7 @@
 -----------
 
 * Don't consider tags whose group is below 0x0008 in C-FIND SCP
+* Compatibility with DCMTK 3.6.4
 * Fix issue #21 (DICOM files missing after uploading with Firefox)
 * Fix issue #118 (Wording in Configuration.json regarding SynchronousCMove)
 * Fix issue #124 (GET /studies/ID/media fails for certain dicom file)
--- a/Plugins/Engine/OrthancPlugins.cpp	Sun Jan 13 17:49:19 2019 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Sun Jan 13 20:16:43 2019 +0100
@@ -38,6 +38,10 @@
 #error The plugin support is disabled
 #endif
 
+#if !defined(DCMTK_VERSION_NUMBER)
+#  error The macro DCMTK_VERSION_NUMBER must be defined
+#endif
+
 
 #include "../../Core/ChunkedBuffer.h"
 #include "../../Core/DicomFormat/DicomArray.h"
@@ -2416,7 +2420,11 @@
 
       ~DictionaryReadLocker()
       {
+#if DCMTK_VERSION_NUMBER >= 364
+        dcmDataDict.rdunlock();
+#else
         dcmDataDict.unlock();
+#endif
       }
 
       const DcmDataDictionary* operator->()