changeset 4184:dbd74fa2f446

Enable the access to raw frames in Philips ELSCINT1 proprietary compression
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 12 Sep 2020 16:03:48 +0200
parents 32cda90ccf09
children b289a1234822
files NEWS OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp
diffstat 3 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Sep 09 14:47:10 2020 +0200
+++ b/NEWS	Sat Sep 12 16:03:48 2020 +0200
@@ -9,6 +9,8 @@
 * Fix transcoding in C-MOVE SCP, in the case where "SynchronousCMove" is "true"
 * When checking DICOM allowed methods, if there are multiple modalities with the same AET, 
   differentiate them from the calling IP
+* Enable the access to raw frames in Philips ELSCINT1 proprietary compression
+
 
 Version 1.7.3 (2020-08-24)
 ==========================
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Wed Sep 09 14:47:10 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Sat Sep 12 16:03:48 2020 +0200
@@ -347,14 +347,6 @@
       return;
     }
 
-    // Test whether this image is composed of a sequence of fragments
-    DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dicom);
-    if (pixelSequence != NULL)
-    {
-      index_.reset(new FragmentIndex(pixelSequence, countFrames_));
-      return;
-    }
-
     // Extract information about the image structure
     DicomMap tags;
     std::set<DicomTag> ignoreTagLength;
@@ -362,15 +354,24 @@
 
     DicomImageInformation information(tags);
 
-    // Access to the raw pixel data
-    if (DicomImageDecoder::IsPsmctRle1(dicom))
+    // Test whether this image is composed of a sequence of fragments
+    if (dicom.tagExistsWithValue(DCM_PixelData))
+    {
+      DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dicom);
+      if (pixelSequence != NULL)
+      {
+        index_.reset(new FragmentIndex(pixelSequence, countFrames_));
+      }
+      else
+      {
+        // Access to the raw pixel data
+        index_.reset(new UncompressedIndex(dicom, countFrames_, information.GetFrameSize()));
+      }
+    }
+    else if (DicomImageDecoder::IsPsmctRle1(dicom))
     {
       index_.reset(new PsmctRle1Index(dicom, countFrames_, information.GetFrameSize()));
     }
-    else
-    {
-      index_.reset(new UncompressedIndex(dicom, countFrames_, information.GetFrameSize()));
-    }
   }
 
 
@@ -387,7 +388,7 @@
     }
     else
     {
-      frame.clear();
+      throw OrthancException(ErrorCode_BadFileFormat, "Cannot access a raw frame");
     }
   }
 }
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Wed Sep 09 14:47:10 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Sat Sep 12 16:03:48 2020 +0200
@@ -134,6 +134,7 @@
     // Check whether the DICOM instance contains an image encoded with
     // the PMSCT_RLE1 scheme.
     if (!dataset.findAndGetElement(ToDcmtkBridge::Convert(DICOM_TAG_COMPRESSION_TYPE), e).good() ||
+        !dataset.tagExistsWithValue(ToDcmtkBridge::Convert(DICOM_TAG_CONTENT)) ||  // New in Orthanc 1.7.4
         e == NULL ||
         !e->isaString() ||
         !e->getString(c).good() ||