[med-svn] [gdcm] 01/06: New upstream version 2.6.7

Gert Wollny gert-guest at moszumanska.debian.org
Sat Mar 4 10:30:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository gdcm.

commit e020fa9826ec8fc5e3d9fccc02f7b719c0b6a217
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Fri Mar 3 17:42:54 2017 +0000

    New upstream version 2.6.7
---
 .travis.yml                                        |   6 +-
 Applications/Cxx/gdcmdump.cxx                      |  61 ++++-
 Applications/Cxx/gdcmxml.cxx                       |   2 +-
 CMakeLists.txt                                     |   2 +-
 Examples/Cxx/DumpExamCard.cxx                      | 245 ++++++++++++++++-----
 Examples/Cxx/FixJAIBugJPEGLS.cxx                   |   2 +-
 .../gdcmOpenSSLP7CryptographicMessageSyntax.cxx    |   6 +-
 Source/DataDictionary/gdcmPrivateDefaultDicts.cxx  |  73 +++++-
 Source/DataDictionary/privatedicts.xml             |   2 +-
 .../gdcmReader.cxx                                 |   6 +-
 .../MediaStorageAndFileFormat/gdcmImageHelper.cxx  |  38 ++++
 .../gdcmJPEG2000Codec.cxx                          |   2 +-
 Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx |   1 +
 .../Cxx/TestElement5.cxx                           |   2 +-
 .../Cxx/TestTableReader.cxx                        |   7 +-
 .../MediaStorageAndFileFormat/Cxx/TestCurve2.cxx   |   2 +-
 .../Cxx/TestImageRegionReader1.cxx                 |   2 +-
 .../Cxx/TestImageRegionReader2.cxx                 |   2 +-
 .../MediaStorageAndFileFormat/Cxx/TestOverlay3.cxx |   4 +-
 .../MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx |   2 +-
 Utilities/VTK/Applications/gdcm2vtk.cxx            |   2 +-
 Utilities/VTK/CMakeLists.txt                       |   2 +-
 Utilities/doxygen/CMakeLists.txt                   |   2 +-
 Utilities/doxygen/man/gdcmconv.xml                 |   4 +-
 Utilities/doxygen/man/gdcmdump.xml                 |  36 +--
 Utilities/doxygen/man/gdcminfo.xml                 |   2 +-
 Utilities/doxygen/man/gdcmscu.xml                  |  20 +-
 Utilities/doxygen/man/gdcmxml.xml                  |   4 +-
 Utilities/gdcmjpeg/jdlhuff.c                       |  12 +-
 Utilities/gdcmjpeg/jdphuff.c                       |  12 +-
 Utilities/gdcmjpeg/jdshuff.c                       |  12 +-
 31 files changed, 437 insertions(+), 138 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8a8aa64..fff24d5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,7 @@ matrix:
       env:
         - CFLAGS="-g -O2"
         - CXXFLAGS="-g -O2"
-        - CMAKE_EXTRA="-DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
+        - CMAKE_EXTRA="-DGDCM_WRAP_PYTHON:BOOL=OFF -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
         - B_NAME=default
         - CPACK_NAME=Linux
     - compiler: gcc
@@ -49,7 +49,7 @@ matrix:
       env:
         - CFLAGS="-Wall -Wextra" # -m64 -fsanitize=address,undefined
         - CXXFLAGS="-Wall -Wextra" # -m64 -fsanitize=address,undefined
-        - CMAKE_EXTRA="-DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
+        - CMAKE_EXTRA="-DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF"
         - B_NAME=default
         - CPACK_NAME=Darwin
 
@@ -61,6 +61,8 @@ before_install:
   - if [ "$B_NAME" == "fsanitize" ]; then mv Testing/Data Testing/Data.old; fi
   # https://docs.travis-ci.com/user/osx-ci-environment/#Environment-variables
   - if [ "$TRAVIS_OS_NAME" == "osx" ]; then mv Testing/Data Testing/Data.old; fi
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update                     ; fi
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install swig python3       ; fi
   # kakadu setup for linux/system:
   - if [ "$B_NAME" == "system" ]; then wget http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
   - if [ "$B_NAME" == "system" ]; then unzip KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
diff --git a/Applications/Cxx/gdcmdump.cxx b/Applications/Cxx/gdcmdump.cxx
index 8b528c2..459c90e 100644
--- a/Applications/Cxx/gdcmdump.cxx
+++ b/Applications/Cxx/gdcmdump.cxx
@@ -144,11 +144,54 @@ static void printbinary(std::istream &is, PDFElement const & pdfel )
   printvalue(is, type, numels, pos);
 }
 
+static void ProcessSDSDataInt( std::istream & is )
+{
+  (void)is;
+  std::cerr << "TODO" << std::endl;
+}
+
+// see read_direct_string / read_direct_int
+static void ProcessSDSDataString( std::istream & is )
+{
+  (void)is;
+#if 0
+  int32_t v1;
+  is.read( (char*)&v1,sizeof(v1));
+  assert( v1 == 0x1 );
+  uint32_t bla;
+  is.read( (char*)&bla, sizeof(bla) );
+  char name0[32];
+  memset(name0,0,sizeof(name0));
+  assert( bla < sizeof(name0) );
+  is.read( name0, bla);
+  size_t l = strlen(name0);
+  assert( l == bla );
+  std::cerr << "name0:" << name0 << std::endl;
+
+  is.read( (char*)&bla, sizeof(bla) );
+  assert( bla == 0x1 );
+  is.read( (char*)&bla, sizeof(bla) );
+  char value[32];
+  memset(value,0,sizeof(value));
+  assert( bla < sizeof(value) );
+  is.read( value, bla);
+  is.read( (char*)&bla, sizeof(bla) );
+  assert( bla == 0 ); // trailing stuff ?
+  is.read( (char*)&bla, sizeof(bla) );
+  assert( bla == 0 ); // trailing stuff ?
+  const uint32_t cur = (uint32_t)is.tellg();
+  std::cerr << "offset:" << cur << std::endl;
+#else
+  std::cerr << "TODO" << std::endl;
+#endif
+}
+
 static void ProcessSDSData( std::istream & is )
 {
   // havent been able to figure out what was the begin meant for
   is.seekg( 0x20 - 8 );
   uint32_t version = 0;
+  assert( sizeof(uint32_t) == 4 );
   is.read( (char*)&version, sizeof(version) );
   assert( version == 8 );
   uint32_t numel = 0;
@@ -212,9 +255,23 @@ static int DumpPMS_MRSDS(const gdcm::DataSet & ds)
       {
       s4 = std::string( bv4->GetPointer(), bv4->GetLength() );
       }
-    std::istringstream is( s3 );
     std::cout << "PMS/Item name: [" << s1 << "/" << s2 << "/" << s4 << "]" << std::endl;
-    ProcessSDSData( is );
+    if( bv3 ) {
+      std::istringstream is( s3 );
+      char v1 = is.peek();
+      if( v1 == 0x1 ) {
+        if( s1 == "HARDWARE_CONFIG " )
+          ProcessSDSDataInt( is );
+        else if( s1 == "COILSTATE " )
+          ProcessSDSDataString( is );
+        else
+          assert(0);
+      } else {
+        ProcessSDSData( is );
+      }
+    } else {
+      std::cout << " EMPTY !" << std::endl;
+    }
     }
   return 0;
 }
