diff Core/DicomParsing/DicomDirWriter.cpp @ 2422:b340f0a9022c

New argument "/.../media?extended" to include additional type-3 tags in DICOMDIR
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 08 Oct 2017 11:46:56 +0200
parents d0fe5ec7eb05
children 878b59270859
line wrap: on
line diff
--- a/Core/DicomParsing/DicomDirWriter.cpp	Sun Oct 08 11:13:56 2017 +0200
+++ b/Core/DicomParsing/DicomDirWriter.cpp	Sun Oct 08 11:46:56 2017 +0200
@@ -128,8 +128,9 @@
   class DicomDirWriter::PImpl
   {
   private:
-    std::string fileSetId_;
-    TemporaryFile file_;
+    std::string                fileSetId_;
+    bool                       extendedSopClass_;
+    TemporaryFile              file_;
     std::auto_ptr<DcmDicomDir> dir_;
 
     typedef std::pair<ResourceType, std::string>  IndexKey;
@@ -257,8 +258,26 @@
 
 
   public:
-    PImpl() : fileSetId_("ORTHANC_MEDIA")
+    PImpl() :
+      fileSetId_("ORTHANC_MEDIA"),
+      extendedSopClass_(false)
+    {
+    }
+
+    void EnableExtendedSopClass(bool enable)
     {
+      if (enable)
+      {
+        LOG(WARNING) << "Generating a DICOMDIR with type 3 attributes, "
+                     << "which leads to an Extended SOP Class";
+      }
+      
+      extendedSopClass_ = enable;
+    }
+
+    bool IsExtendedSopClass() const
+    {
+      return extendedSopClass_;
     }
 
     void FillPatient(DcmDirectoryRecord& record,
@@ -319,6 +338,14 @@
       CopyStringType1(record, dicom, encoding, DCM_SeriesInstanceUID);
       /* use type 1C instead of 1 in order to avoid unwanted overwriting */
       CopyStringType1C(record, dicom, encoding, DCM_SeriesNumber);
+
+      // Add extended (non-standard) type 3 tags, those are not generated by DCMTK
+      // http://dicom.nema.org/medical/Dicom/2016a/output/chtml/part02/sect_7.3.html
+      // https://groups.google.com/d/msg/orthanc-users/Y7LOvZMDeoc/9cp3kDgxAwAJ
+      if (extendedSopClass_)
+      {
+        CopyStringType3(record, dicom, encoding, DCM_SeriesDescription);
+      }
     }
 
     void FillInstance(DcmDirectoryRecord& record,
@@ -522,4 +549,16 @@
   {
     pimpl_->Read(target);
   }
+
+
+  void DicomDirWriter::EnableExtendedSopClass(bool enable)
+  {
+    pimpl_->EnableExtendedSopClass(enable);
+  }
+
+  
+  bool DicomDirWriter::IsExtendedSopClass() const
+  {
+    return pimpl_->IsExtendedSopClass();
+  }
 }