diff OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp @ 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 1a26daefc3fe
children 7112a8af0b63
line wrap: on
line diff
--- 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");
     }
   }
 }