diff --git a/Applications/Cxx/gdcmxml.cxx b/Applications/Cxx/gdcmxml.cxx
index ed061aa..be7402e 100644
--- a/Applications/Cxx/gdcmxml.cxx
+++ b/Applications/Cxx/gdcmxml.cxx
@@ -497,7 +497,7 @@ static void PopulateDataSet(xmlTextReaderPtr reader,DataSet &DS, int depth, bool
         LoadValueASCII(VR::AS);
         LoadValueASCII(VR::CS);
         LoadValueASCII(VR::DA);
-        LoadValueFloat(VR::DS);
+        LoadValueDouble(VR::DS);
         LoadValueASCII(VR::DT);
         LoadValueInteger(VR::IS);
         LoadValueASCII(VR::LO);
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db5ba55..8c8a130 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers at lists.sourceforge.net
 #----------------------------------------------------------------------------
 set(GDCM_MAJOR_VERSION 2)
 set(GDCM_MINOR_VERSION 6)
-set(GDCM_BUILD_VERSION 6)
+set(GDCM_BUILD_VERSION 7)
 set(GDCM_VERSION
   "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
 # let advanced user the option to define GDCM_API_VERSION:
diff --git a/Examples/Cxx/DumpExamCard.cxx b/Examples/Cxx/DumpExamCard.cxx
index 16fe1c3..f84ebea 100644
--- a/Examples/Cxx/DumpExamCard.cxx
+++ b/Examples/Cxx/DumpExamCard.cxx
@@ -46,6 +46,8 @@ static bool compfn(const char *s1, const char *s2)
 }
 
 static const char *PDFStrings[] = { // Keep me ordered please
+  "COILSTATE", // series of string ?
+  "HARDWARE_CONFIG", // series of number ?
   "PDF_CONTROL_GEN_PARS",
   "PDF_CONTROL_PREP_PARS",
   "PDF_CONTROL_RECON_PARS",
@@ -53,6 +55,7 @@ static const char *PDFStrings[] = { // Keep me ordered please
   "PDF_EXAM_PARS",
   "PDF_HARDWARE_PARS",
   "PDF_PREP_PARS",
+  "PDF_PRESCAN_COIL_PARS",
   "PDF_SPT_PARS",
 };
 
@@ -68,10 +71,10 @@ static bool isvalidpdfstring( const char *pdfstring )
 typedef enum
 {
   param_float = 0,
-  param_integer,
-  param_string,
+  param_integer = 1, // 1 << 0
+  param_string = 2, // 1 << 1
   param_3, // ??
-  param_enum,
+  param_enum = 4, // 1 << 2
 } param_type;
 
 static const char *gettypenamefromtype( int i)
@@ -122,16 +125,34 @@ struct header
   void read( std::istream & is )
     {
     is.read( (char*)&v1,sizeof(v1));
-    is.read( (char*)&nints,sizeof(nints));
-    is.read( (char*)&v3,sizeof(v3));
-    assert( v3 == 0 ); // looks like this is always 0
-    is.read( (char*)&v4,sizeof(v4));
-    is.read( (char*)&nfloats,sizeof(nfloats));
-    is.read( (char*)&v6,sizeof(v6));
-    is.read( (char*)&nstrings,sizeof(nstrings));
-    is.read( (char*)&v8,sizeof(v8));
-    assert( v8 == 8 );
-    is.read( (char*)&numparams,sizeof(numparams));
+    if( v1 == 0x01 ) {
+      // direct (FIXME how should we detect this, much like TIFF ???)
+      nints = 0;
+      v3 = 0;
+      v4 = 0;
+      nfloats = 0;
+      v6 = 0;
+      nstrings = 0;
+      v8 = 0;
+      numparams = 0;
+      uint32_t bla;
+      is.read( (char*)&bla, sizeof(bla) );
+      assert( bla == 0x2 || bla == 0x3 );
+      nstrings = 1;
+      numparams = 1;
+    } else {
+      // indirect
+      is.read( (char*)&nints,sizeof(nints));
+      is.read( (char*)&v3,sizeof(v3));
+      assert( v3 == 0 ); // looks like this is always 0
+      is.read( (char*)&v4,sizeof(v4));
+      is.read( (char*)&nfloats,sizeof(nfloats));
+      is.read( (char*)&v6,sizeof(v6));
+      is.read( (char*)&nstrings,sizeof(nstrings));
+      is.read( (char*)&v8,sizeof(v8));
+      assert( v8 == 8 );
+      is.read( (char*)&numparams,sizeof(numparams));
+    }
     }
   void print( std::ostream & os )
     {
@@ -150,29 +171,90 @@ struct header
 struct param
 {
   char name[32+1];
-  int8_t boolean;
+  uint8_t boolean;
   int32_t type;
   uint32_t dim;
-  uint32_t v4;
-  /*int32_t*/ std::streamoff offset;
+  union {
+  uint32_t val;
+  char * ptr; } v4;
+  int32_t /*std::streamoff*/ offset;
   param_type gettype() const { return (param_type)type; }
   uint32_t getdim() const { return dim; }
+  void read_direct_int( std::istream & is ) {
+    uint32_t bla;
+    int max = 9;
+    std::vector<uint32_t> v;
+    for( int i = 0; i < max; ++i ) {
+      is.read( (char*)&bla, sizeof(bla) );
+      v.push_back( bla );
+    }
+    is.read( (char*)&bla, sizeof(bla) );
+    char name0[32];
+    memset(name0,0,sizeof(name0));
+    assert( bla < sizeof(name0) );
+    is.read( name0, bla);
+    size_t l = strlen(name0);
+    assert( l == bla );
+    char * ptr = strdup( name0 );
+    v4.ptr = ptr;
+    type = param_string;
+    dim = 1;
+    offset = 0; // important !
+  }
+  void read_direct_string( std::istream & is ) {
+    uint32_t bla;
+    is.read( (char*)&bla, sizeof(bla) );
+    char name0[32];
+    memset(name0,0,sizeof(name0));
+    assert( bla < sizeof(name0) );
+    is.read( name0, bla);
+    size_t l = strlen(name0);
+    assert( l == bla );
+    memcpy( this->name, name0, bla );
+    is.read( (char*)&bla, sizeof(bla) );
+    assert( bla == 0x1 );
+    is.read( (char*)&bla, sizeof(bla) );
+    char value[32];
+    memset(value,0,sizeof(value));
+    assert( bla < sizeof(value) );
+    is.read( value, bla);
+    is.read( (char*)&bla, sizeof(bla) );
+    assert( bla == 0 ); // trailing stuff ?
+    is.read( (char*)&bla, sizeof(bla) );
+    assert( bla == 0 ); // trailing stuff ?
+    const uint32_t cur = (uint32_t)is.tellg();
+    std::cerr << "offset:" << cur << std::endl;
+    if( cur == 65 )
+      is.read( (char*)&bla, 1 );
+    else if( cur == 66 )
+      is.read( (char*)&bla, 1 );
+    else if( cur == 122 )
+      is.read( (char*)&bla, 2 );
+    else
+      assert(0);
+    type = param_string;
+    dim = 1;
+    // FIXME: store the value in v4 for now:
+    char * ptr = strdup( value );
+    v4.ptr = ptr;
+    offset = 0; // important !
+  }
   void read( std::istream & is )
     {
     is.read( name, 32 + 1);
-    //assert( name[32] == 0 ); // fails sometimes...
     // This is always the same issue the string can contains garbarge from previous run,
     // we need to print only until the first \0 character:
-    assert( strlen( name ) <= 32 ); // sigh
+    assert( strlen( name ) <= 32 );
     is.read( (char*)&boolean,1);
-    assert( boolean == 0 || boolean == 1 ); // some kind of bool...
+    assert( boolean == 0 || boolean == 1 || boolean == 0x69 ); // some kind of bool, or digital trash ?
     is.read( (char*)&type, sizeof( type ) );
     assert( gettypenamefromtype( type ) );
-    is.read( (char*)&dim, sizeof( dim ) );
-    is.read( (char*)&v4, sizeof( v4 ) );
-    //assert( v4 == 0 ); // always 0 ? sometimes not...
-    const std::streamoff cur = is.tellg();
+    is.read( (char*)&dim, sizeof( dim ) ); // number of elements
+    is.read( (char*)&v4.val, sizeof( v4.val ) );
+    assert( v4.val == 0 ); // always 0 ? sometimes not...
+    const uint32_t cur = (uint32_t)is.tellg();
     is.read( (char*)&offset, sizeof( offset ) );
+    assert( offset != 0 );
     offset += cur;
     }
 
@@ -182,11 +264,12 @@ struct param
     os << (int)boolean << ",";
     os << type << ",";
     os << dim << ",";
-    os << v4 << ",";
+    os << v4.val << ",";
     os << offset << std::endl;
     }
   void printvalue( std::ostream & os, std::istream & is ) const
     {
+    if( offset ) {
     is.seekg( offset );
     switch( type )
       {
@@ -205,10 +288,10 @@ struct param
       break;
     case param_integer:
         {
+        int32_t v;
         for( uint32_t idx = 0; idx < dim; ++idx )
           {
           if( idx ) os << ",";
-          int32_t v;
           is.read( (char*)&v, sizeof(v) );
           os << v;
           }
@@ -216,24 +299,40 @@ struct param
       break;
     case param_string:
         {
+        int size = 81;
         std::string v;
-        v.resize( dim );
-        is.read( &v[0], dim );
-        os << v;
+        v.resize( size );
+        for( uint32_t idx = 0; idx < dim; ++idx )
+          {
+          if( idx ) os << ";";
+          is.read( &v[0], size );
+          os << v.c_str();
+          }
         }
       break;
     case param_enum:
         {
+        int32_t v;
         for( uint32_t idx = 0; idx < dim; ++idx )
           {
           if( idx ) os << ",";
-          int32_t v;
           is.read( (char*)&v, sizeof(v) );
           os << v;
           }
         }
       break;
       }
+    } else {
+#if 1
+      // direct
+      assert ( type == param_string );
+      char * ptr = v4.ptr;
+        //std::string v;
+        //v.resize( dim );
+        //is.read( &v[0], dim );
+        os << ptr;
+#endif
+    }
 
     }
   void printxml( std::ostream & os, std::istream & is ) const
@@ -279,7 +378,7 @@ Wotsit ?
   */
   bool ret = false;
 
-  //  (2005,1137) PN (LO) [PDF_CONTROL_GEN_PARS]                    # 20,1 ?
+  //  (2005,1137) PN (LO) [PDF_CONTROL_GEN_PARS]                    # 20,1 Protocol Data Name
   const gdcm::PrivateTag pt0(0x2005,0x37,"Philips MR Imaging DD 002");
   if( !ds.FindDataElement( pt0 ) ) return false;
   const gdcm::DataElement &de0 = ds.GetDataElement( pt0 );
@@ -287,11 +386,23 @@ Wotsit ?
   const gdcm::ByteValue * bv0 = de0.GetByteValue();
   std::string s0( bv0->GetPointer() , bv0->GetLength() );
 
-  // (2005,1139) LO [IEEE_PDF]                                     # 8,1 ?
+  // (2005,1139) LO [IEEE_PDF]                                     # 8,1 Protocol Data Type
   const gdcm::PrivateTag pt1(0x2005,0x39,"Philips MR Imaging DD 002");
   if( !ds.FindDataElement( pt1 ) ) return false;
   const gdcm::DataElement &de1 = ds.GetDataElement( pt1 );
 
+  // (2005,1143) SL 53                                             # 4,1 Protocol Data Block Length (non-padded)
+  const gdcm::PrivateTag pt2(0x2005,0x43,"Philips MR Imaging DD 002");
+  if( !ds.FindDataElement( pt2 ) ) return false;
+  const gdcm::DataElement &de2 = ds.GetDataElement( pt2 );
+
+  // (2005,1147) CS [Y ]                                           # 2,1 Protocol Data Boolean
+  const gdcm::PrivateTag pt3(0x2005,0x47,"Philips MR Imaging DD 002");
+  if( !ds.FindDataElement( pt3 ) ) return false;
+  const gdcm::DataElement &de3 = ds.GetDataElement( pt3 );
+  (void)de3;
+
+  // (2005,1144) OW 00\00\00\00\05\00\00\00\35\2e\31\2e\37\00         # 54,1 Protocol Data Block
   const gdcm::PrivateTag pt(0x2005,0x44,"Philips MR Imaging DD 002");
   if( !ds.FindDataElement( pt ) ) return false;
   const gdcm::DataElement &de = ds.GetDataElement( pt );
@@ -345,40 +456,70 @@ Wotsit ?
     {
     if( de1.IsEmpty() ) return false;
     const gdcm::ByteValue * bv1 = de1.GetByteValue();
+    gdcm::Element<gdcm::VR::SL,gdcm::VM::VM1> dlen = {{0l}};
+    dlen.SetFromDataElement( de2 );
     std::string s1( bv1->GetPointer() , bv1->GetLength() );
 
     if( s1 == "IEEE_PDF" )
       {
-      //  std::cout << "Len= " << bv->GetLength() << std::endl;
-#if 0
-      std::string fn = gdcm::LOComp::Trim( s.c_str() ); // remove trailing space
-      std::ofstream out( fn.c_str() );
-      out.write( bv->GetPointer(), bv->GetLength() );
-      out.close();
-#endif
 
       std::istringstream is;
-      std::string dup( bv->GetPointer(), bv->GetLength() );
+      assert( bv->GetLength() == (size_t)dlen.GetValue() || bv->GetLength() == (size_t)(dlen.GetValue() + 1) );
+      std::string dup( bv->GetPointer(), dlen.GetValue() /*bv->GetLength()*/ );
       is.str( dup );
 
       header h;
       h.read( is );
-#if 0
-      std::cout << s0.c_str() << std::endl;
+      //assert( is.peek() && is.eof() );
+#if 1
+      static int c = 0;
+      std::string fn0 = gdcm::LOComp::Trim( s1.c_str() ); // remove trailing space
+      std::stringstream ss;
+      ss << fn0 << "_" << c++;
+      if( h.v1 == 0x01 )
+        ss << ".direct";
+      else
+        ss << ".indirect";
+      std::cout << "fn0=" << ss.str() << " Len= " << bv->GetLength() << std::endl;
+      std::ofstream out( ss.str().c_str() );
+      out.write( bv->GetPointer(), bv->GetLength() );
+      out.close();
+#endif
+#if 1
+      std::cout << dup.c_str() << std::endl;
       h.print( std::cout );
 #endif
 
-      assert( is.tellg() == std::streampos(0x20) );
-      is.seekg( 0x20 );
-
       std::vector< param > params;
-      param p;
-      for( uint32_t i = 0; i < h.getnparams(); ++i )
-        {
-        p.read( is );
-        //p.print( std::cout );
-        params.push_back( p );
+      if( h.v1 == 0x01 ) {
+        for( uint32_t i = 0; i < 1 /* h.getnparams()*/; ++i ) {
+          param p;
+          if( s0 == "HARDWARE_CONFIG " )
+            {
+            p.read_direct_int( is );
+            }
+          else if( s0 == "COILSTATE " )
+            {
+            p.read_direct_string( is );
+            }
+          else
+            {
+            assert(0);
+            }
+          params.push_back( p );
         }
+      } else {
+        assert( is.tellg() == std::streampos(0x20) );
+        is.seekg( 0x20 );
+
+        param p;
+        for( uint32_t i = 0; i < h.getnparams(); ++i )
+          {
+          p.read( is );
+          //p.print( std::cout );
+          params.push_back( p );
+          }
+      }
 
       std::string fn = gdcm::LOComp::Trim( s0.c_str() ); // remove trailing space
       bool b1 = isvalidpdfstring( fn.c_str() );
@@ -535,7 +676,9 @@ int main(int argc, char *argv[])
 
     gdcm::DataSet &nestedds = item.GetNestedDataSet();
 
-    if( !ProcessNested( nestedds ) ) return 1;
+    if( !ProcessNested( nestedds ) ) {
+      std::cerr << "Error processing Item #" << i << std::endl;
+    }
     }
 
   return 0;
diff --git a/Examples/Cxx/FixJAIBugJPEGLS.cxx b/Examples/Cxx/FixJAIBugJPEGLS.cxx
index 53ac8e6..cf88ed2 100644
--- a/Examples/Cxx/FixJAIBugJPEGLS.cxx
+++ b/Examples/Cxx/FixJAIBugJPEGLS.cxx
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
     if (JpegLsReadHeader(buffer, totalLen, &metadata) != OK)
       {
       std::cerr << "Cant parse jpegls" << std::endl;
-      return false;
+      return 1;
       }
 
     std::cout << metadata.width << std::endl;
diff --git a/Source/Common/gdcmOpenSSLP7CryptographicMessageSyntax.cxx b/Source/Common/gdcmOpenSSLP7CryptographicMessageSyntax.cxx
index 04b0780..6941fa8 100644
--- a/Source/Common/gdcmOpenSSLP7CryptographicMessageSyntax.cxx
+++ b/Source/Common/gdcmOpenSSLP7CryptographicMessageSyntax.cxx
@@ -285,7 +285,7 @@ bool OpenSSLP7CryptographicMessageSyntax::Decrypt(char *output, size_t &outlen,
   ::PKCS7 *p7;
 #undef PKCS7_SIGNER_INFO
   ::PKCS7_SIGNER_INFO *si;
-  X509_STORE_CTX cert_ctx;
+  X509_STORE_CTX *cert_ctx=NULL;
   X509_STORE *cert_store=NULL;
   BIO *data,*detached=NULL,*p7bio=NULL;
   char buf[1024*4];
@@ -331,6 +331,7 @@ bool OpenSSLP7CryptographicMessageSyntax::Decrypt(char *output, size_t &outlen,
 //  }
 
 
+  cert_ctx=X509_STORE_CTX_new();
   /* This stuff is being setup for certificate verification.
    * When using SSL, it could be replaced with a
    * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
@@ -378,13 +379,14 @@ bool OpenSSLP7CryptographicMessageSyntax::Decrypt(char *output, size_t &outlen,
       {
       //si=my_sk_PKCS7_SIGNER_INFO_value(sk,i);
           si=sk_PKCS7_SIGNER_INFO_value(sk,i);
-      i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
+      i=PKCS7_dataVerify(cert_store,cert_ctx,p7bio,p7,si);
       if (i <= 0)
         goto err;
       else
         fprintf(stderr,"Signature verified\n");
       }
     }
+  X509_STORE_CTX_free(cert_ctx);
   X509_STORE_free(cert_store);
 
   BIO_free_all(p7bio);
diff --git a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
index 86f8fb9..67b4ff6 100644
--- a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
+++ b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
@@ -37,14 +37,23 @@ typedef struct
 } DICT_ENTRY;
 
 static const DICT_ENTRY DICOMV3DataDict [] = {
+  {0x0009,0x00ee,"MEDISO-1",VR::DT,VM::VM1,"?",false }, // ftp://dicom.nema.org/MEDICAL/dicom/DataSets/WG30/Mediso/PETCT/Rat%20C-2-3%20PETCT/Compliance/testratc23enhancedpet2.dcm.dcdump.txt
+  {0x0009,0x00ef,"MEDISO-1",VR::DT,VM::VM1,"?",false },
+  {0x0009,0x00f0,"MEDISO-1",VR::FD,VM::VM1,"?",false },
+  {0x0009,0x00f1,"MEDISO-1",VR::FD,VM::VM1,"?",false },
+  {0x0009,0x00f2,"MEDISO-1",VR::FD,VM::VM1,"?",false },
+  {0x0009,0x00f3,"MEDISO-1",VR::FD,VM::VM1,"?",false },
+  {0x0009,0x00fa,"MEDISO-1",VR::ST,VM::VM1,"?",false },
+  {0x0009,0x00fb,"MEDISO-1",VR::US,VM::VM1,"?",false },
+  {0x0011,0x0006,"MEDISO-1",VR::LO,VM::VM1,"UUID (variant=RFC 4122,version=4)",false },
   {0x0075,0x0000,"LLTech, Light-CT Viewer group",VR::CS,VM::VM1,"Enable MPR",false },
   {0x0075,0x0001,"LLTech, Light-CT Viewer group",VR::LO,VM::VM1,"Imaged surface",false },
   {0x0075,0x0002,"LLTech, Light-CT Viewer group",VR::LO,VM::VM1,"Imaged depth",false },
   {0x0075,0x0003,"LLTech, Light-CT Viewer group",VR::LO,VM::VM1,"Sample description",false },
   {0x0075,0x0004,"LLTech, Light-CT Viewer group",VR::SH,VM::VM1,"Number of accumulations",false }, // UL ?
-  {0x0857,0x0000,"Nautilus Medical",VR::LO,VM::VM1,"?",false },
+  {0x0857,0x0000,"Nautilus Medical",VR::LO,VM::VM1,"?Product Name. Eg. DICOM_RAY?",false },
   {0x0857,0x0001,"Nautilus Medical",VR::LO,VM::VM1,"?Source Application Entity Title?",false },
-  {0x0857,0x0002,"Nautilus Medical",VR::LO,VM::VM1,"?",false },
+  {0x0857,0x0002,"Nautilus Medical",VR::LO,VM::VM1,"?Burn date ISO 8601 with decimal second fraction?",false },
   {0x0857,0x0003,"Nautilus Medical",VR::LO,VM::VM1,"?",false },
   {0x0029,0x0004,"TELEMIS",VR::US,VM::VM1,"?",false },
   {0x3129,0x0010,"RamSoft Race Identifier",VR::LO,VM::VM1,"?",false },
@@ -3846,7 +3855,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x0045,0x0014,"GEMS_SENO_02",VR::DS,VM::VM1,"Pixel Pitch Microns",false },
   {0x0045,0x0015,"GEMS_SENO_02",VR::IS,VM::VM1,"Pixel Depth Bits",false },
   {0x0045,0x0016,"GEMS_SENO_02",VR::IS,VM::VM2,"Binning Factor X and Y",false },
-  {0x0045,0x001b,"GEMS_SENO_02",VR::LO,VM::VM1,"Clinical View",false },
+  {0x0045,0x001b,"GEMS_SENO_02",VR::CS,VM::VM1,"Clinical View",false },
   {0x0045,0x001d,"GEMS_SENO_02",VR::DS,VM::VM1,"Mean Of Raw Gray Levels",false },
   {0x0045,0x001e,"GEMS_SENO_02",VR::DS,VM::VM1,"Mean Of Offset Gray Levels",false },
   {0x0045,0x001f,"GEMS_SENO_02",VR::DS,VM::VM1,"Mean Of Corrected Gray Levels",false },
@@ -3870,12 +3879,12 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x0045,0x003e,"GEMS_SENO_02",VR::US,VM::VM1,"Vignette Pixel Representation",false },
   {0x0045,0x003f,"GEMS_SENO_02",VR::OB,VM::VM1,"Vignette Pixel Data",false },
   {0x0045,0x0049,"GEMS_SENO_02",VR::DS,VM::VM1,"Radiological Thickness",false },
-  {0x0045,0x0050,"GEMS_SENO_02",VR::UI,VM::VM1,"SC Instance UID",false },
-  {0x0045,0x0051,"GEMS_SENO_02",VR::UI,VM::VM1,"SC series UID",false },
+  {0x0045,0x0050,"GEMS_SENO_02",VR::UI,VM::VM1,"CR Instance UID",false },
+  {0x0045,0x0051,"GEMS_SENO_02",VR::UI,VM::VM1,"CR series UID",false },
   {0x0045,0x0052,"GEMS_SENO_02",VR::IS,VM::VM1,"Raw Diagnostic Low",false },
   {0x0045,0x0053,"GEMS_SENO_02",VR::IS,VM::VM1,"Raw Diagnostic High",false },
   {0x0045,0x0054,"GEMS_SENO_02",VR::DS,VM::VM1,"Exponent",false },
-  {0x0045,0x0055,"GEMS_SENO_02",VR::IS,VM::VM1,"A Coefficients",false },
+  {0x0045,0x0055,"GEMS_SENO_02",VR::IS,VM::VM1_n,"A Coefficients",false },
   {0x0045,0x0056,"GEMS_SENO_02",VR::DS,VM::VM1,"Noise Reduction Sensitivity",false },
   {0x0045,0x0057,"GEMS_SENO_02",VR::DS,VM::VM1,"Noise Reduction Threshold",false },
   {0x0045,0x0058,"GEMS_SENO_02",VR::DS,VM::VM1,"mu",false },
@@ -3887,8 +3896,13 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x0045,0x0064,"GEMS_SENO_02",VR::IS,VM::VM1,"Segm Threshold",false },
   {0x0045,0x0065,"GEMS_SENO_02",VR::IS,VM::VM1,"Detector Entrance Dose",false },
   {0x0045,0x0066,"GEMS_SENO_02",VR::IS,VM::VM1,"Asymmetrical Collimation Information",false },
-  {0x0045,0x0071,"GEMS_SENO_02",VR::OB,VM::VM1,"STX buffer",false },
-  {0x0045,0x0072,"GEMS_SENO_02",VR::DS,VM::VM2,"Image Crop point",false },
+  {0x0045,0x0067,"GEMS_SENO_02",VR::DS,VM::VM3_4,"LUT Asymmetry parameter",false },
+  {0x0045,0x0068,"GEMS_SENO_02",VR::CS,VM::VM3,"Acquisition Mode",false },
+  {0x0045,0x0069,"GEMS_SENO_02",VR::IS,VM::VM1,"Collimator Rotation",false },
+  {0x0045,0x0070,"GEMS_SENO_02",VR::DS,VM::VM1,"Brightness Adjustment",false },
+  {0x0045,0x0071,"GEMS_SENO_02",VR::DS,VM::VM1,"Contrast Adjustment",false },
+  {0x0045,0x0072,"GEMS_SENO_02",VR::DS,VM::VM1,"Collimator Width",false },
+  {0x0045,0x0073,"GEMS_SENO_02",VR::DS,VM::VM1,"Collimator Height",false },
   {0x0025,0x0006,"GEMS_SERS_01",VR::SS,VM::VM1,"Last pulse sequence used",false },
   {0x0025,0x0007,"GEMS_SERS_01",VR::SL,VM::VM1,"Images in Series",false },
   {0x0025,0x0010,"GEMS_SERS_01",VR::SL,VM::VM1,"Landmark Counter",false },
@@ -5761,6 +5775,36 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x2005,0x0050,"Philips MR Imaging DD 005",VR::SS,VM::VM1,"MRNrOfPatientOtherIDs", false },
   {0x2005,0x0055,"Philips MR Imaging DD 005",VR::FD,VM::VM3,"ImageVelocityEncodingDirection", false },
   {0x2005,0x0092,"Philips MR Imaging DD 005",VR::FL,VM::VM1,"Specific Energy Dose",false },
+  {0x2005,0x0053,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MRE Frequency",false },
+  {0x2005,0x0054,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MRE Amplitude",false },
+  {0x2005,0x0055,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MREMEG Frequency",false },
+  {0x2005,0x0056,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MREMEG Pairs",false },
+  {0x2005,0x0057,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"MREMEG Direction",false },
+  {0x2005,0x0058,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MREMEG Amplitude",false },
+  {0x2005,0x0059,"Philips MR Imaging DD 006",VR::FL,VM::VM1,"MRE Number of Phase Delays",false },
+  {0x2005,0x0060,"Philips MR Imaging DD 006",VR::IS,VM::VM1,"MRE Number of Motion Cycles",false },
+  {0x2005,0x0061,"Philips MR Imaging DD 006",VR::UN,VM::VM1,"MRE Motion Meg Phase Delay",false },
+  {0x2005,0x0062,"Philips MR Imaging DD 006",VR::LT,VM::VM1,"MRE Inversion Algorithm Version",false },
+  {0x2005,0x0063,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"Sagittal Slice Order",false },
+  {0x2005,0x0064,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"Coronal Slice Order",false },
+  {0x2005,0x0065,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"Transversal Slice Order",false },
+  {0x2005,0x0066,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"Series Orientation ",false },
+  {0x2005,0x0067,"Philips MR Imaging DD 006",VR::IS,VM::VM1,"MR Stack Reverse ",false },
+  {0x2005,0x0068,"Philips MR Imaging DD 006",VR::UN,VM::VM1,"MRE Phase Delay Number",false },
+  {0x2005,0x0071,"Philips MR Imaging DD 006",VR::IS,VM::VM1,"Number Of Inversion Delays",false },
+  {0x2005,0x0072,"Philips MR Imaging DD 006",VR::UN,VM::VM1,"Inversion Delay Time",false },
+  {0x2005,0x0073,"Philips MR Imaging DD 006",VR::UN,VM::VM1,"Inversion Delay Number",false },
+  {0x2005,0x0074,"Philips MR Imaging DD 006",VR::DS,VM::VM1,"Max DB DT",false },
+  {0x2005,0x0075,"Philips MR Imaging DD 006",VR::DS,VM::VM1,"Max SAR",false },
+  {0x2005,0x0076,"Philips MR Imaging DD 006",VR::LT,VM::VM1,"SAR Type",false },
+  {0x2005,0x0078,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"Metal Implant Status",false },
+  {0x2005,0x0079,"Philips MR Imaging DD 006",VR::CS,VM::VM1_n,"Orientation Mirror Flip",false },
+  {0x2005,0x0081,"Philips MR Imaging DD 006",VR::CS,VM::VM1,"SAR Operation Mode",false },
+  {0x2005,0x0082,"Philips MR Imaging DD 006",VR::IS,VM::VM1,"Spatial Gradient",false },
+  {0x2005,0x0083,"Philips MR Imaging DD 006",VR::LT,VM::VM1,"Additional Constraints",false },
+  {0x2005,0x0085,"Philips MR Imaging DD 006",VR::DS,VM::VM1,"PIIM_GRADIENT_SLEW_RATE",false },
+  {0x2005,0x0086,"Philips MR Imaging DD 006",VR::LT,VM::VM1,"?",false },
+  {0x2005,0x0087,"Philips MR Imaging DD 006",VR::DS,VM::VM1,"PIIM_MR_STUDY_B1RMS",false },
   /* new group */
   {0x7043,0x0000,"Philips NM Private Group",VR::SH,VM::VM1,"?",false },
   {0x0511,0x0000,"Philips PET Private Group",VR::US,VM::VM1,"?",false },
@@ -5984,6 +6028,8 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x200d,0x0010,"Philips US Imaging DD 109",VR::SL,VM::VM1,"?",false },
   {0x200d,0x0011,"Philips US Imaging DD 109",VR::LO,VM::VM1,"?",false },
   {0x200d,0x0012,"Philips US Imaging DD 109",VR::SL,VM::VM1,"?",false },
+  {0x200d,0x0013,"Philips US Imaging DD 109",VR::US,VM::VM1_n,"?",false },
+  {0x200d,0x0014,"Philips US Imaging DD 109",VR::CS,VM::VM1,"?",false },
   {0x200d,0x0001,"Philips US Imaging DD 113",VR::LO,VM::VM1,"?",false },
   {0x200d,0x0002,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0003,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
@@ -5991,17 +6037,19 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x200d,0x0005,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0006,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0007,"Philips US Imaging DD 113",VR::CS,VM::VM1,"?",false },
+  {0x200d,0x0008,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false }, // 16bits RLE
   {0x200d,0x0009,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
+  {0x200d,0x000a,"Philips US Imaging DD 113",VR::FD,VM::VM1_n,"?",false },
   {0x200d,0x000b,"Philips US Imaging DD 113",VR::CS,VM::VM1,"?",false },
   {0x200d,0x000c,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x000d,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x000e,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
-  {0x200d,0x000f,"Philips US Imaging DD 113",VR::DS,VM::VM1,"?",false },
-  {0x200d,0x0010,"Philips US Imaging DD 113",VR::DS,VM::VM1,"?",false },
+  {0x200d,0x000f,"Philips US Imaging DD 113",VR::DS,VM::VM1_n,"?",false },
+  {0x200d,0x0010,"Philips US Imaging DD 113",VR::DS,VM::VM1_n,"?",false },
   {0x200d,0x0011,"Philips US Imaging DD 113",VR::SL,VM::VM1,"?",false },
   {0x200d,0x0012,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0013,"Philips US Imaging DD 113",VR::FL,VM::VM1_n,"?",false },
-  {0x200d,0x0014,"Philips US Imaging DD 113",VR::US,VM::VM1,"?",false },
+  {0x200d,0x0014,"Philips US Imaging DD 113",VR::US_SS,VM::VM1_n,"?",false },
   {0x200d,0x0015,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0017,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
   {0x200d,0x0018,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
@@ -6014,6 +6062,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x200d,0x001f,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
   {0x200d,0x0020,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
   {0x200d,0x0021,"Philips US Imaging DD 113",VR::FD,VM::VM1,"?",false },
+  {0x200d,0x0022,"Philips US Imaging DD 113",VR::UL,VM::VM1,"?",false },
   {0x200d,0x0002,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Echo Vision Setting",false },
   {0x200d,0x0003,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Color Vision Setting",false },
   {0x200d,0x0004,"Philips US Private 3D",VR::IS,VM::VM1,"Threedpr Transparency",false },
@@ -7296,7 +7345,7 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
   {0x0033,0x0024,"SIEMENS MED NM",VR::FL,VM::VM1,"Backprojection angle head 1",false },
   {0x0033,0x0025,"SIEMENS MED NM",VR::FL,VM::VM1,"Backprojection angle head 2",false },
   {0x0033,0x0028,"SIEMENS MED NM",VR::SL,VM::VM1,"Number of point sources used for NCO and MHR",false },
-  {0x0033,0x0029,"SIEMENS MED NM",VR::FL,VM::VM1,"Crystal thickness",false },
+  {0x0033,0x0029,"SIEMENS MED NM",VR::FL,VM::VM2,"Crystal thickness",false },
   {0x0033,0x0030,"SIEMENS MED NM",VR::LO,VM::VM1,"Preset name used for acquisition",false },
   {0x0033,0x0031,"SIEMENS MED NM",VR::FL,VM::VM1,"Camera config angle",false },
   {0x0033,0x0032,"SIEMENS MED NM",VR::LO,VM::VM1,"Crystal type Startburst or not",false },
diff --git a/Source/DataDictionary/privatedicts.xml b/Source/DataDictionary/privatedicts.xml
index 32a8785..edb80eb 100644
--- a/Source/DataDictionary/privatedicts.xml
+++ b/Source/DataDictionary/privatedicts.xml
@@ -4508,7 +4508,7 @@
   <entry owner="PRIVATE ORIGINAL ATTRIBUTES" group="0021" element="xx05" vr="DT" vm="1" name="Replacement Date and Time"/>
   <entry owner="PRIVATE ORIGINAL ATTRIBUTES" group="0021" element="xx10" vr="LO" vm="1" name="Replacement Originator Name"/>
   <entry owner="PRIVATE ORIGINAL ATTRIBUTES" group="0021" element="xx12" vr="LO" vm="1" name="Replacement Reason"/>
-  <entry owner="PRIVATE ORIGINAL ATTRIBUTES" group="0021" element="xx70" vr="PN" vm="1-n" name="Original Operators'Name"/>
+  <entry owner="PRIVATE ORIGINAL ATTRIBUTES" group="0021" element="xx70" vr="PN" vm="1-n" name="Original Operators' Name"/>
   <entry owner="Philips EV Imaging DD 017" group="2007" element="xxc1" vr="UI" vm="1" name="? SOP Instance UID ?"/>
   <entry owner="Philips EV Imaging DD 017" group="2007" element="xxc2" vr="DA" vm="1" name="?"/>
   <entry owner="Philips EV Imaging DD 017" group="2007" element="xxc3" vr="TM" vm="1" name="?"/>
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmReader.cxx b/Source/DataStructureAndEncodingDefinition/gdcmReader.cxx
index ed89771..b46ff8e 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmReader.cxx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmReader.cxx
@@ -752,6 +752,10 @@ bool Reader::InternalReadCommon(const T_Caller &caller)
   return success;
 }
 
+static inline bool isasciiupper( char c ) {
+  return c >= 'A' && c <= 'Z';
+}
+
 // This function re-implements code from:
 // http://www.dclunie.com/medical-image-faq/html/part2.html#DICOMTransferSyntaxDetermination
 // The above code does not work well for random file. It implicitly assumes we
@@ -798,7 +802,7 @@ bool Reader::CanRead() const
       if (b[4] < b[7]) bigendian=true;
       }
     // else littleendian
-    if (isupper(b[4]) && isupper(b[5])) explicitvr=true;
+    if (isasciiupper(b[4]) && isasciiupper(b[5])) explicitvr=true;
     }
   SwapCode sc = SwapCode::Unknown;
   TransferSyntax::NegociatedType nts = TransferSyntax::Unknown;
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
index a82d277..8489aae 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
@@ -1819,7 +1819,31 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
       ipp.SetValue( new_origin[2], 2);
       SetDataElementInSQAsItemNumber(ds, ipp.GetAsDataElement(), tfgs, i+1);
       }
+    // cleanup the sharedgroup:
+    {
+      const Tag tfgs0(0x5200,0x9229);
+      if( ds.FindDataElement( tfgs0 ) )
+      {
+        SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( tfgs0 ).GetValueAsSQ();
+        assert( sqi );
+        SequenceOfItems::SizeType nitems = sqi->GetNumberOfItems();
+        for(SequenceOfItems::SizeType i0 = 1; i0 <= nitems; ++i0)
+        {
+          // Get first item:
+          Item &item = sqi->GetItem(i0);
+          DataSet & subds = item.GetNestedDataSet();
+          const Tag tpms(0x0020,0x9113);
+          subds.Remove(tpms);
+        }
+      }
+    }
+    // Cleanup root level:
+    {
+    const Tag tiop(0x0020,0x0032);
+    ds.Remove(tiop);
+    }
 
+ 
     // C.7.6.6.1.2 Frame Increment Pointer
     // (0028,0009) AT (0018,2005)                                        # 4,1-n Frame Increment Pointer
     if( ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
@@ -1980,6 +2004,11 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
         }
       }
     }
+    // Cleanup root level:
+    {
+    const Tag tiop(0x0020,0x0037);
+    ds.Remove(tiop);
+    }
 
     return;
     }
@@ -2108,6 +2137,15 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
         }
       }
     }
+    // cleanup root (famous MR -> EMR case) 
+    {
+    const Tag t1(0x0028,0x1052);
+    ds.Remove(t1);
+    const Tag t2(0x0028,0x1053);
+    ds.Remove(t2);
+    const Tag t3(0x0028,0x1053);
+    ds.Remove(t3);
+    }
     return;
     }
 
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
index 71a1958..bff163a 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
@@ -299,7 +299,7 @@ struct myfile
   size_t len;
 };
 
-void gdcm_error_callback(const char* msg, void* f)
+void gdcm_error_callback(const char* msg, void* )
 {
 #if 0
   if( strcmp( msg, "Cannot read data with no size known, giving up\n" ) == 0 )
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
index 272f80c..adb7ae5 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx
@@ -324,6 +324,7 @@ bool JPEGCodec::Code(DataElement const &in, DataElement &out)
   //sq->GetTable().SetByteValue( dummy, sizeof(dummy) );
 
   const ByteValue *bv = in.GetByteValue();
+  if(!bv) return false; // broken DICOM file ?
   const unsigned int *dims = this->GetDimensions();
   const char *input = bv->GetPointer();
   unsigned long len = bv->GetLength();
diff --git a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement5.cxx b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement5.cxx
index 97b9b20..11ffc2d 100644
--- a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement5.cxx
+++ b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement5.cxx
@@ -23,7 +23,7 @@ int TestLO()
   const size_t lenstr = strlen(str);
   std::stringstream ss;
   ss.str( str );
-  unsigned int count = gdcm::VM::GetNumberOfElementsFromArray(str, lenstr);
+  unsigned int count = gdcm::VM::GetNumberOfElementsFromArray(str, (unsigned int)lenstr);
   gdcm::VR vr = gdcm::VR::LO;
   //gdcm::VM vm = gdcm::VM::VM2;
   //gdcm::VR vr = gdcm::VR::DS;
diff --git a/Testing/Source/InformationObjectDefinition/Cxx/TestTableReader.cxx b/Testing/Source/InformationObjectDefinition/Cxx/TestTableReader.cxx
index bf6849f..3f1529c 100644
--- a/Testing/Source/InformationObjectDefinition/Cxx/TestTableReader.cxx
+++ b/Testing/Source/InformationObjectDefinition/Cxx/TestTableReader.cxx
@@ -17,7 +17,7 @@
 // generated file:
 #include "gdcmTables.h"
 
-void TestReadTable(const char *filename)
+void TestReadTable(const char *filename, bool dump = false )
 {
   gdcm::Defs defs;
   gdcm::TableReader tr(defs);
@@ -26,12 +26,15 @@ void TestReadTable(const char *filename)
 
 
   const gdcm::Modules &modules = defs.GetModules();
+  if(dump)
   std::cout << modules << std::endl;
 
   const gdcm::Macros &macros = defs.GetMacros();
+  if(dump)
   std::cout << macros << std::endl;
 
   const gdcm::IODs &iods = defs.GetIODs();
+  if(dump)
   std::cout << iods << std::endl;
 }
 
@@ -40,7 +43,7 @@ int TestTableReader(int argc, char *argv[])
   if( argc == 2 )
     {
     const char *filename = argv[1];
-    TestReadTable(filename);
+    TestReadTable(filename, true);
     return 0;
     }
 
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestCurve2.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestCurve2.cxx
index 7d72976..9ba7894 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestCurve2.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestCurve2.cxx
@@ -135,7 +135,7 @@ static int TestCurve2Read(const char* filename, bool verbose = false)
       const char *buffer = (char*)&points[0];
       size_t len = sizeof(float) * 3 * npts;
       const char *ref = info[idx].datamd5;
-      gdcm::Testing::ComputeMD5(buffer, len, digest);
+      gdcm::Testing::ComputeMD5(buffer, (unsigned long)len, digest);
       if( verbose )
         {
         std::cout << "ref=" << ref << std::endl;
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx
index f0d8807..9182915 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader1.cxx
@@ -82,7 +82,7 @@ static int TestImageRegionRead(const char* filename, bool verbose = false)
   const char *ref = gdcm::Testing::GetMD5FromFile(filename);
 
   char digest[33];
-  gdcm::Testing::ComputeMD5(buffer, len, digest);
+  gdcm::Testing::ComputeMD5(buffer, (unsigned long)len, digest);
   if( verbose )
     {
     std::cout << "ref=" << ref << std::endl;
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader2.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader2.cxx
index fef2235..5a135bb 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader2.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestImageRegionReader2.cxx
@@ -88,7 +88,7 @@ static int TestImageRegionRead(const char* filename, bool verbose = false)
     of.write( buffer, len );
     of.close();
 #endif
-  gdcm::Testing::ComputeMD5(buffer, len, digest);
+  gdcm::Testing::ComputeMD5(buffer, (unsigned long)len, digest);
   if( verbose )
     {
     std::cout << "ref=" << ref << std::endl;
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestOverlay3.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestOverlay3.cxx
index fad5467..26c115d 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestOverlay3.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestOverlay3.cxx
@@ -77,7 +77,7 @@ static int TestReadOverlay(const char* filename, bool verbose = false)
         ++ret;
         }
       char digest1[33];
-      if( !gdcm::Testing::ComputeMD5(&overlay[0], len, digest1) )
+      if( !gdcm::Testing::ComputeMD5(&overlay[0], (unsigned long) len, digest1) )
         {
         std::cerr << "ComputeMD5: Problem with Overlay: #" << ovidx << std::endl;
         ++ret;
@@ -93,7 +93,7 @@ static int TestReadOverlay(const char* filename, bool verbose = false)
         ++ret;
         }
       char digest2[33];
-      if( !gdcm::Testing::ComputeMD5(soverlay2.c_str(), soverlay2.size(), digest2) )
+      if( !gdcm::Testing::ComputeMD5(soverlay2.c_str(), (unsigned long)soverlay2.size(), digest2) )
         {
         std::cerr << "ComputeMD5: Problem with Overlay: #" << ovidx << std::endl;
         ++ret;
diff --git a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
index 85a540b..4d6595b 100644
--- a/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
+++ b/Testing/Source/MediaStorageAndFileFormat/Cxx/TestPrinter1.cxx
@@ -279,7 +279,7 @@ int TestPrint(const char *filename, bool verbose= false)
       }
     }
   char digest[33];
-  gdcm::Testing::ComputeMD5(&buf[0], buf.size(), digest);
+  gdcm::Testing::ComputeMD5(&buf[0], (unsigned long)buf.size(), digest);
 
   unsigned int i = 0;
   const char *p = printmd5[i][1];
diff --git a/Utilities/VTK/Applications/gdcm2vtk.cxx b/Utilities/VTK/Applications/gdcm2vtk.cxx
index e35f375..a651242 100644
--- a/Utilities/VTK/Applications/gdcm2vtk.cxx
+++ b/Utilities/VTK/Applications/gdcm2vtk.cxx
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
       {
         gdcm::IPPSorter s;
         s.SetComputeZSpacing( true );
-        s.SetZSpacingTolerance( 1e-1 );
+        s.SetZSpacingTolerance( 1e-3 );
         bool b = s.Sort( files );
         if( !b )
           {
diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt
index 0320f3f..c6e451e 100644
--- a/Utilities/VTK/CMakeLists.txt
+++ b/Utilities/VTK/CMakeLists.txt
@@ -77,7 +77,7 @@ else()
     vtkRenderingFreeType
     vtkRenderingFreeTypeOpenGL
   )
-  if("${VTK_MAJOR_VERSION}" EQUAL 6)
+  if(("${VTK_MAJOR_VERSION}" EQUAL 6) OR ("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL"))
     list(APPEND vtkgdcm_COND_LIBS vtkRenderingOpenGL)
   else()
     list(APPEND vtkgdcm_COND_LIBS vtkRenderingOpenGL2)
diff --git a/Utilities/doxygen/CMakeLists.txt b/Utilities/doxygen/CMakeLists.txt
index 2fb9d92..7ace0c2 100644
--- a/Utilities/doxygen/CMakeLists.txt
+++ b/Utilities/doxygen/CMakeLists.txt
@@ -278,7 +278,7 @@ if(LIBXSLT_XSLTPROC_EXECUTABLE)
       if(DOCBOOK_REWRITE_PREFIX_FOUND)
         set(GDCM_MANPAGES_USE_NONET TRUE)
       else()
-        message(WARNING "Could not find the location of your docbook-xsl-ns installation. Please make sure your internet connection works.")
+        message(WARNING "Could not find the location of your docbook-xsl-ns installation. Please make sure your internet connection works. Or skip man pages generation: GDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF.")
       endif()
     else()
       message(STATUS "Could not find /etc/xml/catalog")
diff --git a/Utilities/doxygen/man/gdcmconv.xml b/Utilities/doxygen/man/gdcmconv.xml
index fae0b85..1a11c7d 100644
--- a/Utilities/doxygen/man/gdcmconv.xml
+++ b/Utilities/doxygen/man/gdcmconv.xml
@@ -372,7 +372,7 @@ When no option other is used, only the dataset is inspected. So encapsulated Pix
 <para>For dicom3tools use: dcdump</para>
 </listitem>
 </itemizedlist>
-For reference, gdcmconv –raw will act as dcmdjpeg +cn +px, since it never tries to convert color space.</para>
+For reference, gdcmconv --raw will act as dcmdjpeg +cn +px, since it never tries to convert color space.</para>
 </refsection>
 <refsection xml:id="gdcmconv_1vim">
 <title>VIM: vimdiff</title>
@@ -380,7 +380,7 @@ For reference, gdcmconv –raw will act as dcmdjpeg +cn +px, since it never
 <para>You can setup your favorite editor to compare the output, for instance in vim:</para>
 
 <para><literallayout><computeroutput>autocmd BufReadPre *.dcm set ro
-autocmd BufReadPost *.dcm silent %!dcmdump -M +uc "%"
+autocmd BufReadPost *.dcm silent %!dcmdump -M +uc "%"
 </computeroutput></literallayout></para>
 
 <para>then simply do:</para>
diff --git a/Utilities/doxygen/man/gdcmdump.xml b/Utilities/doxygen/man/gdcmdump.xml
index fb7d937..9a8223c 100644
--- a/Utilities/doxygen/man/gdcmdump.xml
+++ b/Utilities/doxygen/man/gdcmdump.xml
@@ -28,7 +28,7 @@ gdcmdump [options] dcm_directory
 
 <para>The <emphasis role="bold">gdcmdump</emphasis> command line program dumps a DICOM file to the console. For those familiar with dcmdump (DCMTK) output, gdcmdump has some minor differences. Namely: <itemizedlist>
 <listitem>
-<para>For Implicit Transfer Syntax gdcmdump will print <emphasis role="bold"></emphasis>?? instead of the dictionary VR</para>
+<para>For Implicit Transfer Syntax gdcmdump will print <emphasis role="bold">??</emphasis> instead of the dictionary VR</para>
 </listitem>
 </itemizedlist>
 gdcmdump has a limited private dictionary that is used to lookup private element whenever possible.</para>
@@ -94,7 +94,7 @@ dcm_directory   DICOM input directory
 <refsection xml:id="gdcmdump_1implicit">
 <title>Printing Implicit Transfer Syntax</title>
 
-<para>The VR are not found in the file, thus are presented with a "(??)", and right next to it (if found) the correct VR.</para>
+<para>The VR are not found in the file, thus are presented with a <quote>(??)</quote>, and right next to it (if found) the correct VR.</para>
 
 <para>Eg.:</para>
 
@@ -191,22 +191,22 @@ Image shadow data (0029,xx10)
 <para><literallayout>$ gdcmdump --pdb GE_MR_0025xx1bProtocolDataBlock.dcm
 </literallayout></para>
 
-<para><literallayout>ENTRY "Head First"
-POSITION "Supine"
-ANREF "NA"
-COIL "HEAD"
-PLANE "OBLIQUE"
-SEDESCFLAG "1"
-SEDESC "AX FSE T2"
-IMODE "2D"
-PSEQ "FSE-XL"
-IOPT "FC, EDR, TRF, Fast"
-PLUG "22"
-FILTCHOICE "None"
-BWRT "-1"
-TRICKSIMG "1"
-TAG_SPACE "7"
-TAG_TYPE "None"
+<para><literallayout>ENTRY "Head First"
+POSITION "Supine"
+ANREF "NA"
+COIL "HEAD"
+PLANE "OBLIQUE"
+SEDESCFLAG "1"
+SEDESC "AX FSE T2"
+IMODE "2D"
+PSEQ "FSE-XL"
+IOPT "FC, EDR, TRF, Fast"
+PLUG "22"
+FILTCHOICE "None"
+BWRT "-1"
+TRICKSIMG "1"
+TAG_SPACE "7"
+TAG_TYPE "None"
 ...
 </literallayout></para>
 </refsection>
diff --git a/Utilities/doxygen/man/gdcminfo.xml b/Utilities/doxygen/man/gdcminfo.xml
index a9dcaa4..e2e495b 100644
--- a/Utilities/doxygen/man/gdcminfo.xml
+++ b/Utilities/doxygen/man/gdcminfo.xml
@@ -158,7 +158,7 @@ Orientation Label: SAGITTAL
 <para><literallayout>$ gdcminfo --check-compression gdcmData/MAROTECH_CT_JP2Lossy.dcm
 </literallayout></para>
 
-<para>The tool returns: "Encapsulated Stream was found to be: lossy"</para>
+<para>The tool returns: <quote>Encapsulated Stream was found to be: lossy</quote></para>
 
 <para>Pay attention that this tool also checks the Image Lossy Compression attribute (0028,2110). This means <option>--check-compression</option> will also returns a value of lossy if a predecessor was found to be lossy compressed.</para>
 </refsection>
diff --git a/Utilities/doxygen/man/gdcmscu.xml b/Utilities/doxygen/man/gdcmscu.xml
index 022aaf7..faf8329 100644
--- a/Utilities/doxygen/man/gdcmscu.xml
+++ b/Utilities/doxygen/man/gdcmscu.xml
@@ -83,7 +83,7 @@
      --series            C-FIND Query on Series Info.
      --image             C-FIND Query on Image Info.
      --key   %d,%d[=%s]  0123,4567=VALUE for specifying search criteria (wildcard allowed)
-                         With --key, leave blank (ie, --key 10,20="" or --key 10,20) to retrieve values
+                         With --key, leave blank (ie, --key 10,20="" or --key 10,20) to retrieve values
 </literallayout></para>
 </refsection>
 <refsection xml:id="gdcmscu_1cmove_options">
@@ -181,17 +181,17 @@
 
 <para><emphasis role="bold">gdcmscu</emphasis> also allow querying a DICOM server. This is the C-FIND operation, for example to find all DICOM Instance where PatientsName match a particular pattern, usage is simply:</para>
 
-<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10,"A*"
+<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10,"A*"
 </literallayout></para>
 
 <para>We also support a DCMTK compatible convention:</para>
 
-<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="A*"
+<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="A*"
 </literallayout></para>
 
 <para>When an attribute is set without a value it will be part of the output result:</para>
 
-<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --call MI2B2 --patientroot -k 10,10="A*" -k 10,20
+<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --call MI2B2 --patientroot -k 10,10="A*" -k 10,20
 </literallayout></para>
 </refsection>
 <refsection xml:id="gdcmscu_1cmove_usage">
@@ -199,7 +199,7 @@
 
 <para>C-MOVE is the operation to retrieve a DICOM instance from a remote DICOM server. Most of the time, it is a subsequent operation after a C-FIND query. To retrieve a DICOM instance where PatientID is ABCD1234, simply execute:</para>
 
-<para><literallayout>$ gdcmscu --move --patient --aetitle ACME1 --call ACME_STORE dicom.example.com 5678 --patientroot -k 10,20="ABCD1234" --port-scp 1234
+<para><literallayout>$ gdcmscu --move --patient --aetitle ACME1 --call ACME_STORE dicom.example.com 5678 --patientroot -k 10,20="ABCD1234" --port-scp 1234
 </literallayout></para>
 
 <para>WARNING For this operation to work you need information from the DICOM server you are communicating with. Only the DICOM server you are sending a C-MOVE query will be responsible for sending back incoming associations (the actual C-STORE SCP). Therefore you need to make sure that you mapping of (AE-TITLE,PortNumber) is properly set on the DICOM server side as well as the port for incoming association (–port-scp).</para>
@@ -211,12 +211,12 @@
 
 <para>The flag –patientroot is just simply a wrapper around the syntax –key 8,52=PATIENT For instance one would write using DCMTK syntax:</para>
 
-<para><literallayout>$ findscu --patient dicom.example.com 11112 --key 8,52=PATIENT --key 10,10="F*"
+<para><literallayout>$ findscu --patient dicom.example.com 11112 --key 8,52=PATIENT --key 10,10="F*"
 </literallayout></para>
 
 <para>This would become using GDCM syntax:</para>
 
-<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="F*"
+<para><literallayout>$ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="F*"
 </literallayout></para>
 </refsection>
 <refsection xml:id="gdcmscu_1debugging">
@@ -276,7 +276,7 @@
 
 <para>It is also possible to store the query:</para>
 
-<para><literallayout>gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,20="*" --key 10,10 --store-query query.dcm
+<para><literallayout>gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,20="*" --key 10,10 --store-query query.dcm
 </literallayout></para>
 
 <para>One can then check the DataSet values send for the query:</para>
@@ -295,11 +295,11 @@
 (0010,0020) ?? (LO) [* ]                                          # 2,1 Patient ID
 </literallayout></para>
 
-<para>The Specific Character Set was set to "ISO_IR 192" as the locale encoding of the system was found automatically by gdcmscu to be UTF-8.</para>
+<para>The Specific Character Set was set to <quote>ISO_IR 192</quote> as the locale encoding of the system was found automatically by gdcmscu to be UTF-8.</para>
 
 <para>This means that the following command line will properly setup the Query with the appropriate Charset to be executed correctly:</para>
 
-<para><literallayout>$ gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,10="*Jérôme*"
+<para><literallayout>$ gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,10="*Jérôme*"
 </literallayout></para>
 
 <para>The query is always executed on the server side (SCP), some implementations does not support string matching with different Character Set.</para>
diff --git a/Utilities/doxygen/man/gdcmxml.xml b/Utilities/doxygen/man/gdcmxml.xml
index e91543d..ef6991d 100644
--- a/Utilities/doxygen/man/gdcmxml.xml
+++ b/Utilities/doxygen/man/gdcmxml.xml
@@ -47,13 +47,13 @@ file-out  output filename (can be absent)
 <refsection xml:id="gdcmxml_1options_dicom2xml">
 <title>Options for DICOM to XML:</title>
 
-<para><literallayout>  -B --loadBulkData   Loads bulk data into a binary file named "UUID" (by default UUID are written).
+<para><literallayout>  -B --loadBulkData   Loads bulk data into a binary file named "UUID" (by default UUID are written).
 </literallayout></para>
 </refsection>
 <refsection xml:id="gdcmxml_1options_xml2dicom">
 <title>Options for XML to DICOM:</title>
 
-<para><literallayout>  -B --loadBulkData   Loads bulk data from a binary file named as the "UUID" in XML file (by default UUID are written).
+<para><literallayout>  -B --loadBulkData   Loads bulk data from a binary file named as the "UUID" in XML file (by default UUID are written).
   -T --TransferSyntax Loads transfer syntax from file (default is LittleEndianImplicit)
 </literallayout></para>
 </refsection>
diff --git a/Utilities/gdcmjpeg/jdlhuff.c b/Utilities/gdcmjpeg/jdlhuff.c
index 2ee9f28..718ce9a 100644
--- a/Utilities/gdcmjpeg/jdlhuff.c
+++ b/Utilities/gdcmjpeg/jdlhuff.c
@@ -123,7 +123,7 @@ start_pass_lhuff_decoder (j_decompress_ptr cinfo)
 
 #ifdef AVOID_TABLES
 
-#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
+#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1u)<<(s)) + 1) : (x))
 
 #else
 
@@ -133,11 +133,11 @@ static const int extend_test[16] =   /* entry n is 2**(n-1) */
   { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
     0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
 
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+static const int extend_offset[16] = /* entry n is (-1u << n) + 1 */
+  { 0, ((-1u)<<1) + 1, ((-1u)<<2) + 1, ((-1u)<<3) + 1, ((-1u)<<4) + 1,
+    ((-1u)<<5) + 1, ((-1u)<<6) + 1, ((-1u)<<7) + 1, ((-1u)<<8) + 1,
+    ((-1u)<<9) + 1, ((-1u)<<10) + 1, ((-1u)<<11) + 1, ((-1u)<<12) + 1,
+    ((-1u)<<13) + 1, ((-1u)<<14) + 1, ((-1u)<<15) + 1 };
 
 #endif /* AVOID_TABLES */
 
diff --git a/Utilities/gdcmjpeg/jdphuff.c b/Utilities/gdcmjpeg/jdphuff.c
index a2389f8..26a94e7 100644
--- a/Utilities/gdcmjpeg/jdphuff.c
+++ b/Utilities/gdcmjpeg/jdphuff.c
@@ -201,7 +201,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
 
 #ifdef AVOID_TABLES
 
-#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
+#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1u)<<(s)) + 1) : (x))
 
 #else
 
@@ -211,11 +211,11 @@ static const int extend_test[16] =   /* entry n is 2**(n-1) */
   { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
     0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
 
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+static const int extend_offset[16] = /* entry n is (-1u << n) + 1 */
+  { 0, ((-1u)<<1) + 1, ((-1u)<<2) + 1, ((-1u)<<3) + 1, ((-1u)<<4) + 1,
+    ((-1u)<<5) + 1, ((-1u)<<6) + 1, ((-1u)<<7) + 1, ((-1u)<<8) + 1,
+    ((-1u)<<9) + 1, ((-1u)<<10) + 1, ((-1u)<<11) + 1, ((-1u)<<12) + 1,
+    ((-1u)<<13) + 1, ((-1u)<<14) + 1, ((-1u)<<15) + 1 };
 
 #endif /* AVOID_TABLES */
 
diff --git a/Utilities/gdcmjpeg/jdshuff.c b/Utilities/gdcmjpeg/jdshuff.c
index 66736a2..26ab707 100644
--- a/Utilities/gdcmjpeg/jdshuff.c
+++ b/Utilities/gdcmjpeg/jdshuff.c
@@ -146,7 +146,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
 
 #ifdef AVOID_TABLES
 
-#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
+#define HUFF_EXTEND(x,s)  ((x) < (1<<((s)-1)) ? (x) + (((-1u)<<(s)) + 1) : (x))
 
 #else
 
@@ -156,11 +156,11 @@ static const int extend_test[16] =   /* entry n is 2**(n-1) */
   { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
     0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
 
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+static const int extend_offset[16] = /* entry n is (-1u << n) + 1 */
+  { 0, ((-1u)<<1) + 1, ((-1u)<<2) + 1, ((-1u)<<3) + 1, ((-1u)<<4) + 1,
+    ((-1u)<<5) + 1, ((-1u)<<6) + 1, ((-1u)<<7) + 1, ((-1u)<<8) + 1,
+    ((-1u)<<9) + 1, ((-1u)<<10) + 1, ((-1u)<<11) + 1, ((-1u)<<12) + 1,
+    ((-1u)<<13) + 1, ((-1u)<<14) + 1, ((-1u)<<15) + 1 };
 
 #endif /* AVOID_TABLES */
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gdcm.git



More information about the debian-med-commit mailing list