changeset 176:ae79d443f780

fix RetrieveFrames (RGB)
author Leonardo Campos <leonardoscampos@gmail.com>
date Thu, 15 Dec 2016 12:28:26 -0200
parents 8d306c53f547
children 5a4ac5c6ef79
files Plugin/Dicom.h Plugin/WadoRsRetrieveFrames.cpp
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Dicom.h	Wed Dec 14 16:44:20 2016 +0100
+++ b/Plugin/Dicom.h	Thu Dec 15 12:28:26 2016 -0200
@@ -49,6 +49,7 @@
   static const gdcm::Tag DICOM_TAG_ACCESSION_NUMBER(0x0008, 0x0050);
   static const gdcm::Tag DICOM_TAG_SPECIFIC_CHARACTER_SET(0x0008, 0x0005);
   static const gdcm::Tag DICOM_TAG_PIXEL_DATA(0x7fe0, 0x0010);
+  static const gdcm::Tag DICOM_TAG_SAMPLES_PER_PIXEL(0x0028, 0x0002);
   static const gdcm::Tag DICOM_TAG_COLUMNS(0x0028, 0x0011);
   static const gdcm::Tag DICOM_TAG_ROWS(0x0028, 0x0010);
   static const gdcm::Tag DICOM_TAG_BITS_ALLOCATED(0x0028, 0x0100);
--- a/Plugin/WadoRsRetrieveFrames.cpp	Wed Dec 14 16:44:20 2016 +0100
+++ b/Plugin/WadoRsRetrieveFrames.cpp	Thu Dec 15 12:28:26 2016 -0200
@@ -311,16 +311,17 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);      
     }
 
-    int width, height, bits;
+    int width, height, bits, samplesPerPixel;
 
     if (!dicom.GetIntegerTag(height, *dictionary_, OrthancPlugins::DICOM_TAG_ROWS) ||
         !dicom.GetIntegerTag(width, *dictionary_, OrthancPlugins::DICOM_TAG_COLUMNS) ||
-        !dicom.GetIntegerTag(bits, *dictionary_, OrthancPlugins::DICOM_TAG_BITS_ALLOCATED))
+        !dicom.GetIntegerTag(bits, *dictionary_, OrthancPlugins::DICOM_TAG_BITS_ALLOCATED) || 
+        !dicom.GetIntegerTag(samplesPerPixel, *dictionary_, OrthancPlugins::DICOM_TAG_SAMPLES_PER_PIXEL))
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
     }
 
-    size_t frameSize = height * width * bits / 8;
+    size_t frameSize = height * width * bits * samplesPerPixel / 8;
     
     if (pixelData.GetByteValue()->GetLength() % frameSize != 0)
     {