changeset 857:f53358c70c05 jpeg

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Jun 2014 15:01:19 +0200
parents 6944fc00962e
children ebc41566f742
files Core/DicomFormat/DicomImageInformation.cpp Core/DicomFormat/DicomIntegerPixelAccessor.cpp Resources/CMake/DcmtkConfiguration.cmake UnitTestsSources/JpegLossless.cpp
diffstat 4 files changed, 34 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomFormat/DicomImageInformation.cpp	Fri Jun 06 13:15:47 2014 +0200
+++ b/Core/DicomFormat/DicomImageInformation.cpp	Fri Jun 06 15:01:19 2014 +0200
@@ -125,7 +125,7 @@
       // If the tag "NumberOfFrames" is absent, assume there is a single frame
       numberOfFrames_ = 1;
     }
-    catch (boost::bad_lexical_cast)
+    catch (boost::bad_lexical_cast&)
     {
       throw OrthancException(ErrorCode_NotImplemented);
     }
--- a/Core/DicomFormat/DicomIntegerPixelAccessor.cpp	Fri Jun 06 13:15:47 2014 +0200
+++ b/Core/DicomFormat/DicomIntegerPixelAccessor.cpp	Fri Jun 06 15:01:19 2014 +0200
@@ -78,6 +78,15 @@
     if (information_.IsPlanar())
     {
       /**
+       * Each color plane shall be sent contiguously. For RGB images,
+       * this means the order of the pixel values sent is R1, R2, R3,
+       * ..., G1, G2, G3, ..., B1, B2, B3, etc.
+       **/
+      rowOffset_ = information_.GetWidth() * information_.GetBytesPerPixel();
+    }
+    else
+    {
+      /**
        * The sample values for the first pixel are followed by the
        * sample values for the second pixel, etc. For RGB images, this
        * means the order of the pixel values sent shall be R1, G1, B1,
@@ -85,15 +94,6 @@
        **/
       rowOffset_ = information_.GetWidth() * information_.GetBytesPerPixel() * information_.GetChannelCount();
     }
-    else
-    {
-      /**
-       * Each color plane shall be sent contiguously. For RGB images,
-       * this means the order of the pixel values sent is R1, R2, R3,
-       * ..., G1, G2, G3, ..., B1, B2, B3, etc.
-       **/
-      rowOffset_ = information_.GetWidth() * information_.GetBytesPerPixel();
-    }
   }
 
 
@@ -130,13 +130,25 @@
                                               unsigned int y,
                                               unsigned int channel) const
   {
-    assert(x < information_.GetWidth() && y < information_.GetHeight() && channel < information_.GetChannelCount());
+    assert(x < information_.GetWidth() && 
+           y < information_.GetHeight() && 
+           channel < information_.GetChannelCount());
     
     const uint8_t* pixel = reinterpret_cast<const uint8_t*>(pixelData_) + 
       y * rowOffset_ + frame_ * frameOffset_;
 
     // https://www.dabsoft.ch/dicom/3/C.7.6.3.1.3/
-    if (information_.IsPlanar() == 0)
+    if (information_.IsPlanar())
+    {
+      /**
+       * Each color plane shall be sent contiguously. For RGB images,
+       * this means the order of the pixel values sent is R1, R2, R3,
+       * ..., G1, G2, G3, ..., B1, B2, B3, etc.
+       **/
+      assert(frameOffset_ % information_.GetChannelCount() == 0);
+      pixel += channel * frameOffset_ / information_.GetChannelCount() + x * information_.GetBytesPerPixel();
+    }
+    else
     {
       /**
        * The sample values for the first pixel are followed by the
@@ -146,16 +158,6 @@
        **/
       pixel += channel * information_.GetBytesPerPixel() + x * information_.GetChannelCount() * information_.GetBytesPerPixel();
     }
-    else
-    {
-      /**
-       * Each color plane shall be sent contiguously. For RGB images,
-       * this means the order of the pixel values sent is R1, R2, R3,
-       * ..., G1, G2, G3, ..., B1, B2, B3, etc.
-       **/
-      assert(frameOffset_ % information_.GetChannelCount() == 0);
-      pixel += channel * frameOffset_ / information_.GetChannelCount() + x * information_.GetBytesPerPixel();
-    }
 
     uint32_t v;
     v = pixel[0];
--- a/Resources/CMake/DcmtkConfiguration.cmake	Fri Jun 06 13:15:47 2014 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Fri Jun 06 15:01:19 2014 +0200
@@ -50,7 +50,7 @@
   AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES)
 
 
-  if (ENABLE_JPEG_LOSSLESS)
+  if (ENABLE_JPEG)
     AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES)
     AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES)
     AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES)
@@ -62,6 +62,9 @@
       ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16
       ${DCMTK_SOURCES_DIR}/dcmimgle/include
       )
+    list(REMOVE_ITEM DCMTK_SOURCES 
+      ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc
+      )
   endif()
 
 
@@ -74,9 +77,11 @@
       ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls
       )
     list(REMOVE_ITEM DCMTK_SOURCES 
-      ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc)
+      ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc
+      )
     list(APPEND DCMTK_SOURCES 
-      ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc)
+      ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc
+      )
   endif()
 
 
--- a/UnitTestsSources/JpegLossless.cpp	Fri Jun 06 13:15:47 2014 +0200
+++ b/UnitTestsSources/JpegLossless.cpp	Fri Jun 06 15:01:19 2014 +0200
@@ -79,9 +79,9 @@
   }
 #else
   DcmFileFormat fileformat;
-  ASSERT_TRUE(fileformat.loadFile("IM-0001-1001-0001.dcm").good());
+  //ASSERT_TRUE(fileformat.loadFile("IM-0001-1001-0001.dcm").good());
   //ASSERT_TRUE(fileformat.loadFile("tata.dcm").good());
-  //ASSERT_TRUE(fileformat.loadFile("RG2_JPLY").good());
+  ASSERT_TRUE(fileformat.loadFile("RG2_JPLY").good());
   
   DcmDataset& dataset = *fileformat.getDataset();