changeset 4471:b6818bbef7b8

patch of DCMTK 3.6.6 to fix value of "MediaStorageSOPClassUID" if writing DICOMDIR
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 Jan 2021 09:15:05 +0100
parents 06d164d8a0fd
children 28a4baadde17
files OrthancFramework/Resources/Patches/dcmtk-3.6.6.patch OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp
diffstat 2 files changed, 35 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/Patches/dcmtk-3.6.6.patch	Mon Jan 25 18:38:29 2021 +0100
+++ b/OrthancFramework/Resources/Patches/dcmtk-3.6.6.patch	Tue Jan 26 09:15:05 2021 +0100
@@ -1,6 +1,6 @@
 diff -urEb dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake
---- dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake	2021-01-25 18:22:10.509991762 +0100
-+++ dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake	2021-01-25 18:22:48.137961762 +0100
+--- dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake	2021-01-26 08:51:48.815071681 +0100
++++ dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake	2021-01-26 08:52:06.331135995 +0100
 @@ -169,6 +169,8 @@
  endif()
  
@@ -19,8 +19,8 @@
  # Check for include files, libraries, and functions
  include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
 diff -urEb dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h
---- dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2021-01-25 18:22:10.557991724 +0100
-+++ dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h	2021-01-25 18:23:31.837926724 +0100
+--- dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2021-01-26 08:51:48.859071844 +0100
++++ dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h	2021-01-26 08:52:06.331135995 +0100
 @@ -152,6 +152,12 @@
      /// returns an iterator to the end of the repeating tag dictionary
      DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
@@ -34,9 +34,28 @@
  private:
  
      /** private undefined assignment operator
+diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc
+--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc	2021-01-26 08:51:48.863071859 +0100
++++ dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc	2021-01-26 08:56:03.519887982 +0100
+@@ -1032,7 +1032,14 @@
+     // insert Media Stored SOP Class UID
+     insertMediaSOPUID(metainfo);
+ 
+-    getDirFileFormat().validateMetaInfo(outxfer);
++    /**
++     * Patch for Orthanc: In DCMTK 3.6.6, the default value for the
++     * second argument changed from "EWM_fileformat" to
++     * "EWM_createNewMeta". This sets "MediaStorageSOPClassUID"
++     * (0002,0002) in meta-header to "1.2.276.0.7230010.3.1.0.1"
++     * instead of expected "1.2.840.10008.1.3.10".
++     **/
++    getDirFileFormat().validateMetaInfo(outxfer, EWM_fileformat);
+ 
+     {
+         // it is important that the cache object is destroyed before the file is renamed!
 diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc
---- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc	2021-01-25 18:22:10.557991724 +0100
-+++ dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc	2021-01-25 18:23:48.973912945 +0100
+--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc	2021-01-26 08:51:48.863071859 +0100
++++ dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc	2021-01-26 08:52:06.331135995 +0100
 @@ -900,3 +900,6 @@
    wrlock().clear();
    wrunlock();
@@ -45,8 +64,8 @@
 +
 +#include "dcdict_orthanc.cc"
 diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc
---- dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc	2021-01-25 18:22:10.561991720 +0100
-+++ dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc	2021-01-25 18:24:15.113891861 +0100
+--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc	2021-01-26 08:51:48.863071859 +0100
++++ dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc	2021-01-26 08:52:06.335136010 +0100
 @@ -36,6 +36,9 @@
  #include "dcmtk/dcmdata/dcostrma.h"    /* for class DcmOutputStream */
  #include "dcmtk/dcmdata/dcwcache.h"    /* for class DcmWriteCache */
@@ -58,8 +77,8 @@
  // ********************************
  
 diff -urEb dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h
---- dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2021-01-25 18:22:10.545991733 +0100
-+++ dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h	2021-01-25 18:25:09.809847547 +0100
+--- dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2021-01-26 08:51:48.847071800 +0100
++++ dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h	2021-01-26 08:52:06.335136010 +0100
 @@ -63,7 +63,7 @@
  
  DCMTK_LOG4CPLUS_INLINE_EXPORT
@@ -106,8 +125,8 @@
  
  
 diff -urEb dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc dcmtk-3.6.6/oflog/libsrc/oflog.cc
---- dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc	2021-01-25 18:22:10.545991733 +0100
-+++ dcmtk-3.6.6/oflog/libsrc/oflog.cc	2021-01-25 18:25:27.389833244 +0100
+--- dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc	2021-01-26 08:51:48.847071800 +0100
++++ dcmtk-3.6.6/oflog/libsrc/oflog.cc	2021-01-26 08:52:06.335136010 +0100
 @@ -19,6 +19,10 @@
   *
   */
@@ -120,8 +139,8 @@
  #include "dcmtk/oflog/oflog.h"
  
 diff -urEb dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h
---- dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h	2021-01-25 18:22:10.561991720 +0100
-+++ dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h	2021-01-25 18:25:57.437808753 +0100
+--- dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h	2021-01-26 08:51:48.863071859 +0100
++++ dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h	2021-01-26 08:52:06.335136010 +0100
 @@ -586,7 +586,7 @@
     */
    void setlinebuf()
--- a/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp	Mon Jan 25 18:38:29 2021 +0100
+++ b/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp	Tue Jan 26 09:15:05 2021 +0100
@@ -489,7 +489,7 @@
       return true;   // Newly created
     }
 
-    void Read(std::string& s)
+    void Write(std::string& s)
     {
       if (!GetDicomDir().write(DICOMDIR_DEFAULT_TRANSFERSYNTAX, 
                                EET_UndefinedLength /*encodingType*/, 
@@ -574,7 +574,7 @@
 
   void DicomDirWriter::Encode(std::string& target)
   {
-    pimpl_->Read(target);
+    pimpl_->Write(target);
   }