[med-svn] [gdcm] 01/08: Imported Upstream version 2.6.4

Gert Wollny gert-guest at moszumanska.debian.org
Mon Jul 11 20:56:59 UTC 2016


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

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

commit cbde7d447c2df2b634c5162d9c113fa79985e779
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Sun Jul 3 20:55:08 2016 +0000

    Imported Upstream version 2.6.4
---
 .travis.yml                                        |  9 ++-
 Applications/Cxx/gdcmconv.cxx                      |  6 +-
 CMake/CTestCustom.ctest.in                         |  1 +
 CMakeLists.txt                                     | 20 ++++++-
 Examples/Cxx/DumpPhilipsECHO.cxx                   |  2 +-
 Source/Common/gdcmDirectory.cxx                    |  8 +--
 Source/Common/gdcmSystem.cxx                       |  4 ++
 Source/Common/zipstreamimpl.hpp                    | 18 ++++++
 Source/DataDictionary/gdcmGlobal.cxx               |  4 ++
 Source/DataDictionary/gdcmPrivateDefaultDicts.cxx  |  4 ++
 .../gdcmFileMetaInformation.cxx                    | 27 +++++++++
 .../gdcmDataSetHelper.cxx                          |  3 +-
 .../gdcmIconImageGenerator.cxx                     |  6 +-
 .../MediaStorageAndFileFormat/gdcmImageHelper.cxx  | 45 +++++++++++----
 .../MediaStorageAndFileFormat/gdcmImageWriter.cxx  | 10 ++++
 .../gdcmJPEG2000Codec.cxx                          | 46 ++++++++++++---
 .../MediaStorageAndFileFormat/gdcmPixmapReader.cxx | 12 +++-
 Source/MediaStorageAndFileFormat/gdcmPrinter.cxx   |  2 +-
 Source/MediaStorageAndFileFormat/gdcmRLECodec.cxx  |  4 +-
 Source/MediaStorageAndFileFormat/gdcmRLECodec.h    |  2 +-
 .../MediaStorageAndFileFormat/gdcmUIDGenerator.cxx |  2 +-
 .../Cxx/TestElement1.cxx                           |  2 +-
 Utilities/VTK/Applications/gdcm2vtk.cxx            | 66 ++++++++++++----------
 Utilities/VTK/Applications/gdcmviewer.cxx          | 57 +++++++++++++------
 Utilities/VTK/CMakeLists.txt                       | 33 ++++++++---
 Utilities/VTK/Examples/CMakeLists.txt              |  4 +-
 Utilities/VTK/Examples/Csharp/HelloVTKWorld.cs     |  3 +-
 Utilities/VTK/Examples/Csharp/HelloVTKWorld2.cs    |  6 +-
 Utilities/VTK/Examples/Cxx/Compute3DSpacing.cxx    |  6 ++
 Utilities/VTK/Examples/Cxx/gdcmorthoplanes.cxx     |  4 ++
 Utilities/VTK/Examples/Cxx/gdcmvolume.cxx          |  3 +
 Utilities/VTK/Examples/Java/HelloVTKWorld.java     |  4 +-
 Utilities/VTK/Examples/Java/MIPViewer.java         |  2 +-
 Utilities/VTK/Examples/Java/MPRViewer2.java        | 20 +++----
 Utilities/VTK/Examples/Java/ReadSeriesIntoVTK.java |  2 +-
 Utilities/VTK/Testing/CMakeLists.txt               |  4 +-
 .../VTK/Testing/Cxx/TestvtkGDCMImageReader1.cxx    |  4 ++
 .../VTK/Testing/Cxx/TestvtkGDCMImageReader2_3.cxx  |  4 ++
 .../Testing/Cxx/TestvtkGDCMImageReaderIsLossy.cxx  |  4 ++
 .../VTK/Testing/Cxx/TestvtkGDCMImageWriter1.cxx    |  4 ++
 .../VTK/Testing/Cxx/TestvtkGDCMImageWriter2.cxx    |  4 ++
 Utilities/VTK/VTK4/vtkMedicalImageProperties.cxx   |  4 ++
 Utilities/VTK/VTK4/vtkMedicalImageProperties.h     |  4 ++
 Utilities/VTK/VTK4/vtkStringArray.cxx              |  4 ++
 Utilities/VTK/VTK4/vtkStringArray.h                |  4 ++
 Utilities/VTK/vtkGDCMImageReader.cxx               |  4 ++
 Utilities/VTK/vtkGDCMImageReader.h                 |  4 ++
 Utilities/VTK/vtkGDCMImageReader2.cxx              |  4 ++
 Utilities/VTK/vtkGDCMImageReader2.h                |  4 ++
 Utilities/VTK/vtkGDCMImageWriter.cxx               |  8 +++
 Utilities/VTK/vtkGDCMImageWriter.h                 |  4 ++
 Utilities/VTK/vtkGDCMMedicalImageProperties.cxx    |  4 ++
 Utilities/VTK/vtkGDCMMedicalImageProperties.h      |  4 ++
 Utilities/VTK/vtkGDCMPolyDataReader.cxx            |  4 ++
 Utilities/VTK/vtkGDCMPolyDataReader.h              |  4 ++
 Utilities/VTK/vtkGDCMPolyDataWriter.cxx            |  4 ++
 Utilities/VTK/vtkGDCMPolyDataWriter.h              |  4 ++
 Utilities/VTK/vtkGDCMTesting.cxx                   |  4 ++
 Utilities/VTK/vtkGDCMTesting.h                     |  4 ++
 Utilities/VTK/vtkGDCMThreadedImageReader.cxx       |  4 ++
 Utilities/VTK/vtkGDCMThreadedImageReader.h         |  4 ++
 Utilities/VTK/vtkGDCMThreadedImageReader2.cxx      |  4 ++
 Utilities/VTK/vtkGDCMThreadedImageReader2.h        |  4 ++
 Utilities/VTK/vtkImageColorViewer.cxx              |  4 ++
 Utilities/VTK/vtkImageColorViewer.h                |  4 ++
 Utilities/VTK/vtkImageMapToColors16.cxx            |  4 ++
 Utilities/VTK/vtkImageMapToColors16.h              |  4 ++
 Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx  |  4 ++
 Utilities/VTK/vtkImageMapToWindowLevelColors2.h    |  4 ++
 .../VTK/vtkImagePlanarComponentsToComponents.cxx   |  4 ++
 .../VTK/vtkImagePlanarComponentsToComponents.h     |  5 ++
 Utilities/VTK/vtkImageRGBToYBR.cxx                 |  4 ++
 Utilities/VTK/vtkImageRGBToYBR.h                   |  4 ++
 Utilities/VTK/vtkImageYBRToRGB.cxx                 |  4 ++
 Utilities/VTK/vtkImageYBRToRGB.h                   |  4 ++
 Utilities/VTK/vtkLookupTable16.cxx                 |  4 ++
 Utilities/VTK/vtkLookupTable16.h                   |  4 ++
 Utilities/VTK/vtkRTStructSetProperties.cxx         |  4 ++
 Utilities/VTK/vtkRTStructSetProperties.h           |  4 ++
 Utilities/VTK/vtkgdcm.py                           |  6 +-
 Utilities/doxygen/CMakeLists.txt                   | 36 ++++++++++--
 Utilities/doxygen/doxyfile.in                      |  2 +-
 Utilities/doxygen/vtk/CMakeLists.txt               |  3 +-
 Utilities/gdcm_charls.h                            |  3 +-
 Utilities/gdcmcharls/encoderstrategy.h             | 12 +++-
 Utilities/socketxx/socket++/local.h                |  2 +-
 Utilities/socketxx/socket++/sockstream.h           |  2 +-
 .../wxWidgets/wxVTKRenderWindowInteractor.cxx      |  4 ++
 Utilities/wxWidgets/wxVTKRenderWindowInteractor.h  |  4 ++
 Wrapping/Java/CMakeLists.txt                       |  2 +-
 Wrapping/Java/gdcm.i                               |  9 +++
 Wrapping/Python/Python.h.in                        |  2 +-
 appveyor.yml                                       |  4 +-
 93 files changed, 580 insertions(+), 139 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 5657d4b..b2a00c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ matrix:
         - B_NAME=default
     - compiler: gcc
       os: linux
-      addons: {apt: {packages: [default-jdk, mono-devel, swig, libcharls-dev, libvtk5-dev, libopenjpeg-dev, libexpat-dev, libz-dev, uuid-dev, python-all-dev, libpoppler-dev, xsltproc, dcmtk]}}
+      addons: {apt: {packages: [default-jdk, mono-devel, swig, libcharls-dev, libvtk5-dev, libopenjpeg-dev, libexpat-dev, libz-dev, uuid-dev, python-all-dev, libpoppler-dev, xsltproc, docbook-xsl, dcmtk]}}
       env:
         - CFLAGS="-Wall -Wextra -m64"
         - CXXFLAGS="-Wall -Wextra -m64"
@@ -50,8 +50,11 @@ before_install:
   #- env
   - cmake --version
   #- swig -version
-  # do not run the full test suite for now
-  - mv Testing/Data Testing/Data.old
+  # do not run the full test suite for now on fsanitize and osx (takes too long)
+  - 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
+  # 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
   - if [ "$B_NAME" == "system" ]; then export PATH=$PATH:$PWD/KDU77_Demo_Apps_for_Linux-x86-64_150710; fi
diff --git a/Applications/Cxx/gdcmconv.cxx b/Applications/Cxx/gdcmconv.cxx
index 46eef7d..d0a04f8 100644
--- a/Applications/Cxx/gdcmconv.cxx
+++ b/Applications/Cxx/gdcmconv.cxx
@@ -1174,7 +1174,7 @@ int main (int argc, char *argv[])
         if( quality )
           {
           assert( qualities.size() == 1 );
-          jpegcodec.SetQuality( qualities[0] );
+          jpegcodec.SetQuality( static_cast<double>(qualities[0]) );
           }
         change.SetUserCodec( &jpegcodec );
         }
@@ -1210,7 +1210,7 @@ int main (int argc, char *argv[])
           int i = 0;
           for(std::vector<float>::const_iterator it = rates.begin(); it != rates.end(); ++it )
             {
-            j2kcodec.SetRate(i++, *it );
+            j2kcodec.SetRate(i++, static_cast<double>(*it) );
             }
           }
         if( quality )
@@ -1218,7 +1218,7 @@ int main (int argc, char *argv[])
           int i = 0;
           for(std::vector<float>::const_iterator it = qualities.begin(); it != qualities.end(); ++it )
             {
-            j2kcodec.SetQuality( i++, *it );
+            j2kcodec.SetQuality( i++, static_cast<double>(*it) );
             }
           }
         if( tile )
diff --git a/CMake/CTestCustom.ctest.in b/CMake/CTestCustom.ctest.in
index 604cd66..67db969 100644
--- a/CMake/CTestCustom.ctest.in
+++ b/CMake/CTestCustom.ctest.in
@@ -27,6 +27,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
   "/usr/bin/ld: warning: libavformat.so.52" #needed by libvtkIO.so, may conflict with libavformat.so.53
   "/usr/bin/ld: warning: libavutil.so.49" # needed by .*libvtkIO.so, may conflict with libavutil.so.51
   "/usr/bin/ld: warning: libswscale.so.0" # needed by .*libvtkIO.so, may conflict with libswscale.so.2
+  "CUSTOMBUILD : warning CS1668: Invalid search path" # appveyor ?
   )
 
 # Disable dynamic analysis on some tests:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5175ff..dc053b8 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 3)
+set(GDCM_BUILD_VERSION 4)
 set(GDCM_VERSION
   "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
 # let advanced user the option to define GDCM_API_VERSION:
@@ -523,9 +523,13 @@ if(GDCM_STANDALONE)
   mark_as_advanced(GDCM_USE_ACTIVIZ)
   option(GDCM_USE_JPEGLS "Build GDCM with JPEG-LS support" ON)
   mark_as_advanced(GDCM_USE_JPEGLS)
+  if(NOT DEFINED GDCM_DEFAULT_JAVA_VERSION)
+    # override with cmake -DGDCM_DEFAULT_JAVA_VERSION:STRING=1.5 if you dare
+    set(GDCM_DEFAULT_JAVA_VERSION 1.7)
+  endif()
   if(GDCM_WRAP_JAVA)
-    set(GDCM_JAVA_SOURCE_VERSION "1.7" CACHE STRING "javac source version")
-    set(GDCM_JAVA_TARGET_VERSION "1.7" CACHE STRING "javac target version")
+    set(GDCM_JAVA_SOURCE_VERSION "${GDCM_DEFAULT_JAVA_VERSION}" CACHE STRING "javac source version")
+    set(GDCM_JAVA_TARGET_VERSION "${GDCM_DEFAULT_JAVA_VERSION}" CACHE STRING "javac target version")
     mark_as_advanced(GDCM_JAVA_SOURCE_VERSION GDCM_JAVA_TARGET_VERSION)
   endif()
   if(GDCM_WRAP_CSHARP)
@@ -554,6 +558,16 @@ if(WIN32)
 endif()
 #-----------------------------------------------------------------------------
 
+# Add a target so that the documentation can be build from the
+# root dir
+if(GDCM_DOCUMENTATION)
+  if(NOT DEFINED GDCM_SKIP_DOXYGENDOC_ALL_RULE)
+    add_custom_target(DoxygenDoc ALL)
+  else()
+    add_custom_target(DoxygenDoc)
+  endif()
+endif()
+
 # Need to subdirs in Source/Common before Wrapping
 # to have gdcmConfigure.h around
 subdirs(Utilities)
diff --git a/Examples/Cxx/DumpPhilipsECHO.cxx b/Examples/Cxx/DumpPhilipsECHO.cxx
index 60e1fb6..f938a26 100644
--- a/Examples/Cxx/DumpPhilipsECHO.cxx
+++ b/Examples/Cxx/DumpPhilipsECHO.cxx
@@ -79,7 +79,7 @@ static bool ProcessDeflate( const char *outfilename, const int nslices, const
     }
 
   std::istringstream is;
-  is.str( std::string( buf, len ) );
+  is.str( std::string( buf, (size_t)len ) );
 
   std::streamoff totalsize;
   is.read( (char*)&totalsize, sizeof( totalsize ));
diff --git a/Source/Common/gdcmDirectory.cxx b/Source/Common/gdcmDirectory.cxx
index dfb65d4..e470e8a 100644
--- a/Source/Common/gdcmDirectory.cxx
+++ b/Source/Common/gdcmDirectory.cxx
@@ -52,8 +52,8 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
   Directories.push_back( dirName );
 #ifdef _MSC_VER
   WIN32_FIND_DATA fileData;
-  dirName.append("/");
-  assert( dirName[dirName.size()-1] == '/' );
+  if ('/' != dirName[dirName.size()-1]) dirName.push_back('/');
+  assert( '/' == dirName[dirName.size()-1] );
   const FilenameType firstfile = dirName+"*";
   HANDLE hFile = FindFirstFile(firstfile.c_str(), &fileData);
 
@@ -104,8 +104,8 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
 
   struct stat buf;
   dirent *d;
-  dirName.append("/");
-  assert( dirName[dirName.size()-1] == '/' );
+  if ('/' != dirName[dirName.size()-1]) dirName.push_back('/');
+  assert( '/' == dirName[dirName.size()-1] );
   for (d = readdir(dir); d; d = readdir(dir))
     {
     fileName = dirName + d->d_name;
diff --git a/Source/Common/gdcmSystem.cxx b/Source/Common/gdcmSystem.cxx
index c975cdb..e608b57 100644
--- a/Source/Common/gdcmSystem.cxx
+++ b/Source/Common/gdcmSystem.cxx
@@ -361,6 +361,10 @@ bool System::DeleteDirectory(const char *source)
   return Rmdir(source) == 0;
 }
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 // return size of file; also returns zero if no file exists
 size_t System::FileSize(const char* filename)
 {
diff --git a/Source/Common/zipstreamimpl.hpp b/Source/Common/zipstreamimpl.hpp
index c36f314..09792c4 100644
--- a/Source/Common/zipstreamimpl.hpp
+++ b/Source/Common/zipstreamimpl.hpp
@@ -533,6 +533,11 @@ basic_unzip_streambuf<charT, traits>::fill_input_buffer(void)
 // PUBLIC
 //-----------------------------------------------------------------------------
 
+#if defined(_MSC_VER)
+# pragma warning (push)
+# pragma warning (disable:4355)
+#endif
+
 /**
  */
 template <class charT, class traits> inline
@@ -553,6 +558,10 @@ basic_zip_ostream<charT, traits>::basic_zip_ostream(ostream_reference ostream,
         add_header();
 }
 
+#if defined(_MSC_VER)
+# pragma warning (pop)
+#endif
+
 /** Destructor
  */
 template <class charT, class traits>
@@ -658,6 +667,11 @@ basic_zip_ostream<charT,traits>& basic_zip_ostream<charT, traits>::add_footer(vo
 // PUBLIC
 //-----------------------------------------------------------------------------
 
+#if defined(_MSC_VER)
+# pragma warning (push)
+# pragma warning (disable:4355)
+#endif
+
 /** Constructor
  */
 template <class charT, class traits>
@@ -679,6 +693,10 @@ basic_zip_istream<charT, traits>::basic_zip_istream(istream_reference istream,
     }
 }
 
+#if defined(_MSC_VER)
+# pragma warning (pop)
+#endif
+
 /** returns true if it is a gzip file
  */
 template <class charT, class traits> inline
diff --git a/Source/DataDictionary/gdcmGlobal.cxx b/Source/DataDictionary/gdcmGlobal.cxx
index 54d2c93..bf51747 100644
--- a/Source/DataDictionary/gdcmGlobal.cxx
+++ b/Source/DataDictionary/gdcmGlobal.cxx
@@ -133,6 +133,10 @@ bool Global::Prepend(const char *path)
   return true;
 }
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 const char *Global::Locate(const char *resfile) const
 {
 #ifdef _WIN32
diff --git a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
index fd5b719..102a6ae 100644
--- a/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
+++ b/Source/DataDictionary/gdcmPrivateDefaultDicts.cxx
@@ -37,6 +37,10 @@ typedef struct
 } DICT_ENTRY;
 
 static const DICT_ENTRY DICOMV3DataDict [] = {
+  {0x0857,0x0000,"Nautilus Medical",VR::LO,VM::VM1,"?",false },
+  {0x0857,0x0001,"Nautilus Medical",VR::LO,VM::VM1,"?Source Application Entity Title?",false },
+  {0x0857,0x0002,"Nautilus Medical",VR::LO,VM::VM1,"?",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 },
   {0x7501,0x0001,"CoActiv_PvtTags",VR::LO,VM::VM1,"?",false },
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmFileMetaInformation.cxx b/Source/DataStructureAndEncodingDefinition/gdcmFileMetaInformation.cxx
index b2687ad..0e8f5de 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmFileMetaInformation.cxx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmFileMetaInformation.cxx
@@ -526,6 +526,7 @@ std::istream &FileMetaInformation::Read(std::istream &is)
   //ExplicitAttribute<0x0002,0x0000> metagl;
   //metagl.Read(is);
 
+  std::streampos start = is.tellg();
   // TODO: Can now load data from std::ios::cur to std::ios::cur + metagl.GetValue()
 
   ExplicitDataElement xde;
@@ -545,10 +546,36 @@ std::istream &FileMetaInformation::Read(std::istream &is)
 //#endif
   Insert( xde );
   // See PS 3.5, Data Element Structure With Explicit VR
+  try {
+  // GDCM is a hack, so let's read all possible group 2 element, until the last one
+  // and leave the group length value aside.
   while( ReadExplicitDataElement<SwapperNoOp>(is, xde ) )
     {
     Insert( xde );
     }
+  }
+  catch( std::exception & ex )
+  {
+(void)ex;
+    // we've read a little bit too much. We are possibly in the case where an
+    // implicit dataelement with group 2 (technically impossible) was found
+    // (first dataelement). Let's start over again, but this time use group
+    // length as the sentinel for the last group 2 element:
+  is.seekg(start,std::ios::beg);
+  // Group Length:
+  ReadExplicitDataElement<SwapperNoOp>(is, xde );
+
+  Attribute<0x0002, 0x0000> filemetagrouplength;
+  filemetagrouplength.SetFromDataElement( xde );
+  const unsigned int glen = filemetagrouplength.GetValue();
+
+  unsigned int cur_len = 0;
+    while( cur_len < glen && ReadExplicitDataElement<SwapperNoOp>(is, xde ) )
+   {
+    Insert( xde );
+    cur_len += xde.GetLength();
+    }
+  }
 
   // Now is a good time to compute the transfer syntax:
   ComputeDataSetTransferSyntax();
diff --git a/Source/MediaStorageAndFileFormat/gdcmDataSetHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmDataSetHelper.cxx
index 81293bc..04830fe 100644
--- a/Source/MediaStorageAndFileFormat/gdcmDataSetHelper.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmDataSetHelper.cxx
@@ -180,7 +180,8 @@ VR DataSetHelper::ComputeVR(File const &file, DataSet const &ds, const Tag& tag)
     else // ( pixeldata == t  )
       {
       // For Pixel Data:
-      assert( ds.FindDataElement( bitsallocated ) );
+      if( !ds.FindDataElement( bitsallocated ) )
+        return VR::UN;
       Attribute<0x0028,0x0100> at;
       at.SetFromDataElement( ds.GetDataElement( bitsallocated ) );
       }
diff --git a/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx b/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
index 1bfb5e3..561a215 100644
--- a/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmIconImageGenerator.cxx
@@ -117,7 +117,7 @@ Retrieved from: http://en.literateprograms.org/Median_cut_algorithm_(C_Plus_Plus
     Point* points;
     int pointsLength;
   public:
-    Block(Point* points, int pointsLength);
+    Block(Point* points, std::ptrdiff_t pointsLength);
     Point * getPoints();
     int numPoints() const;
     int longestSideIndex() const;
@@ -138,11 +138,11 @@ Retrieved from: http://en.literateprograms.org/Median_cut_algorithm_(C_Plus_Plus
 
   //std::list<Point> medianCut(Point* image, int numPoints, unsigned int desiredSize);
 
-  Block::Block(Point* pts, int ptslen)
+  Block::Block(Point* pts, std::ptrdiff_t ptslen)
     {
     assert( ptslen > 0 );
     this->points = pts;
-    this->pointsLength = ptslen;
+    this->pointsLength = (int)ptslen;
     for(int i=0; i < NUM_DIMENSIONS; i++)
       {
       minCorner.x[i] = std::numeric_limits<unsigned char>::min();
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
index 72109a0..549c209 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
@@ -49,12 +49,12 @@ bool ImageHelper::ForceRescaleInterceptSlope = false;
 bool ImageHelper::PMSRescaleInterceptSlope = true;
 bool ImageHelper::ForcePixelSpacing = false;
 
-bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &ori)
+static bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &ori)
 {
   if( !ds.FindDataElement( tfgs ) ) return false;
   //const SequenceOfItems * sqi = ds.GetDataElement( tfgs ).GetSequenceOfItems();
   SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( tfgs ).GetValueAsSQ();
-  assert( sqi );
+  if( !(sqi && sqi->GetNumberOfItems() > 0) ) return false;
   // Get first item:
   const Item &item = sqi->GetItem(1);
   const DataSet & subds = item.GetNestedDataSet();
@@ -81,12 +81,12 @@ bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<
   return true;
 }
 
-bool GetDirectionCosinesValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &dircos)
+static bool GetDirectionCosinesValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &dircos)
 {
   if( !ds.FindDataElement( tfgs ) ) return false;
   //const SequenceOfItems * sqi = ds.GetDataElement( tfgs ).GetSequenceOfItems();
   SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( tfgs ).GetValueAsSQ();
-  assert( sqi );
+  if( !(sqi && sqi->GetNumberOfItems() > 0) ) return false;
   // Get first item:
   const Item &item = sqi->GetItem(1);
   const DataSet & subds = item.GetNestedDataSet();
@@ -116,12 +116,12 @@ bool GetDirectionCosinesValueFromSequence(const DataSet& ds, const Tag& tfgs, st
   return true;
 }
 
-bool GetInterceptSlopeValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &intslope)
+static bool GetInterceptSlopeValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &intslope)
 {
   if( !ds.FindDataElement( tfgs ) ) return false;
   //const SequenceOfItems * sqi = ds.GetDataElement( tfgs ).GetSequenceOfItems();
   SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( tfgs ).GetValueAsSQ();
-  assert( sqi );
+  if( !(sqi && sqi->GetNumberOfItems() > 0) ) return false;
   // Get first item:
   const Item &item = sqi->GetItem(1);
   const DataSet & subds = item.GetNestedDataSet();
@@ -160,7 +160,7 @@ bool GetInterceptSlopeValueFromSequence(const DataSet& ds, const Tag& tfgs, std:
   return true;
 }
 
-bool ComputeZSpacingFromIPP(const DataSet &ds, double &zspacing)
+static bool ComputeZSpacingFromIPP(const DataSet &ds, double &zspacing)
 {
   // first we need to get the direction cosines:
   const Tag t1(0x5200,0x9229);
@@ -279,7 +279,7 @@ bool ComputeZSpacingFromIPP(const DataSet &ds, double &zspacing)
 }
 
 // EnhancedMRImageStorage & EnhancedCTImageStorage
-bool GetSpacingValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &sp)
+static bool GetSpacingValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &sp)
 {
   //  (0028,9110) SQ (Sequence with undefined length #=1)     # u/l, 1 PixelMeasuresSequence
   //      (fffe,e000) na (Item with undefined length #=2)         # u/l, 1 Item
@@ -292,7 +292,7 @@ bool GetSpacingValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector
   if( !ds.FindDataElement( tfgs ) ) return false;
   //const SequenceOfItems * sqi = ds.GetDataElement( tfgs ).GetSequenceOfItems();
   SmartPointer<SequenceOfItems> sqi = ds.GetDataElement( tfgs ).GetValueAsSQ();
-  assert( sqi );
+  if( !(sqi && sqi->GetNumberOfItems() > 0) ) return false;
   // Get first item:
   const Item &item = sqi->GetItem(1);
   const DataSet & subds = item.GetNestedDataSet();
@@ -339,7 +339,7 @@ bool GetSpacingValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector
 }
 
 // UltrasoundMultiframeImageStorage
-bool GetUltraSoundSpacingValueFromSequence(const DataSet& ds, std::vector<double> &sp)
+static bool GetUltraSoundSpacingValueFromSequence(const DataSet& ds, std::vector<double> &sp)
 {
 /*
 (0018,6011) SQ (Sequence with explicit length #=1)      # 196, 1 SequenceOfUltrasoundRegions
@@ -421,6 +421,7 @@ std::vector<double> ImageHelper::GetOriginValue(File const & f)
    || ms == MediaStorage::OphthalmicTomographyImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
     const Tag t1(0x5200,0x9229);
@@ -541,6 +542,7 @@ std::vector<double> ImageHelper::GetDirectionCosinesValue(File const & f)
    || ms == MediaStorage::EnhancedPETImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
     const Tag t1(0x5200,0x9229);
@@ -836,6 +838,12 @@ void ImageHelper::SetDimensionsValue(File& f, const Pixmap & img)
         gdcmAssertAlwaysMacro( "Could not set third dimension" );
       }
     }
+    else if( img.GetNumberOfDimensions() == 2 && dims[2] == 1 )
+    {
+      // This is a MF instances, need to set Number of Frame to 1
+      if( ms.MediaStorage::GetModalityDimension() > 2 )
+        ds.Replace( numframes.GetAsDataElement() );
+    }
     else // cleanup
       ds.Remove( numframes.GetTag() );
   }
@@ -845,6 +853,7 @@ void ImageHelper::SetDimensionsValue(File& f, const Pixmap & img)
    || ms == MediaStorage::EnhancedPETImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
       const Tag tfgs(0x5200,0x9230);
@@ -868,6 +877,7 @@ std::vector<double> ImageHelper::GetRescaleInterceptSlopeValue(File const & f)
   if( ms == MediaStorage::EnhancedCTImageStorage
    || ms == MediaStorage::EnhancedMRImageStorage
    || ms == MediaStorage::EnhancedPETImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
     const Tag t1(0x5200,0x9229);
@@ -1010,6 +1020,7 @@ Tag ImageHelper::GetSpacingTagFromMediaStorage(MediaStorage const &ms)
   // Enhanced stuff are handled elsewere... look carefully :)
   //case MediaStorage::EnhancedMRImageStorage:
   //case MediaStorage::EnhancedCTImageStorage:
+  //case MediaStorage::XRay3DAngiographicImageStorage
   //  gdcmWarningMacro( "Enhanced image are not currently supported. Spacing will be wrong" );
   case MediaStorage::CTImageStorage:
   case MediaStorage::MRImageStorage:
@@ -1169,6 +1180,7 @@ std::vector<double> ImageHelper::GetSpacingValue(File const & f)
     || ms == MediaStorage::OphthalmicTomographyImageStorage
     || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
     || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+    || ms == MediaStorage::XRay3DAngiographicImageStorage
     || ms == MediaStorage::SegmentationStorage )
     {
     // <entry group="5200" element="9230" vr="SQ" vm="1" name="Per-frame Functional Groups Sequence"/>
@@ -1437,6 +1449,7 @@ void ImageHelper::SetSpacingValue(DataSet & ds, const std::vector<double> & spac
    || ms == MediaStorage::EnhancedPETImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
 /*
@@ -1746,6 +1759,7 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
    && ms != MediaStorage::SegmentationStorage
    && ms != MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    && ms != MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   && ms != MediaStorage::XRay3DAngiographicImageStorage
    && ms != MediaStorage::EnhancedMRImageStorage
    && ms != MediaStorage::EnhancedPETImageStorage
    && ms != MediaStorage::EnhancedCTImageStorage )
@@ -1757,6 +1771,7 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
   if( ms == MediaStorage::EnhancedCTImageStorage
    || ms == MediaStorage::EnhancedMRImageStorage
    || ms == MediaStorage::EnhancedPETImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
    || ms == MediaStorage::SegmentationStorage )
@@ -1801,11 +1816,13 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)
     if( ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
         || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage )
     {
+      if( dimz > 1 ) {
       Attribute<0x0028,0x0009> fip;
       fip.SetNumberOfValues( 1 );
       fip.SetValue( tfgs );
       ds.Replace( fip.GetAsDataElement() );
     }
+    }
 
     return;
     }
@@ -1841,6 +1858,7 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
    && ms != MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    && ms != MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
    && ms != MediaStorage::SegmentationStorage
+   && ms != MediaStorage::XRay3DAngiographicImageStorage
    && ms != MediaStorage::EnhancedMRImageStorage
    && ms != MediaStorage::EnhancedPETImageStorage
    && ms != MediaStorage::EnhancedCTImageStorage )
@@ -1873,6 +1891,7 @@ void ImageHelper::SetDirectionCosinesValue(DataSet & ds, const std::vector<doubl
    || ms == MediaStorage::EnhancedPETImageStorage
    || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage
    || ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
    || ms == MediaStorage::SegmentationStorage )
     {
 /*
@@ -1977,6 +1996,7 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
    && ms != MediaStorage::EnhancedMRImageStorage
    && ms != MediaStorage::EnhancedCTImageStorage
    && ms != MediaStorage::EnhancedPETImageStorage
+   && ms != MediaStorage::XRay3DAngiographicImageStorage
    && ms != MediaStorage::SegmentationStorage )
     {
     if( img.GetIntercept() != 0. || img.GetSlope() != 1. )
@@ -1990,6 +2010,7 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
   if( ms == MediaStorage::EnhancedCTImageStorage
    || ms == MediaStorage::EnhancedMRImageStorage
    || ms == MediaStorage::EnhancedPETImageStorage
+   || ms == MediaStorage::XRay3DAngiographicImageStorage
   )
     {
 /*
@@ -2049,10 +2070,10 @@ void ImageHelper::SetRescaleInterceptSlopeValue(File & f, const Image & img)
 
         Attribute<0x0028,0x1052> at1;
         at1.SetValue( img.GetIntercept() );
-        subds2.Insert( at1.GetAsDataElement() );
+        subds2.Replace( at1.GetAsDataElement() );
         Attribute<0x0028,0x1053> at2;
         at2.SetValue( img.GetSlope() );
-        subds2.Insert( at2.GetAsDataElement() );
+        subds2.Replace( at2.GetAsDataElement() );
       }
 
     // cleanup per-frame
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx b/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
index eea541a..3a7d4d5 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageWriter.cxx
@@ -57,6 +57,16 @@ MediaStorage ImageWriter::ComputeTargetMediaStorage()
         PixelData->GetPhotometricInterpretation(),
         GetImage().GetIntercept(), GetImage().GetSlope() );
   }
+  // double check for Grayscale since they need specific pixel type
+  if( ms == MediaStorage::MultiframeGrayscaleByteSecondaryCaptureImageStorage
+   || ms == MediaStorage::MultiframeGrayscaleWordSecondaryCaptureImageStorage )
+  {
+    ms = ImageHelper::ComputeMediaStorageFromModality( ms.GetModality(),
+        PixelData->GetNumberOfDimensions(),
+        PixelData->GetPixelFormat(),
+        PixelData->GetPhotometricInterpretation(),
+        GetImage().GetIntercept(), GetImage().GetSlope() );
+  }
   return ms;
 }
 
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
index 51d4e15..3025621 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
@@ -78,6 +78,10 @@ void info_callback(const char *msg, void *) {
 #define RAW_DFMT 15
 #define TGA_DFMT 16
 #define PNG_DFMT 17
+#define CODEC_JP2 OPJ_CODEC_JP2
+#define CODEC_J2K OPJ_CODEC_J2K
+#define CLRSPC_GRAY OPJ_CLRSPC_GRAY
+#define CLRSPC_SRGB OPJ_CLRSPC_SRGB
 #endif // OPENJPEG_MAJOR_VERSION == 1
 
 #if OPENJPEG_MAJOR_VERSION == 2
@@ -190,7 +194,7 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create_memory_stream (myfile* p_mem,OPJ_UI
   {
     return 00;
   }
-  opj_stream_set_user_data(l_stream,p_mem);
+  opj_stream_set_user_data(l_stream,p_mem,NULL);
   opj_stream_set_read_function(l_stream,(opj_stream_read_fn) opj_read_from_memory);
   opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from_memory);
   opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_memory);
@@ -320,10 +324,10 @@ bool JPEG2000Codec::Decode(DataElement const &in, DataElement &out)
       std::stringstream is;
       size_t j2kbv_len = j2kbv->GetLength();
       char *mybuffer = new char[j2kbv_len];
-      bool b = j2kbv->GetBuffer(mybuffer, j2kbv_len);
-      assert( b );
+      bool b = j2kbv->GetBuffer(mybuffer, (unsigned long)j2kbv_len);
       if( b ) is.write(mybuffer, j2kbv_len);
       delete[] mybuffer;
+      if( !b ) return false;
 
       try {
         sf_bug->Read<SwapperNoOp>(is,true);
@@ -371,7 +375,7 @@ bool JPEG2000Codec::Decode(DataElement const &in, DataElement &out)
       const Fragment &frag = sf->GetFragment(i);
       if( frag.IsEmpty() ) return false;
       const ByteValue *bv = frag.GetByteValue();
-      assert( bv );
+      if( !bv ) return false;
       size_t bv_len = bv->GetLength();
       char *mybuffer = new char[bv_len];
       bv->GetBuffer(mybuffer, bv->GetLength());
@@ -534,13 +538,18 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
   s[1] = 0;
   opj_set_error_handler(dinfo, gdcm_error_callback, s);
 
+#ifdef OPJ_J2K_STREAM_CHUNK_SIZE
+  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE, true);
+#else
   cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE, true);
+#endif
 
   /* setup the decoder decoding parameters using user parameters */
   opj_setup_decoder(dinfo, &parameters);
   bool bResult;
   OPJ_INT32 l_tile_x0,l_tile_y0;
   OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y;
+#if 0
   bResult = opj_read_header(
     dinfo,
     &image,
@@ -551,17 +560,27 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
     &l_nb_tiles_x,
     &l_nb_tiles_y,
     cio);
+#else
+  bResult = opj_read_header(
+    cio,
+    dinfo,
+    &image);
+#endif
   assert( bResult );
 
 #if OPENJPEG_MAJOR_VERSION == 1
 #else
+#if 0
   // needs to be before call to opj_decode...
   reversible = opj_get_reversible(dinfo, &parameters );
   assert( reversible == 0 || reversible == 1 );
+#else
+  reversible = 0;
+#endif
 #endif
 
-  image = opj_decode(dinfo, cio);
-  //assert( image );
+  bResult = opj_decode(dinfo, cio,image);
+  assert( bResult );
   bResult = bResult && (image != 00);
   bResult = bResult && opj_end_decompress(dinfo,cio);
   if (!image || !check_comp_valid(image) )
@@ -1050,7 +1069,7 @@ bool JPEG2000Codec::CodeFrameIntoBuffer(char * outdata, size_t outlen, size_t &
 
   /* open a byte stream for writing */
   /* allocate memory for all tiles */
-  cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE,false);
+  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE,false);
   if (! cio)
     {
     return false;
@@ -1277,13 +1296,14 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
   // the hack is not used when reading meta-info of a j2k stream:
   opj_set_error_handler(dinfo, gdcm_error_callback, NULL);
 
-  cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE, true);
+  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE, true);
 
   /* setup the decoder decoding parameters using user parameters */
   opj_setup_decoder(dinfo, &parameters);
   bool bResult;
   OPJ_INT32 l_tile_x0,l_tile_y0;
   OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y;
+#if 0
   bResult = opj_read_header(
     dinfo,
     &image,
@@ -1294,6 +1314,12 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
     &l_nb_tiles_x,
     &l_nb_tiles_y,
     cio);
+#else
+  bResult = opj_read_header(
+    cio,
+    dinfo,
+    &image);
+#endif
   //image = opj_decode(dinfo, cio);
   //bResult = bResult && (image != 00);
   //bResult = bResult && opj_end_decompress(dinfo,cio);
@@ -1331,10 +1357,14 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
     return false;
     }
 #else
+#if 0
   reversible = opj_get_reversible(dinfo, &parameters );
   assert( reversible == 0 || reversible == 1 );
   // FIXME
   assert( mct == 0 || mct == 1 );
+#else
+  reversible = 0;
+#endif
 #endif // OPENJPEG_MAJOR_VERSION == 1
   LossyFlag = !reversible;
 
diff --git a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
index 6336093..b87eaed 100644
--- a/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmPixmapReader.cxx
@@ -1034,8 +1034,18 @@ bool PixmapReader::ReadImageInternal(MediaStorage const &ms, bool handlepixeldat
           v[0] = jpeg.GetDimensions()[0];
           v[1] = jpeg.GetDimensions()[1];
           PixelData->SetDimensions( &v[0] );
-          //PixelData->SetPixelFormat( jpeg.GetPixelFormat() );
+          //PixelData->SetPixelFormat( jpeg.GetPixelFormat() ); // need to handle carefully
+          if( PixelData->GetPixelFormat().GetSamplesPerPixel() != jpeg.GetPixelFormat().GetSamplesPerPixel() )
+          {
+          gdcmDebugMacro( "Fix samples per pixel." );
+          PixelData->GetPixelFormat().SetSamplesPerPixel( jpeg.GetPixelFormat().GetSamplesPerPixel() );
+          }
           //PixelData->SetPhotometricInterpretation( jpeg.GetPhotometricInterpretation() );
+          if( PixelData->GetPhotometricInterpretation().GetSamplesPerPixel() != jpeg.GetPhotometricInterpretation().GetSamplesPerPixel() )
+          {
+          gdcmDebugMacro( "Fix photometric interpretation." );
+          PixelData->SetPhotometricInterpretation( jpeg.GetPhotometricInterpretation() );
+          }
           assert( PixelData->IsTransferSyntaxCompatible( ts ) );
           }
         else
diff --git a/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx b/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx
index 00b2271..6cd4108 100644
--- a/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx
@@ -898,7 +898,7 @@ void Printer::PrintDataSet(const DataSet &ds, std::ostream &out, std::string con
     if( refvr == VR::SQ /*|| sqi*/ )
       {
       //SmartPointer<SequenceOfItems> sqi2 = DataSetHelper::ComputeSQFromByteValue( *F, ds, de.GetTag() );
-      SmartPointer<SequenceOfItems> sqi2 = de.GetValueAsSQ();
+      SmartPointer<SequenceOfItems> sqi2 = de.GetValueAsSQ(); // may throw
       PrintSQ(sqi2, os, indent);
       /*
       const SequenceOfItems *sqi = de.GetSequenceOfItems();
diff --git a/Source/MediaStorageAndFileFormat/gdcmRLECodec.cxx b/Source/MediaStorageAndFileFormat/gdcmRLECodec.cxx
index 157432f..d2baa1f 100644
--- a/Source/MediaStorageAndFileFormat/gdcmRLECodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmRLECodec.cxx
@@ -557,7 +557,7 @@ bool RLECodec::Code(DataElement const &in, DataElement &out)
 // Endif
 // Endloop
 
-size_t RLECodec::DecodeFragment(Fragment const & frag, char *buffer, unsigned long llen)
+size_t RLECodec::DecodeFragment(Fragment const & frag, char *buffer, size_t llen)
 {
 
   std::stringstream is;
@@ -636,7 +636,7 @@ bool RLECodec::Decode(DataElement const &in, DataElement &out)
       return false;
     }
     char *buffer = new char[len];
-    const unsigned long llen = len / nframes;
+    const std::size_t llen = len / nframes;
     // assert( GetNumberOfDimensions() == 2
     //      || GetDimension(2) == sf->GetNumberOfFragments() );
     bool corruption = false;
diff --git a/Source/MediaStorageAndFileFormat/gdcmRLECodec.h b/Source/MediaStorageAndFileFormat/gdcmRLECodec.h
index 70c6eeb..2e72d21 100644
--- a/Source/MediaStorageAndFileFormat/gdcmRLECodec.h
+++ b/Source/MediaStorageAndFileFormat/gdcmRLECodec.h
@@ -79,7 +79,7 @@ private:
   RLEInternals *Internals;
   unsigned long Length;
   unsigned long BufferLength;
-  size_t DecodeFragment(Fragment const & frag, char *buffer, unsigned long llen);
+  size_t DecodeFragment(Fragment const & frag, char *buffer, size_t llen);
 };
 
 } // end namespace gdcm
diff --git a/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx b/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
index dc18652..e46d0b6 100644
--- a/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
@@ -83,7 +83,7 @@ struct fnv_hash
 
     while( pFirst < pLast )
       {
-      nHashVal ^= *pFirst++,
+      nHashVal ^= *pFirst++;
       nHashVal *= nMagicPrime;
       }
 
diff --git a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement1.cxx b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement1.cxx
index 52eaf67..ae5b19b 100644
--- a/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement1.cxx
+++ b/Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestElement1.cxx
@@ -88,7 +88,7 @@ int TestAS()
 
 int TestUL()
 {
-  const char array[4] = {-78, 1, 0, 0}; // 434
+  const signed char array[4] = {-78, 1, 0, 0}; // 434
   {
   Element<VR::UL, VM::VM1> a;
   // reinterpret_cast< const Element<VR::UL, VM::VM1>& > ( array );
diff --git a/Utilities/VTK/Applications/gdcm2vtk.cxx b/Utilities/VTK/Applications/gdcm2vtk.cxx
index 4841dce..e35f375 100644
--- a/Utilities/VTK/Applications/gdcm2vtk.cxx
+++ b/Utilities/VTK/Applications/gdcm2vtk.cxx
@@ -29,7 +29,7 @@
 #include "vtkPNMWriter.h"
 #include "vtkBMPWriter.h"
 #include "vtkImageChangeInformation.h"
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
 #include "vtkMetaImageReader.h"
 #include "vtkXMLImageDataReader.h"
 #include "vtkMetaImageWriter.h"
@@ -64,6 +64,12 @@
 
 #include <getopt.h>
 
+#if VTK_MAJOR_VERSION >= 6
+#ifndef vtkFloatingPointType
+#define vtkFloatingPointType double
+#endif
+#endif
+
 void PrintVersion()
 {
   std::cout << "gdcm2vtk: gdcm " << gdcm::Version::GetVersion() << " ";
@@ -439,13 +445,13 @@ int main(int argc, char *argv[])
 
   vtkGDCMImageReader *gdcmreader = vtkGDCMImageReader::New();
 
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   vtkDICOMImageReader *dicomreader = vtkDICOMImageReader::New();
 #endif
   if( debug )
     {
     gdcmreader->DebugOn();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     dicomreader->DebugOn();
 #endif
     }
@@ -459,7 +465,7 @@ int main(int argc, char *argv[])
   d->Delete();
 #endif
   if( usevtkdicom )
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     imgfactory->RegisterReader( dicomreader );
 #else
     (void)0;
@@ -507,7 +513,7 @@ int main(int argc, char *argv[])
     if( ippsort )
     {
       const vtkFloatingPointType *spacing = imgreader->GetOutput()->GetSpacing();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       v16->SetInputConnection( imgreader->GetOutputPort() );
 #else
       v16->SetInput( imgreader->GetOutput() );
@@ -550,13 +556,13 @@ int main(int argc, char *argv[])
       vtkStructuredPointsWriter * writer = vtkStructuredPointsWriter::New();
       writer->SetFileName( outfilename );
       writer->SetFileTypeToBinary();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -570,13 +576,13 @@ int main(int argc, char *argv[])
       {
       vtkBMPWriter * writer = vtkBMPWriter::New();
       writer->SetFileName( outfilename );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -592,13 +598,13 @@ int main(int argc, char *argv[])
       {
       vtkPNMWriter * writer = vtkPNMWriter::New();
       writer->SetFileName( outfilename );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -612,13 +618,13 @@ int main(int argc, char *argv[])
       {
       vtkPNGWriter * writer = vtkPNGWriter::New();
       writer->SetFileName( outfilename );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -633,13 +639,13 @@ int main(int argc, char *argv[])
       {
       vtkTIFFWriter * writer = vtkTIFFWriter::New();
       writer->SetFileName( outfilename );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -654,13 +660,13 @@ int main(int argc, char *argv[])
       vtkXMLImageDataWriter * writer = vtkXMLImageDataWriter::New();
       writer->SetFileName( outfilename );
       writer->SetDataModeToBinary();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
 #endif
       writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       if( writer->GetErrorCode() )
         {
         std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -670,7 +676,7 @@ int main(int argc, char *argv[])
       writer->Delete();
       goto cleanup;
       }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     else if(  gdcm::System::StrCaseCmp(outputextension,".mha") == 0 ||
               gdcm::System::StrCaseCmp(outputextension,".mhd") == 0  ) // vtkMetaImageReader::GetFileExtensions()
       {
@@ -679,7 +685,7 @@ int main(int argc, char *argv[])
       // worse I cannot even set the transform ! Which means Reader -> Writer just breaks everything -sigh-
       vtkMetaImageWriter * writer = vtkMetaImageWriter::New();
       writer->SetFileName( outfilename );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       writer->SetInputData( imgdata );
 #else
       writer->SetInput( imgdata );
@@ -772,13 +778,13 @@ int main(int argc, char *argv[])
       std::cout << "alpha channel will be lost " << imgreader->GetOutput()->GetNumberOfScalarComponents() << std::endl;
       }
     vtkImageExtractComponents *extract = vtkImageExtractComponents::New();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     extract->SetInputConnection( imgreader->GetOutputPort() );
 #else
     extract->SetInput( imgreader->GetOutput() );
 #endif
     extract->SetComponents( 0,1,2 );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     writer->SetInputConnection( extract->GetOutputPort() );
 #else
     writer->SetInput( extract->GetOutput() );
@@ -788,7 +794,7 @@ int main(int argc, char *argv[])
   else
     {
     //writer->SetInput( imgreader->GetOutput() );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     writer->SetInputData( imgdata );
 #else
     writer->SetInput( imgdata );
@@ -824,7 +830,7 @@ int main(int argc, char *argv[])
         reader0->GetMedicalImageProperties()->Print( std::cout );
         }
       }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     else if( vtkDICOMImageReader * reader1 = vtkDICOMImageReader::SafeDownCast(imgreader) )
       {
       const float* iop = reader1->GetImageOrientationPatient();
@@ -838,7 +844,7 @@ int main(int argc, char *argv[])
       //writer->GetMedicalImageProperties()->SetStudyUID( reader1->GetStudyUID() ); // TODO
       writer->GetMedicalImageProperties()->SetStudyID( reader1->GetStudyID() );
       //writer->GetMedicalImageProperties()->SetGantryTilt( reader1->GetGantryAngle() ); // TODO
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 2
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 2)
       writer->GetMedicalImageProperties()->SetDirectionCosine( dircos[0],
         dircos[1],
         dircos[2],
@@ -877,12 +883,12 @@ int main(int argc, char *argv[])
       }
     else if( vtkGESignaReader * reader4 = vtkGESignaReader::SafeDownCast(imgreader) )
       {
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       writer->SetMedicalImageProperties( reader4->GetMedicalImageProperties() );
 #endif
       //reader4->GetMedicalImageProperties()->Print( std::cout );
       }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     else if( vtkMINCImageReader *reader5 = vtkMINCImageReader::SafeDownCast( imgreader ) )
       {
       writer->SetDirectionCosines( reader5->GetDirectionCosines() );
@@ -900,11 +906,11 @@ int main(int argc, char *argv[])
       // For some reason vtkTIFFReader is all skrew up and will load the image in whatever orientation
       // as stored on file, thus this is up to the user to set it properly...
       // If anyone has any clue why...
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
       reader6->SetOrientationType( ORIENTATION_BOTLEFT );
 #endif
       }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     else if( vtkMetaImageReader *reader7 = vtkMetaImageReader::SafeDownCast( imgreader ) )
       {
 //  vtkGetMacro(RescaleSlope, double);
@@ -984,7 +990,7 @@ int main(int argc, char *argv[])
     }
 
   writer->Write();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   if( writer->GetErrorCode() )
     {
     std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
@@ -1003,7 +1009,7 @@ cleanup:
   xmlreader->Delete();
   datareader->Delete();
   gdcmreader->Delete();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   dicomreader->Delete();
 #endif
 
diff --git a/Utilities/VTK/Applications/gdcmviewer.cxx b/Utilities/VTK/Applications/gdcmviewer.cxx
index 57facd6..ae89ade 100644
--- a/Utilities/VTK/Applications/gdcmviewer.cxx
+++ b/Utilities/VTK/Applications/gdcmviewer.cxx
@@ -39,7 +39,7 @@
 #include "vtkImageMapToWindowLevelColors.h"
 #include "vtkImageActor.h"
 #include "vtkWindowToImageFilter.h"
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
 #include "vtkImageMapToColors16.h"
 #include "vtkBalloonWidget.h"
 #include "vtkBalloonRepresentation.h"
@@ -88,6 +88,13 @@ class vtkAngleWidget;
 
 #include <getopt.h>
 #include <assert.h>
+
+#if VTK_MAJOR_VERSION >= 6
+#ifndef vtkFloatingPointType
+#define vtkFloatingPointType double
+#endif
+#endif
+
 //----------------------------------------------------------------------------
 // vtkImageViewer2 new interface wants SetSlice, but vtkImageViewer does not have
 // this new interface (what a pain), so let's fake a new interface to
@@ -95,7 +102,11 @@ class vtkAngleWidget;
 class vtkGDCMImageViewer : public vtkImageViewer
 {
 public:
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMImageViewer,vtkImageViewer);
+#else
+  vtkTypeMacro(vtkGDCMImageViewer,vtkImageViewer);
+#endif
 
   static vtkGDCMImageViewer *New()
     {
@@ -118,7 +129,11 @@ public:
   double GetOverlayVisibility() { return 0; }
   void SetOverlayVisibility(double vis) {(void)vis;}
 };
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMImageViewer, "$Revision: 1.30 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMImageViewer, "$Revision: 1.30 $")
+#endif
 vtkInstantiatorNewMacro(vtkGDCMImageViewer)
 
 #if VTK_MAJOR_VERSION >= 5
@@ -126,7 +141,11 @@ vtkInstantiatorNewMacro(vtkGDCMImageViewer)
 class vtkImageColorViewer : public vtkImageViewer2
 {
 public:
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageColorViewer,vtkImageViewer2);
+#else
+  vtkTypeMacro(vtkImageColorViewer,vtkImageViewer2);
+#endif
 
   static vtkImageColorViewer *New()
     {
@@ -164,7 +183,11 @@ public:
 private:
   vtkImageActor                   *OverlayImageActor;
 };
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageColorViewer, "$Revision: 1.30 $")
+#else
+//vtkCxxRevisionMacro(vtkImageColorViewer, "$Revision: 1.30 $")
+#endif
 vtkInstantiatorNewMacro(vtkImageColorViewer)
 #endif
 
@@ -213,7 +236,7 @@ public:
           vtkPNGWriter * writer = vtkPNGWriter::New();
           vtkWindowToImageFilter * w2i = vtkWindowToImageFilter::New();
           w2i->SetInput( rwi->GetRenderWindow() );
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
           writer->SetInputConnection( w2i->GetOutputPort() );
 #else
           writer->SetInput( w2i->GetOutput() );
@@ -224,7 +247,7 @@ public:
           w2i->Delete();
           //std::cerr << "Screenshort saved to snapshot.png" << std::endl;
           }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
         else if ( keycode == 'l' )
           {
           IconWidget->Off();
@@ -251,7 +274,7 @@ public:
 #endif
         else
           {
-#if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
+#if VTK_MAJOR_VERSION >= 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5)
           int max = ImageViewer->GetSliceMax();
           int slice = (ImageViewer->GetSlice() + 1) % ++max;
           ImageViewer->SetSlice( slice );
@@ -292,7 +315,7 @@ public:
 
 int verbose;
 
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
 class vtkBalloonCallback : public vtkCommand
 {
 public:
@@ -390,7 +413,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
     viewer->AddInputConnection ( reader->GetOverlayPort(0) );
     }
   // TODO: Icon can be added using the vtkLogoWidget
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   vtkPointHandleRepresentation2D *handle = vtkPointHandleRepresentation2D::New();
   handle->GetProperty()->SetColor(1,0,0);
   vtkDistanceRepresentation2D *drep = vtkDistanceRepresentation2D::New();
@@ -514,7 +537,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
   // MONOCHROME1 is also implemented with a lookup table
   if( reader->GetImageFormat() == VTK_LOOKUP_TABLE || reader->GetImageFormat() == VTK_INVERSE_LUMINANCE )
     {
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     assert( reader->GetOutput()->GetPointData()->GetScalars()
       && reader->GetOutput()->GetPointData()->GetScalars()->GetLookupTable() );
 #endif
@@ -525,11 +548,11 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
       // This must be a Segmented Palette and on VTK 4.4 this is not supported
       std::cerr << "Not implemented. You will not see the Color LUT" << std::endl;
       }
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
     if( lut->IsA( "vtkLookupTable16" ) )
       {
       vtkImageMapToColors16 *map = vtkImageMapToColors16::New ();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       map->SetInputConnection (reader->GetOutputPort());
 #else
       map->SetInput (reader->GetOutput());
@@ -545,7 +568,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
         }
       map->Update();
       map->GetOutput()->GetScalarRange(range);
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       viewer->SetInputConnection( map->GetOutputPort() );
 #else
       viewer->SetInput( map->GetOutput() );
@@ -556,7 +579,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
 #endif
       {
       vtkImageMapToColors *map = vtkImageMapToColors::New ();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       map->SetInputConnection (reader->GetOutputPort());
 #else
       map->SetInput (reader->GetOutput());
@@ -572,7 +595,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
         }
       map->Update();
       map->GetOutput()->GetScalarRange(range);
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
       viewer->SetInputConnection( map->GetOutputPort() );
 #else
       viewer->SetInput( map->GetOutput() );
@@ -584,14 +607,14 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
     {
 #if VTK_MAJOR_VERSION >= 5
     vtkImageYBRToRGB *filter = vtkImageYBRToRGB::New();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     filter->SetInputConnection( reader->GetOutputPort() );
 #else
     filter->SetInput( reader->GetOutput() );
 #endif
     filter->Update();
     filter->GetOutput()->GetScalarRange(range);
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     viewer->SetInputConnection( filter->GetOutputPort() );
 #else
     viewer->SetInput( filter->GetOutput() );
@@ -618,7 +641,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
   if( reader->GetCurve() )
     {
     vtkPolyDataMapper2D * rectMapper = vtkPolyDataMapper2D::New();
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION >= 6
     rectMapper->SetInputData( reader->GetCurve() );
 #else
     rectMapper->SetInput( reader->GetCurve() );
@@ -699,7 +722,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
   // Here is where we setup the observer,
   vtkGDCMObserver<TViewer> *obs = vtkGDCMObserver<TViewer>::New();
   obs->ImageViewer = viewer;
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   if(iconwidget) iconwidget->On();
   obs->IconWidget = iconwidget;
   obs->DistanceWidget = dwidget;
@@ -742,7 +765,7 @@ void ExecuteViewer(TViewer *viewer, vtkStringArray *filenames)
 #endif
 
   reader->Delete();
-#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0)
   cbk->Delete();
   dwidget->Off();
   balloonwidget->Off();
diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt
index e8eb0c8..563e0b2 100644
--- a/Utilities/VTK/CMakeLists.txt
+++ b/Utilities/VTK/CMakeLists.txt
@@ -76,8 +76,12 @@ else()
     vtkRenderingCore
     vtkRenderingFreeType
     vtkRenderingFreeTypeOpenGL
-    vtkRenderingOpenGL
   )
+  if("${VTK_MAJOR_VERSION}" EQUAL 6)
+    list(APPEND vtkgdcm_COND_LIBS vtkRenderingOpenGL)
+  else()
+    list(APPEND vtkgdcm_COND_LIBS vtkRenderingOpenGL2)
+  endif()
   foreach(TMP_LIB ${VTK_LIBRARIES})
     foreach(TRY_LIB ${vtkgdcm_COND_LIBS})
       if("${TMP_LIB}" STREQUAL "${TRY_LIB}")
@@ -636,14 +640,13 @@ if(GDCM_WRAP_JAVA)
     find_package(JNI REQUIRED)
     include_directories(${JNI_INCLUDE_DIRS})
     set(VTK_WRAP_JAVA3_INIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-    # Lars Matth�us patch (package vtk => imply vtk subdir )
+    # Lars Matthaus patch (package vtk => imply vtk subdir )
     set(VTK_JAVA_HOME ${CMAKE_CURRENT_BINARY_DIR}/java/vtk)
     # This is *required* don't ask
     file(MAKE_DIRECTORY ${VTK_JAVA_HOME})
     include(${VTK_CMAKE_DIR}/vtkWrapJava.cmake)
     include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
-    VTK_WRAP_JAVA3(${VTKGDCM_NAME}Java vtkgdcmJAVA_SRCS "${vtkgdcm_SRCS}")
     # libvtk-java is a pain to handle...
     if(EXISTS ${VTK_JAVA_JAR})
       # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=533193
@@ -660,9 +663,7 @@ if(GDCM_WRAP_JAVA)
     endif()
     mark_as_advanced(GDCM_VTK_JAVA_JAR)
     if(EXISTS ${GDCM_VTK_JAVA_JAR})
-    else()
-      message(FATAL_ERROR "Could not find vtk.jar file, VTK_JAVA_JAR is wrong: ${VTK_JAVA_JAR}, please set proper GDCM_VTK_JAVA_JAR: ${GDCM_VTK_JAVA_JAR} replacement var")
-    endif()
+    VTK_WRAP_JAVA3(${VTKGDCM_NAME}Java vtkgdcmJAVA_SRCS "${vtkgdcm_SRCS}")
     add_library(${VTKGDCM_NAME}Java SHARED ${vtkgdcmJAVA_SRCS})
     # special jnilib extension:
     if(APPLE)
@@ -670,9 +671,13 @@ if(GDCM_WRAP_JAVA)
     endif()
     target_link_libraries(${VTKGDCM_NAME}Java ${VTKGDCM_NAME})
     set_property(TARGET ${VTKGDCM_NAME}Java PROPERTY NO_SONAME 1)
-    foreach(c ${vtkgdcm_LIBS})
-      target_link_libraries(${VTKGDCM_NAME}Java ${c}Java)
-    endforeach()
+    # By default link those module since APPLE and WIN32 needs fully resolved
+    # shared lib allow advanced users to skip the link step:
+    if(NOT GDCM_NO_VTKJAVA_LIBS_LINKING)
+      foreach(c ${vtkgdcm_LIBS})
+        target_link_libraries(${VTKGDCM_NAME}Java ${c}Java)
+      endforeach()
+    endif()
     # Create the jar file:
     # I am pretty sure this *.java thingy will bite me one day, when someone will try
     # to recompile from an existing build tree with invalid generated *.java file...
@@ -718,6 +723,10 @@ if(GDCM_WRAP_JAVA)
       )
     endif()
 
+
+    else()
+      message(WARNING "Could not find vtk.jar file, VTK_JAVA_JAR is wrong: ${VTK_JAVA_JAR}, please set proper GDCM_VTK_JAVA_JAR: ${GDCM_VTK_JAVA_JAR} replacement var")
+    endif()
   else()
     message(STATUS "GDCM_WRAP_JAVA canot be build without VTK_WRAP_JAVA")
   endif()
@@ -758,6 +767,12 @@ if(GDCM_WRAP_PYTHON)
     set_property(TARGET ${VTKGDCM_NAME}PythonD PROPERTY LINK_INTERFACE_LIBRARIES "")
     set_property(TARGET ${VTKGDCM_NAME}Python PROPERTY NO_SONAME 1)
     #set_property(TARGET ${VTKGDCM_NAME}PythonD PROPERTY NO_SONAME 1)
+    # Removing lib prefix if we are at VTK7. Based on a reply by David Gobbi to
+    # this Thread
+    # http://vtk.1045678.n5.nabble.com/python-wrapping-with-VTK-7-td5737442.html
+    if( "${VTK_MAJOR_VERSION}" GREATER 6 )
+      set_target_properties(${VTKGDCM_NAME}Python PROPERTIES PREFIX "")
+    endif()
     # Python extension modules on Windows must have the extension ".pyd"
     # instead of ".dll" as of Python 2.5.  Older python versions do support
     # this suffix.
diff --git a/Utilities/VTK/Examples/CMakeLists.txt b/Utilities/VTK/Examples/CMakeLists.txt
index 503d069..0cee6f2 100644
--- a/Utilities/VTK/Examples/CMakeLists.txt
+++ b/Utilities/VTK/Examples/CMakeLists.txt
@@ -7,6 +7,8 @@ endif()
 
 if(GDCM_WRAP_JAVA)
   if(VTK_WRAP_JAVA)
-    subdirs(Java)
+    if(EXISTS ${GDCM_VTK_JAVA_JAR})
+      subdirs(Java)
+    endif()
   endif()
 endif()
diff --git a/Utilities/VTK/Examples/Csharp/HelloVTKWorld.cs b/Utilities/VTK/Examples/Csharp/HelloVTKWorld.cs
index 19437ff..433c7d8 100644
--- a/Utilities/VTK/Examples/Csharp/HelloVTKWorld.cs
+++ b/Utilities/VTK/Examples/Csharp/HelloVTKWorld.cs
@@ -45,8 +45,7 @@ public class HelloVTKWorld
     writer.SetScale( reader.GetScale() );
     writer.SetImageFormat( reader.GetImageFormat() );
     writer.SetFileName( outfilename );
-    //writer.SetInputConnection( reader.GetOutputPort() ); // new
-    writer.SetInput( reader.GetOutput() ); // old
+    writer.SetInputConnection( reader.GetOutputPort() );
     writer.Write();
 
     return 0;
diff --git a/Utilities/VTK/Examples/Csharp/HelloVTKWorld2.cs b/Utilities/VTK/Examples/Csharp/HelloVTKWorld2.cs
index b5145ac..db26f19 100644
--- a/Utilities/VTK/Examples/Csharp/HelloVTKWorld2.cs
+++ b/Utilities/VTK/Examples/Csharp/HelloVTKWorld2.cs
@@ -30,15 +30,15 @@ public class HelloVTKWorld2
     reader.SetDataSpacing(3.2, 3.2, 1.5);
 
     vtkImageCast cast = vtkImageCast.New();
-    cast.SetInput( reader.GetOutput() );
+    cast.SetInputConnection( reader.GetOutputPort() );
     cast.SetOutputScalarTypeToUnsignedChar();
 
     // By default this is creating a Multiframe Grayscale Word Secondary Capture Image Storage
     vtkGDCMImageWriter writer = vtkGDCMImageWriter.New();
     writer.SetFileName( "headsq.dcm" );
-    writer.SetInput( reader.GetOutput() );
+    writer.SetInputConnection( reader.GetOutputPort() );
     // cast -> Multiframe Grayscale Byte Secondary Capture Image Storage
-    // writer.SetInput( cast.GetOutput() );
+    // writer.SetInputConnection( cast.GetOutputPort() );
     writer.SetFileDimensionality( 3 );
     writer.Write();
 
diff --git a/Utilities/VTK/Examples/Cxx/Compute3DSpacing.cxx b/Utilities/VTK/Examples/Cxx/Compute3DSpacing.cxx
index d37deb9..bb16596 100644
--- a/Utilities/VTK/Examples/Cxx/Compute3DSpacing.cxx
+++ b/Utilities/VTK/Examples/Cxx/Compute3DSpacing.cxx
@@ -16,6 +16,12 @@
 #include "vtkStringArray.h"
 #include "gdcmIPPSorter.h"
 
+#if VTK_MAJOR_VERSION >= 6
+#ifndef vtkFloatingPointType
+#define vtkFloatingPointType double
+#endif
+
+#endif
 /*
  * Simple example to check computation of spacing within vtkGDCMImageReader2
  * This is a direct implementation of:
diff --git a/Utilities/VTK/Examples/Cxx/gdcmorthoplanes.cxx b/Utilities/VTK/Examples/Cxx/gdcmorthoplanes.cxx
index d86101a..4a6d504 100644
--- a/Utilities/VTK/Examples/Cxx/gdcmorthoplanes.cxx
+++ b/Utilities/VTK/Examples/Cxx/gdcmorthoplanes.cxx
@@ -51,7 +51,11 @@
 #include "gdcmIPPSorter.h"
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/Examples/Cxx/gdcmvolume.cxx b/Utilities/VTK/Examples/Cxx/gdcmvolume.cxx
index 4d67dc9..0ed429e 100644
--- a/Utilities/VTK/Examples/Cxx/gdcmvolume.cxx
+++ b/Utilities/VTK/Examples/Cxx/gdcmvolume.cxx
@@ -11,12 +11,15 @@
      PURPOSE.  See the above copyright notice for more information.
 
 =========================================================================*/
+#include "vtkVersion.h"
 #include "vtkGDCMImageReader.h"
 #include "vtkPiecewiseFunction.h"
 #include "vtkColorTransferFunction.h"
 #include "vtkVolume.h"
 #include "vtkVolumeProperty.h"
+#if VTK_MAJOR_VERSION < 7
 #include "vtkVolumeTextureMapper3D.h"
+#endif
 #include "vtkFixedPointVolumeRayCastMapper.h"
 #include "vtkInteractorStyleTrackballCamera.h"
 #include "vtkRenderer.h"
diff --git a/Utilities/VTK/Examples/Java/HelloVTKWorld.java b/Utilities/VTK/Examples/Java/HelloVTKWorld.java
index cc047bb..240fd43 100644
--- a/Utilities/VTK/Examples/Java/HelloVTKWorld.java
+++ b/Utilities/VTK/Examples/Java/HelloVTKWorld.java
@@ -87,8 +87,8 @@ public class HelloVTKWorld
     writer.SetScale( reader.GetScale() );
     writer.SetImageFormat( reader.GetImageFormat() );
     writer.SetFileName( outfilename );
-    //writer.SetInputConnection( reader.GetOutputPort() ); // new
-    writer.SetInput( reader.GetOutput() ); // old
+    writer.SetInputConnection( reader.GetOutputPort() ); // new
+    //writer.SetInput( reader.GetOutput() ); // old
     writer.Write();
 
     System.out.println("Success reading: " + filename );
diff --git a/Utilities/VTK/Examples/Java/MIPViewer.java b/Utilities/VTK/Examples/Java/MIPViewer.java
index e79f620..d33126e 100644
--- a/Utilities/VTK/Examples/Java/MIPViewer.java
+++ b/Utilities/VTK/Examples/Java/MIPViewer.java
@@ -117,7 +117,7 @@ public class MIPViewer extends Canvas
     vtkBoxWidget box = new vtkBoxWidget();
     box.SetInteractor(iren);
     box.SetPlaceFactor(1.01);
-    box.SetInput(change.GetOutput());
+    box.SetInputConnection(change.GetOutputPort());
 
     //box.SetDefaultRenderer(renderer);
     box.InsideOutOn();
diff --git a/Utilities/VTK/Examples/Java/MPRViewer2.java b/Utilities/VTK/Examples/Java/MPRViewer2.java
index 9c86c53..34cf3cd 100644
--- a/Utilities/VTK/Examples/Java/MPRViewer2.java
+++ b/Utilities/VTK/Examples/Java/MPRViewer2.java
@@ -122,13 +122,13 @@ public class MPRViewer2
     double oy = origin[1];
     double oz = origin[2];
 
-    int wextent[] = image.GetWholeExtent();
-    int xMin = wextent[0];
-    int xMax = wextent[1];
-    int yMin = wextent[2];
-    int yMax = wextent[3];
-    int zMin = wextent[4];
-    int zMax = wextent[5];
+    int dims[] = image.GetDimensions();
+    int xMin = 0;
+    int xMax = 1;
+    int yMin = 2;
+    int yMax = dims[0]-1;
+    int zMin = dims[1]-1;
+    int zMax = dims[2]-1;
 
     double[] spacing = image.GetSpacing();
     double sx = spacing[0];
@@ -251,7 +251,7 @@ public class MPRViewer2
     //planeWidgetX.GetPlaneProperty().SetColor(1,0,0);
     //planeWidgetX.TextureInterpolateOff();
     //planeWidgetX.SetResliceInterpolateToNearestNeighbour();
-    planeWidgetX.SetInput(change.GetOutput());
+    planeWidgetX.SetInputConnection(change.GetOutputPort());
     planeWidgetX.SetPlaneOrientationToXAxes();
     planeWidgetX.SetSliceIndex(62);
     planeWidgetX.SetPicker(picker);
@@ -268,7 +268,7 @@ public class MPRViewer2
     //planeWidgetY.GetPlaneProperty().SetColor(1,0,0);
     //planeWidgetY.TextureInterpolateOff();
     //planeWidgetY.SetResliceInterpolateToNearestNeighbour();
-    planeWidgetY.SetInput(change.GetOutput());
+    planeWidgetY.SetInputConnection(change.GetOutputPort());
     planeWidgetY.SetLookupTable( planeWidgetX.GetLookupTable() );
     planeWidgetY.SetPlaneOrientationToYAxes();
     planeWidgetY.SetSliceIndex(32);
@@ -286,7 +286,7 @@ public class MPRViewer2
     //planeWidgetZ.GetPlaneProperty().SetColor(1,0,0);
     //planeWidgetZ.TextureInterpolateOff();
     //planeWidgetZ.SetResliceInterpolateToNearestNeighbour();
-    planeWidgetZ.SetInput(change.GetOutput());
+    planeWidgetZ.SetInputConnection(change.GetOutputPort());
     planeWidgetZ.SetLookupTable( planeWidgetX.GetLookupTable() );
     planeWidgetZ.SetPlaneOrientationToZAxes();
     planeWidgetZ.SetSliceIndex(32);
diff --git a/Utilities/VTK/Examples/Java/ReadSeriesIntoVTK.java b/Utilities/VTK/Examples/Java/ReadSeriesIntoVTK.java
index 726b5e5..a61c852 100644
--- a/Utilities/VTK/Examples/Java/ReadSeriesIntoVTK.java
+++ b/Utilities/VTK/Examples/Java/ReadSeriesIntoVTK.java
@@ -79,7 +79,7 @@ public class ReadSeriesIntoVTK
     vtkMetaImageWriter writer = new vtkMetaImageWriter();
     writer.DebugOn();
     writer.SetCompression( false );
-    writer.SetInput( reader.GetOutput() );
+    writer.SetInputConnection( reader.GetOutputPort() );
     writer.SetFileName( "ReadSeriesIntoVTK.mhd" );
     writer.Write();
 
diff --git a/Utilities/VTK/Testing/CMakeLists.txt b/Utilities/VTK/Testing/CMakeLists.txt
index 0b1ac49..a06b195 100644
--- a/Utilities/VTK/Testing/CMakeLists.txt
+++ b/Utilities/VTK/Testing/CMakeLists.txt
@@ -6,6 +6,8 @@ endif()
 
 if(GDCM_WRAP_JAVA)
   if(VTK_WRAP_JAVA)
-    subdirs(Java)
+    if(EXISTS ${GDCM_VTK_JAVA_JAR})
+      subdirs(Java)
+    endif()
   endif()
 endif()
diff --git a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader1.cxx b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader1.cxx
index 21fa6e3..92b7578 100644
--- a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader1.cxx
+++ b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader1.cxx
@@ -26,7 +26,11 @@
 #include "gdcmFilenameGenerator.h"
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 /*
  * Test to show the pipeline for
diff --git a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader2_3.cxx b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader2_3.cxx
index b9143a1..35366a2 100644
--- a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader2_3.cxx
+++ b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReader2_3.cxx
@@ -26,7 +26,11 @@
 #include "gdcmFilenameGenerator.h"
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 /*
  * Test to show the pipeline for
diff --git a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReaderIsLossy.cxx b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReaderIsLossy.cxx
index 4f6d825..3abe7df 100644
--- a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReaderIsLossy.cxx
+++ b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageReaderIsLossy.cxx
@@ -24,7 +24,11 @@
 #include "gdcmImageReader.h"
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 
 int TestvtkGDCMImageReaderIsLossyFunc(const char *filename, bool verbose = false)
diff --git a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter1.cxx b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter1.cxx
index 88309f7..ef1126f 100644
--- a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter1.cxx
+++ b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter1.cxx
@@ -25,7 +25,11 @@
 #include "gdcmImageReader.h"
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 
 int TestvtkGDCMImageWrite(const char *filename, bool verbose = false)
diff --git a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter2.cxx b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter2.cxx
index 403c2ca..fa7271c 100644
--- a/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter2.cxx
+++ b/Utilities/VTK/Testing/Cxx/TestvtkGDCMImageWriter2.cxx
@@ -29,7 +29,11 @@
 #include <iostream>
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 
 int TestvtkGDCMImageWrite2(const char *filename, bool verbose = false)
diff --git a/Utilities/VTK/VTK4/vtkMedicalImageProperties.cxx b/Utilities/VTK/VTK4/vtkMedicalImageProperties.cxx
index 34c55a7..3d5dfc3 100644
--- a/Utilities/VTK/VTK4/vtkMedicalImageProperties.cxx
+++ b/Utilities/VTK/VTK4/vtkMedicalImageProperties.cxx
@@ -39,7 +39,11 @@
 #include <assert.h>
 
 //----------------------------------------------------------------------------
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkMedicalImageProperties, "1.21")
+#else
+//vtkCxxRevisionMacro(vtkMedicalImageProperties, "1.21")
+#endif
 vtkStandardNewMacro(vtkMedicalImageProperties)
 
 static const char *vtkMedicalImagePropertiesOrientationString[] = {
diff --git a/Utilities/VTK/VTK4/vtkMedicalImageProperties.h b/Utilities/VTK/VTK4/vtkMedicalImageProperties.h
index 7ae1103..ab91ff6 100644
--- a/Utilities/VTK/VTK4/vtkMedicalImageProperties.h
+++ b/Utilities/VTK/VTK4/vtkMedicalImageProperties.h
@@ -51,7 +51,11 @@ class VTK_IO_EXPORT vtkMedicalImageProperties : public vtkObject
 {
 public:
   static vtkMedicalImageProperties *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkMedicalImageProperties,vtkObject);
+#else
+  vtkTypeMacro(vtkMedicalImageProperties,vtkObject);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/VTK4/vtkStringArray.cxx b/Utilities/VTK/VTK4/vtkStringArray.cxx
index 940a9ba..5058609 100644
--- a/Utilities/VTK/VTK4/vtkStringArray.cxx
+++ b/Utilities/VTK/VTK4/vtkStringArray.cxx
@@ -18,7 +18,11 @@
 #include <vector>
 #include <string>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkStringArray, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkStringArray, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkStringArray)
 
 struct vtkStringArrayInternals
diff --git a/Utilities/VTK/VTK4/vtkStringArray.h b/Utilities/VTK/VTK4/vtkStringArray.h
index 90748d7..3e8bed2 100644
--- a/Utilities/VTK/VTK4/vtkStringArray.h
+++ b/Utilities/VTK/VTK4/vtkStringArray.h
@@ -34,7 +34,11 @@ class VTK_EXPORT vtkStringArray : public vtkObject
 {
 public:
   static vtkStringArray *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkStringArray,vtkObject);
+#else
+  vtkTypeMacro(vtkStringArray,vtkObject);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
 //BTX
diff --git a/Utilities/VTK/vtkGDCMImageReader.cxx b/Utilities/VTK/vtkGDCMImageReader.cxx
index 7b64dce..30e85c6 100644
--- a/Utilities/VTK/vtkGDCMImageReader.cxx
+++ b/Utilities/VTK/vtkGDCMImageReader.cxx
@@ -51,7 +51,11 @@
 
 #include <sstream>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMImageReader, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMImageReader, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkGDCMImageReader)
 
 static inline bool vtkGDCMImageReader_IsCharTypeSigned()
diff --git a/Utilities/VTK/vtkGDCMImageReader.h b/Utilities/VTK/vtkGDCMImageReader.h
index bf016f1..eb4aeac 100644
--- a/Utilities/VTK/vtkGDCMImageReader.h
+++ b/Utilities/VTK/vtkGDCMImageReader.h
@@ -103,7 +103,11 @@ class VTK_EXPORT vtkGDCMImageReader : public vtkMedicalImageReader2
 {
 public:
   static vtkGDCMImageReader *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMImageReader,vtkMedicalImageReader2);
+#else
+  vtkTypeMacro(vtkGDCMImageReader,vtkMedicalImageReader2);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description: is the given file name a DICOM file containing an image ?
diff --git a/Utilities/VTK/vtkGDCMImageReader2.cxx b/Utilities/VTK/vtkGDCMImageReader2.cxx
index 5dafdbf..5b3195c 100644
--- a/Utilities/VTK/vtkGDCMImageReader2.cxx
+++ b/Utilities/VTK/vtkGDCMImageReader2.cxx
@@ -49,7 +49,11 @@
 
 #include <sstream>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMImageReader2, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMImageReader2, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkGDCMImageReader2)
 
 static inline bool vtkGDCMImageReader2_IsCharTypeSigned()
diff --git a/Utilities/VTK/vtkGDCMImageReader2.h b/Utilities/VTK/vtkGDCMImageReader2.h
index 4e3e09b..9389b42 100644
--- a/Utilities/VTK/vtkGDCMImageReader2.h
+++ b/Utilities/VTK/vtkGDCMImageReader2.h
@@ -95,7 +95,11 @@ class VTK_EXPORT vtkGDCMImageReader2 : public vtkMedicalImageReader2
 {
 public:
   static vtkGDCMImageReader2 *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMImageReader2,vtkMedicalImageReader2);
+#else
+  vtkTypeMacro(vtkGDCMImageReader2,vtkMedicalImageReader2);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description: is the given file name a DICOM file containing an image ?
diff --git a/Utilities/VTK/vtkGDCMImageWriter.cxx b/Utilities/VTK/vtkGDCMImageWriter.cxx
index 9785525..3439cd7 100644
--- a/Utilities/VTK/vtkGDCMImageWriter.cxx
+++ b/Utilities/VTK/vtkGDCMImageWriter.cxx
@@ -47,7 +47,11 @@
 
 #include <limits>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMImageWriter, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMImageWriter, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkGDCMImageWriter)
 
 //vtkCxxSetObjectMacro(vtkGDCMImageWriter,LookupTable,vtkLookupTable)
@@ -66,7 +70,11 @@ inline bool vtkGDCMImageWriter_IsCharTypeSigned()
 }
 
 #ifndef vtkFloatingPointType
+#if VTK_MAJOR_VERSION < 6
 #define vtkFloatingPointType float
+#else
+#define vtkFloatingPointType double
+#endif
 #endif
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkGDCMImageWriter.h b/Utilities/VTK/vtkGDCMImageWriter.h
index 2fc8760..2d012fa 100644
--- a/Utilities/VTK/vtkGDCMImageWriter.h
+++ b/Utilities/VTK/vtkGDCMImageWriter.h
@@ -48,7 +48,11 @@ class VTK_EXPORT vtkGDCMImageWriter : public vtkImageWriter
 {
 public:
   static vtkGDCMImageWriter *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMImageWriter,vtkImageWriter);
+#else
+  vtkTypeMacro(vtkGDCMImageWriter,vtkImageWriter);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkGDCMMedicalImageProperties.cxx b/Utilities/VTK/vtkGDCMMedicalImageProperties.cxx
index 5b1a955..d4e91eb 100644
--- a/Utilities/VTK/vtkGDCMMedicalImageProperties.cxx
+++ b/Utilities/VTK/vtkGDCMMedicalImageProperties.cxx
@@ -17,7 +17,11 @@
 #include "gdcmFile.h"
 
 //----------------------------------------------------------------------------
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMMedicalImageProperties, "1.21")
+#else
+//vtkCxxRevisionMacro(vtkGDCMMedicalImageProperties, "1.21")
+#endif
 vtkStandardNewMacro(vtkGDCMMedicalImageProperties)
 
 class vtkGDCMMedicalImagePropertiesInternals
diff --git a/Utilities/VTK/vtkGDCMMedicalImageProperties.h b/Utilities/VTK/vtkGDCMMedicalImageProperties.h
index 826d1b9..3c82cbd 100644
--- a/Utilities/VTK/vtkGDCMMedicalImageProperties.h
+++ b/Utilities/VTK/vtkGDCMMedicalImageProperties.h
@@ -34,7 +34,11 @@ class VTK_EXPORT vtkGDCMMedicalImageProperties : public vtkMedicalImagePropertie
 {
 public:
   static vtkGDCMMedicalImageProperties *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMMedicalImageProperties,vtkMedicalImageProperties);
+#else
+  vtkTypeMacro(vtkGDCMMedicalImageProperties,vtkMedicalImageProperties);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkGDCMPolyDataReader.cxx b/Utilities/VTK/vtkGDCMPolyDataReader.cxx
index de88431..b3f86ba 100644
--- a/Utilities/VTK/vtkGDCMPolyDataReader.cxx
+++ b/Utilities/VTK/vtkGDCMPolyDataReader.cxx
@@ -30,7 +30,11 @@
 #include "gdcmSequenceOfItems.h"
 #include "gdcmDirectoryHelper.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMPolyDataReader, "$Revision: 1.74 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMPolyDataReader, "$Revision: 1.74 $")
+#endif
 vtkStandardNewMacro(vtkGDCMPolyDataReader)
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkGDCMPolyDataReader.h b/Utilities/VTK/vtkGDCMPolyDataReader.h
index 251cacb..e6df72f 100644
--- a/Utilities/VTK/vtkGDCMPolyDataReader.h
+++ b/Utilities/VTK/vtkGDCMPolyDataReader.h
@@ -39,7 +39,11 @@ class VTK_EXPORT vtkGDCMPolyDataReader : public vtkPolyDataAlgorithm
 {
 public:
   static vtkGDCMPolyDataReader *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMPolyDataReader,vtkPolyDataAlgorithm);
+#else
+  vtkTypeMacro(vtkGDCMPolyDataReader,vtkPolyDataAlgorithm);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkGDCMPolyDataWriter.cxx b/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
index ead79a3..e4216d8 100644
--- a/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
+++ b/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
@@ -40,7 +40,11 @@
 #include "gdcmAttribute.h"
 #include "gdcmDirectoryHelper.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMPolyDataWriter, "$Revision: 1.74 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMPolyDataWriter, "$Revision: 1.74 $")
+#endif
 vtkStandardNewMacro(vtkGDCMPolyDataWriter)
 vtkCxxSetObjectMacro(vtkGDCMPolyDataWriter,MedicalImageProperties,vtkMedicalImageProperties)
 vtkCxxSetObjectMacro(vtkGDCMPolyDataWriter,RTStructSetProperties,vtkRTStructSetProperties)
diff --git a/Utilities/VTK/vtkGDCMPolyDataWriter.h b/Utilities/VTK/vtkGDCMPolyDataWriter.h
index aa456f3..f34cb37 100644
--- a/Utilities/VTK/vtkGDCMPolyDataWriter.h
+++ b/Utilities/VTK/vtkGDCMPolyDataWriter.h
@@ -39,7 +39,11 @@ class VTK_EXPORT vtkGDCMPolyDataWriter : public vtkPolyDataWriter
 {
 public:
   static vtkGDCMPolyDataWriter *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMPolyDataWriter,vtkPolyDataWriter);
+#else
+  vtkTypeMacro(vtkGDCMPolyDataWriter,vtkPolyDataWriter);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkGDCMTesting.cxx b/Utilities/VTK/vtkGDCMTesting.cxx
index 0cd2c26..d637a16 100644
--- a/Utilities/VTK/vtkGDCMTesting.cxx
+++ b/Utilities/VTK/vtkGDCMTesting.cxx
@@ -18,7 +18,11 @@
 #include "gdcmTesting.h"
 #include "gdcmFilename.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMTesting, "$Revision: 1.31 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMTesting, "$Revision: 1.31 $")
+#endif
 vtkStandardNewMacro(vtkGDCMTesting)
 
 // DICOM Filename, MHD MD5, RAW MD5
diff --git a/Utilities/VTK/vtkGDCMTesting.h b/Utilities/VTK/vtkGDCMTesting.h
index 57fe57d..52ecbb6 100644
--- a/Utilities/VTK/vtkGDCMTesting.h
+++ b/Utilities/VTK/vtkGDCMTesting.h
@@ -27,7 +27,11 @@ class VTK_EXPORT vtkGDCMTesting : public vtkObject
 {
 public:
   static vtkGDCMTesting *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMTesting,vtkObject);
+#else
+  vtkTypeMacro(vtkGDCMTesting,vtkObject);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   static const char *GetVTKDataRoot();
diff --git a/Utilities/VTK/vtkGDCMThreadedImageReader.cxx b/Utilities/VTK/vtkGDCMThreadedImageReader.cxx
index 93e281e..5cda558 100644
--- a/Utilities/VTK/vtkGDCMThreadedImageReader.cxx
+++ b/Utilities/VTK/vtkGDCMThreadedImageReader.cxx
@@ -43,7 +43,11 @@
 #include <sys/sysctl.h>
 #endif
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMThreadedImageReader, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMThreadedImageReader, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkGDCMThreadedImageReader)
 
 // Output Ports are as follow:
diff --git a/Utilities/VTK/vtkGDCMThreadedImageReader.h b/Utilities/VTK/vtkGDCMThreadedImageReader.h
index 2f554b1..a72aeff 100644
--- a/Utilities/VTK/vtkGDCMThreadedImageReader.h
+++ b/Utilities/VTK/vtkGDCMThreadedImageReader.h
@@ -43,7 +43,11 @@ class VTK_EXPORT vtkGDCMThreadedImageReader : public vtkGDCMImageReader
 {
 public:
   static vtkGDCMThreadedImageReader *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMThreadedImageReader,vtkGDCMImageReader);
+#else
+  vtkTypeMacro(vtkGDCMThreadedImageReader,vtkGDCMImageReader);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkGDCMThreadedImageReader2.cxx b/Utilities/VTK/vtkGDCMThreadedImageReader2.cxx
index 9a856bc..189b4f1 100644
--- a/Utilities/VTK/vtkGDCMThreadedImageReader2.cxx
+++ b/Utilities/VTK/vtkGDCMThreadedImageReader2.cxx
@@ -25,7 +25,11 @@
 
 #include <assert.h>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkGDCMThreadedImageReader2, "$Revision: 1.1 $")
+#else
+//vtkCxxRevisionMacro(vtkGDCMThreadedImageReader2, "$Revision: 1.1 $")
+#endif
 vtkStandardNewMacro(vtkGDCMThreadedImageReader2)
 vtkCxxSetObjectMacro(vtkGDCMThreadedImageReader2,FileNames,vtkStringArray)
 
diff --git a/Utilities/VTK/vtkGDCMThreadedImageReader2.h b/Utilities/VTK/vtkGDCMThreadedImageReader2.h
index 5b60101..fe14f2a 100644
--- a/Utilities/VTK/vtkGDCMThreadedImageReader2.h
+++ b/Utilities/VTK/vtkGDCMThreadedImageReader2.h
@@ -50,7 +50,11 @@ class VTK_EXPORT vtkGDCMThreadedImageReader2 : public vtkThreadedImageAlgorithm
 {
 public:
   static vtkGDCMThreadedImageReader2 *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkGDCMThreadedImageReader2,vtkThreadedImageAlgorithm);
+#else
+  vtkTypeMacro(vtkGDCMThreadedImageReader2,vtkThreadedImageAlgorithm);
+#endif
   virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   vtkGetMacro(FileLowerLeft,int);
diff --git a/Utilities/VTK/vtkImageColorViewer.cxx b/Utilities/VTK/vtkImageColorViewer.cxx
index e1fa303..fbbe3b9 100644
--- a/Utilities/VTK/vtkImageColorViewer.cxx
+++ b/Utilities/VTK/vtkImageColorViewer.cxx
@@ -49,7 +49,11 @@
 #include "vtkInformation.h"
 #endif
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageColorViewer, "$Revision: 1.3 $")
+#else
+//vtkCxxRevisionMacro(vtkImageColorViewer, "$Revision: 1.3 $")
+#endif
 vtkStandardNewMacro(vtkImageColorViewer)
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkImageColorViewer.h b/Utilities/VTK/vtkImageColorViewer.h
index 6d83592..e0b05fb 100644
--- a/Utilities/VTK/vtkImageColorViewer.h
+++ b/Utilities/VTK/vtkImageColorViewer.h
@@ -71,7 +71,11 @@ class VTK_EXPORT vtkImageColorViewer : public vtkObject
 {
 public:
   static vtkImageColorViewer *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageColorViewer,vtkObject);
+#else
+  vtkTypeMacro(vtkImageColorViewer,vtkObject);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkImageMapToColors16.cxx b/Utilities/VTK/vtkImageMapToColors16.cxx
index ae8d7e7..768b27b 100644
--- a/Utilities/VTK/vtkImageMapToColors16.cxx
+++ b/Utilities/VTK/vtkImageMapToColors16.cxx
@@ -37,7 +37,11 @@
 #include "vtkScalarsToColors.h"
 #include "vtkPointData.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageMapToColors16, "$Revision: 1.30 $")
+#else
+//vtkCxxRevisionMacro(vtkImageMapToColors16, "$Revision: 1.30 $")
+#endif
 vtkStandardNewMacro(vtkImageMapToColors16)
 vtkCxxSetObjectMacro(vtkImageMapToColors16,LookupTable,vtkScalarsToColors)
 
diff --git a/Utilities/VTK/vtkImageMapToColors16.h b/Utilities/VTK/vtkImageMapToColors16.h
index c7d0cd3..da68905 100644
--- a/Utilities/VTK/vtkImageMapToColors16.h
+++ b/Utilities/VTK/vtkImageMapToColors16.h
@@ -50,7 +50,11 @@ class VTK_EXPORT vtkImageMapToColors16 : public vtkThreadedImageAlgorithm
 {
 public:
   static vtkImageMapToColors16 *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageMapToColors16,vtkThreadedImageAlgorithm);
+#else
+  vtkTypeMacro(vtkImageMapToColors16,vtkThreadedImageAlgorithm);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx b/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx
index a9233e2..1a355fa 100644
--- a/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx
+++ b/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx
@@ -37,7 +37,11 @@
 #include "vtkScalarsToColors.h"
 #include "vtkPointData.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageMapToWindowLevelColors2, "$Revision: 1.3 $")
+#else
+//vtkCxxRevisionMacro(vtkImageMapToWindowLevelColors2, "$Revision: 1.3 $")
+#endif
 vtkStandardNewMacro(vtkImageMapToWindowLevelColors2)
 
 // Constructor sets default values
diff --git a/Utilities/VTK/vtkImageMapToWindowLevelColors2.h b/Utilities/VTK/vtkImageMapToWindowLevelColors2.h
index dc2db27..54bf2fb 100644
--- a/Utilities/VTK/vtkImageMapToWindowLevelColors2.h
+++ b/Utilities/VTK/vtkImageMapToWindowLevelColors2.h
@@ -49,7 +49,11 @@ class VTK_EXPORT vtkImageMapToWindowLevelColors2 : public vtkImageMapToColors
 {
 public:
   static vtkImageMapToWindowLevelColors2 *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageMapToWindowLevelColors2,vtkImageMapToColors);
+#else
+  vtkTypeMacro(vtkImageMapToWindowLevelColors2,vtkImageMapToColors);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkImagePlanarComponentsToComponents.cxx b/Utilities/VTK/vtkImagePlanarComponentsToComponents.cxx
index 01a189a..78d5a7c 100644
--- a/Utilities/VTK/vtkImagePlanarComponentsToComponents.cxx
+++ b/Utilities/VTK/vtkImagePlanarComponentsToComponents.cxx
@@ -41,7 +41,11 @@
 
 #include <assert.h>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImagePlanarComponentsToComponents, "$Revision: 1.31 $")
+#else
+//vtkCxxRevisionMacro(vtkImagePlanarComponentsToComponents, "$Revision: 1.31 $")
+#endif
 vtkStandardNewMacro(vtkImagePlanarComponentsToComponents)
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkImagePlanarComponentsToComponents.h b/Utilities/VTK/vtkImagePlanarComponentsToComponents.h
index d9bb13f..79188f9 100644
--- a/Utilities/VTK/vtkImagePlanarComponentsToComponents.h
+++ b/Utilities/VTK/vtkImagePlanarComponentsToComponents.h
@@ -49,8 +49,13 @@ class VTK_EXPORT vtkImagePlanarComponentsToComponents : public vtkImageAlgorithm
 {
 public:
   static vtkImagePlanarComponentsToComponents *New();
+#if VTK_MAJOR_VERSION < 6
   //vtkTypeRevisionMacro(vtkImagePlanarComponentsToComponents,vtkThreadedImageAlgorithm);
   vtkTypeRevisionMacro(vtkImagePlanarComponentsToComponents,vtkImageAlgorithm);
+#else
+  //vtkTypeMacro(vtkImagePlanarComponentsToComponents,vtkThreadedImageAlgorithm);
+  vtkTypeMacro(vtkImagePlanarComponentsToComponents,vtkImageAlgorithm);
+#endif
 
   void PrintSelf(ostream& os, vtkIndent indent);
 
diff --git a/Utilities/VTK/vtkImageRGBToYBR.cxx b/Utilities/VTK/vtkImageRGBToYBR.cxx
index 8914346..e0c4bd4 100644
--- a/Utilities/VTK/vtkImageRGBToYBR.cxx
+++ b/Utilities/VTK/vtkImageRGBToYBR.cxx
@@ -34,7 +34,11 @@
 #include "vtkMath.h"
 #include "vtkObjectFactory.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageRGBToYBR, "$Revision: 1.31 $")
+#else
+//vtkCxxRevisionMacro(vtkImageRGBToYBR, "$Revision: 1.31 $")
+#endif
 vtkStandardNewMacro(vtkImageRGBToYBR)
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkImageRGBToYBR.h b/Utilities/VTK/vtkImageRGBToYBR.h
index 132429b..8efd906 100644
--- a/Utilities/VTK/vtkImageRGBToYBR.h
+++ b/Utilities/VTK/vtkImageRGBToYBR.h
@@ -45,7 +45,11 @@ class VTK_EXPORT vtkImageRGBToYBR : public vtkThreadedImageAlgorithm
 {
 public:
   static vtkImageRGBToYBR *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageRGBToYBR,vtkThreadedImageAlgorithm);
+#else
+  vtkTypeMacro(vtkImageRGBToYBR,vtkThreadedImageAlgorithm);
+#endif
 
   void PrintSelf(ostream& os, vtkIndent indent);
 
diff --git a/Utilities/VTK/vtkImageYBRToRGB.cxx b/Utilities/VTK/vtkImageYBRToRGB.cxx
index 06c54c7..afe9635 100644
--- a/Utilities/VTK/vtkImageYBRToRGB.cxx
+++ b/Utilities/VTK/vtkImageYBRToRGB.cxx
@@ -34,7 +34,11 @@
 #include "vtkMath.h"
 #include "vtkObjectFactory.h"
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkImageYBRToRGB, "$Revision: 1.31 $")
+#else
+//vtkCxxRevisionMacro(vtkImageYBRToRGB, "$Revision: 1.31 $")
+#endif
 vtkStandardNewMacro(vtkImageYBRToRGB)
 
 //----------------------------------------------------------------------------
diff --git a/Utilities/VTK/vtkImageYBRToRGB.h b/Utilities/VTK/vtkImageYBRToRGB.h
index d83cc57..ba7ee14 100644
--- a/Utilities/VTK/vtkImageYBRToRGB.h
+++ b/Utilities/VTK/vtkImageYBRToRGB.h
@@ -45,7 +45,11 @@ class VTK_EXPORT vtkImageYBRToRGB : public vtkThreadedImageAlgorithm
 {
 public:
   static vtkImageYBRToRGB *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkImageYBRToRGB,vtkThreadedImageAlgorithm);
+#else
+  vtkTypeMacro(vtkImageYBRToRGB,vtkThreadedImageAlgorithm);
+#endif
 
   void PrintSelf(ostream& os, vtkIndent indent);
 
diff --git a/Utilities/VTK/vtkLookupTable16.cxx b/Utilities/VTK/vtkLookupTable16.cxx
index 8559104..eff3364 100644
--- a/Utilities/VTK/vtkLookupTable16.cxx
+++ b/Utilities/VTK/vtkLookupTable16.cxx
@@ -32,7 +32,11 @@
 
 #include <cassert>
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkLookupTable16, "$Revision: 1.107 $")
+#else
+//vtkCxxRevisionMacro(vtkLookupTable16, "$Revision: 1.107 $")
+#endif
 vtkStandardNewMacro(vtkLookupTable16)
 
 vtkLookupTable16::vtkLookupTable16(int sze, int ext)
diff --git a/Utilities/VTK/vtkLookupTable16.h b/Utilities/VTK/vtkLookupTable16.h
index ea65d67..4cb9d9e 100644
--- a/Utilities/VTK/vtkLookupTable16.h
+++ b/Utilities/VTK/vtkLookupTable16.h
@@ -46,7 +46,11 @@ class VTK_EXPORT vtkLookupTable16 : public vtkLookupTable
 public:
   static vtkLookupTable16 *New();
 
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkLookupTable16,vtkLookupTable);
+#else
+  vtkTypeMacro(vtkLookupTable16,vtkLookupTable);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   void Build();
diff --git a/Utilities/VTK/vtkRTStructSetProperties.cxx b/Utilities/VTK/vtkRTStructSetProperties.cxx
index 6f03a6b..8edf234 100644
--- a/Utilities/VTK/vtkRTStructSetProperties.cxx
+++ b/Utilities/VTK/vtkRTStructSetProperties.cxx
@@ -28,7 +28,11 @@
 #include <assert.h>
 
 //----------------------------------------------------------------------------
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(vtkRTStructSetProperties, "1.21")
+#else
+//vtkCxxRevisionMacro(vtkRTStructSetProperties, "1.21")
+#endif
 vtkStandardNewMacro(vtkRTStructSetProperties)
 
 
diff --git a/Utilities/VTK/vtkRTStructSetProperties.h b/Utilities/VTK/vtkRTStructSetProperties.h
index a5aef7c..334d851 100644
--- a/Utilities/VTK/vtkRTStructSetProperties.h
+++ b/Utilities/VTK/vtkRTStructSetProperties.h
@@ -28,7 +28,11 @@ class VTK_EXPORT vtkRTStructSetProperties : public vtkObject
 {
 public:
   static vtkRTStructSetProperties *New();
+#if VTK_MAJOR_VERSION < 6
   vtkTypeRevisionMacro(vtkRTStructSetProperties,vtkObject);
+#else
+  vtkTypeMacro(vtkRTStructSetProperties,vtkObject);
+#endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
   // Description:
diff --git a/Utilities/VTK/vtkgdcm.py b/Utilities/VTK/vtkgdcm.py
index c1c6672..a927072 100644
--- a/Utilities/VTK/vtkgdcm.py
+++ b/Utilities/VTK/vtkgdcm.py
@@ -42,7 +42,11 @@ if os.name == 'posix':
     #print "dl was imported"
     #sys.setdlopenflags(dl.RTLD_LAZY|dl.RTLD_GLOBAL)
     sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)
-  from libvtkgdcmPython import *
+  try:
+    from libvtkgdcmPython import *
+  except ImportError:
+    # maybe vtk7
+    from vtkgdcmPython import *
   # revert:
   sys.setdlopenflags(orig_dlopen_flags)
   del sys, dl
diff --git a/Utilities/doxygen/CMakeLists.txt b/Utilities/doxygen/CMakeLists.txt
index cf8f616..33a0210 100644
--- a/Utilities/doxygen/CMakeLists.txt
+++ b/Utilities/doxygen/CMakeLists.txt
@@ -154,7 +154,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
     endif()
     # add target to 'ALL'
     add_custom_target(GDCMDoxygenPDF
-      ALL
       DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/gdcm-${GDCM_VERSION}.pdf
       COMMENT  "GDCM: Executing GDCMDoxygenPDF"
     )
@@ -162,13 +161,14 @@ ${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
       ${CMAKE_CURRENT_BINARY_DIR}/latex/gdcm-${GDCM_VERSION}.pdf
       DESTINATION ${GDCM_INSTALL_DOC_DIR}
     )
+    add_dependencies(DoxygenDoc GDCMDoxygenPDF)
   else()
     # make DoxygenDoc depends on the final tarball thus all file are garantee to be generated
     add_custom_target(GDCMDoxygenDoc
-      ALL
       DEPENDS ${GDCM_DOC_TARBALL}
       COMMENT  "GDCM: Executing GDCMDoxygenDoc"
     )
+    add_dependency(DoxygenDoc GDCMDoxygenDoc)
   endif()
 
   # Install html pages:
@@ -225,6 +225,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
   endif()
 endif()
 
+option(GDCM_BUILD_DOCBOOK_MANPAGES "Build man pages from XML docbook ?" ON)
+mark_as_advanced(GDCM_BUILD_DOCBOOK_MANPAGES)
+if(GDCM_BUILD_DOCBOOK_MANPAGES)
 set(MANPAGES_XML
     gdcm2pnm
     gdcm2vtk
@@ -253,9 +256,32 @@ if(LIBXSLT_XSLTPROC_EXECUTABLE)
   # User can change the behavior at cmake time:
   if(NOT DEFINED GDCM_MANPAGES_USE_NONET)
     set(GDCM_MANPAGES_USE_NONET FALSE)
-    # By default I want nonet on Debian:
+    # By default I want nonet on Debian (docbook-xsl-ns)
+    # on fedora you need to install docbook-style-xsl
     if(EXISTS /etc/xml/catalog)
-      set(GDCM_MANPAGES_USE_NONET TRUE)
+      # https://cmake.org/pipermail/cmake/2007-May/014317.html
+      file(READ /etc/xml/catalog xml_catalog_in)
+      #<rewriteSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl-ns/" rewritePrefix="file:///usr/share/sgml/docbook/xsl-ns-stylesheets-1.78.1"/>
+      #<rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl-ns/" rewritePrefix="file:///usr/share/sgml/docbook/xsl-ns-stylesheets-1.78.1"/>
+      string(REGEX REPLACE "\r?\n" ";" xml_catalog ${xml_catalog_in})
+
+      set(DOCBOOK_REWRITE_PREFIX_FOUND FALSE)
+      foreach(line ${xml_catalog})
+        string(REGEX MATCH "^.*systemIdStartString=\"http://docbook.sourceforge.net/release/xsl-ns/\".*" out1 ${line})
+        string(REGEX REPLACE "^.*systemIdStartString=\"http://docbook.sourceforge.net/release/xsl-ns/\".*\"([A-Za-z ]*)\".*" "\\1" output_variable ${line})
+        if(out1)
+          message("Your docbook install was found here :${output_variable}")
+          set(DOCBOOK_REWRITE_PREFIX_FOUND TRUE)
+        endif()
+      endforeach()
+      # Need both the catalog and the docbook installation
+      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.")
+      endif()
+    else()
+      message(STATUS "Could not find /etc/xml/catalog")
     endif()
   endif()
   if(GDCM_MANPAGES_USE_NONET)
@@ -265,6 +291,7 @@ else()
   find_program(MSXSL_EXECUTABLE
     msxsl
     )
+  mark_as_advanced(MSXSL_EXECUTABLE)
   if(MSXSL_EXECUTABLE)
     set(XSLT_PROCESSOR ${MSXSL_EXECUTABLE})
     set(XSLT_PROCESSOR_ARG "-pi")
@@ -300,3 +327,4 @@ install(FILES
 else()
   message(WARNING "Cannot build man page from docbook (need an XSL processor)")
 endif()
+endif() # GDCM_BUILD_DOCBOOK_MANPAGES
diff --git a/Utilities/doxygen/doxyfile.in b/Utilities/doxygen/doxyfile.in
index 11d8333..c9e27ce 100644
--- a/Utilities/doxygen/doxyfile.in
+++ b/Utilities/doxygen/doxyfile.in
@@ -2355,7 +2355,7 @@ PLANTUML_INCLUDE_PATH  =
 # Minimum value: 0, maximum value: 10000, default value: 50.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_GRAPH_MAX_NODES    = 50
+DOT_GRAPH_MAX_NODES    = 100
 
 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
 # generated by dot. A depth value of 3 means that only nodes reachable from the
diff --git a/Utilities/doxygen/vtk/CMakeLists.txt b/Utilities/doxygen/vtk/CMakeLists.txt
index 7f1432c..b5ef267 100644
--- a/Utilities/doxygen/vtk/CMakeLists.txt
+++ b/Utilities/doxygen/vtk/CMakeLists.txt
@@ -109,7 +109,6 @@ mark_as_advanced(VTK_DIR)
     ${CMAKE_CURRENT_BINARY_DIR}/doc_makeall.sh @ONLY )
 
   add_custom_target(${DOXYGEN_PROJECT_NAME}DoxygenDoc
-    #ALL
     ${BASH}
     ${CMAKE_CURRENT_BINARY_DIR}/doc_makeall.sh)
 
@@ -117,6 +116,8 @@ mark_as_advanced(VTK_DIR)
     ${DOXYGEN_PROJECT_NAME}DoxygenDoc
     GDCMDoxygenPDF
   )
+  add_dependencies(DoxygenDoc
+    ${DOXYGEN_PROJECT_NAME}DoxygenDoc)
 
   if(INCLUDE_QT_DOCUMENTATION)
     add_custom_target(QtDoxygenTags
diff --git a/Utilities/gdcm_charls.h b/Utilities/gdcm_charls.h
index c8f2c54..ba36b60 100644
--- a/Utilities/gdcm_charls.h
+++ b/Utilities/gdcm_charls.h
@@ -18,12 +18,13 @@
 #include "gdcmTypes.h"
 #ifdef GDCM_USE_SYSTEM_CHARLS
 // It is expected that 1.0 API is used (JlsParameters instead of JlsParamaters)
+# include <CharLS/header.h>
 # include <CharLS/interface.h>
 # include <CharLS/util.h>
 # include <CharLS/defaulttraits.h>
 # include <CharLS/losslesstraits.h>
 # include <CharLS/colortransform.h>
-# include <CharLS/streams.h>
+//# include <CharLS/streams.h>
 # include <CharLS/processline.h>
 #else
 #include "gdcmcharls/header.h"
diff --git a/Utilities/gdcmcharls/encoderstrategy.h b/Utilities/gdcmcharls/encoderstrategy.h
index f2426db..545d662 100644
--- a/Utilities/gdcmcharls/encoderstrategy.h
+++ b/Utilities/gdcmcharls/encoderstrategy.h
@@ -63,7 +63,7 @@ protected:
 #ifndef NDEBUG
 		if (length < 32)
 		{
-			int mask = (1 << (length)) - 1;
+			int mask = (1u << (length)) - 1;
 			ASSERT((value | mask) == mask);
 		}
 #endif
@@ -75,9 +75,15 @@ protected:
 			return;
 		}
 		valcurrent |= value >> -bitpos;
-
 		Flush();
 	        
+		// A second flush may be required if extra marker-detect bits were needed and not all bits could be written.
+		if (bitpos < 0)
+		{
+			valcurrent |= value >> -bitpos;
+			Flush();
+		}
+
 		ASSERT(bitpos >=0);
 		valcurrent |= value << bitpos;	
 
@@ -106,7 +112,7 @@ protected:
 
 			if (_isFFWritten)
 			{
-				// insert highmost bit
+				// JPEG-LS requirement (T.87, A.1) to detect markers: after a xFF value a single 0 bit needs to be inserted.
 				*_position = BYTE(valcurrent >> 25);
 				valcurrent = valcurrent << 7;			
 				bitpos += 7;	
diff --git a/Utilities/socketxx/socket++/local.h b/Utilities/socketxx/socket++/local.h
index 30d472a..57bebf7 100644
--- a/Utilities/socketxx/socket++/local.h
+++ b/Utilities/socketxx/socket++/local.h
@@ -97,7 +97,7 @@ extern "C" int shutdown (int, int); // they have forgotten this
 //  extern "C" int gethostname (char* hostname, size_t len);
 // the above breaks on some old MacOSX system where prototype is:
 //  extern "C" int gethostname (char* hostname, int len);
-#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__))
+#if !(defined(__FreeBSD__) || defined(__GNU__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__))
   extern char* SYS_SIGLIST [];
 #endif
 #endif
diff --git a/Utilities/socketxx/socket++/sockstream.h b/Utilities/socketxx/socket++/sockstream.h
index b84c55d..9659d03 100644
--- a/Utilities/socketxx/socket++/sockstream.h
+++ b/Utilities/socketxx/socket++/sockstream.h
@@ -163,7 +163,7 @@ class MY_API sockbuf: public std::streambuf
             msg_peek            = MSG_PEEK,
             msg_dontroute    = MSG_DONTROUTE
 
-#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__EMSCRIPTEN__))
+#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__EMSCRIPTEN__) )
             ,msg_maxiovlen    = MSG_MAXIOVLEN
 #endif
         };
diff --git a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx
index 69f6110..df5c05e 100644
--- a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx
+++ b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx
@@ -134,7 +134,11 @@ BEGIN_EVENT_TABLE(wxVTKRenderWindowInteractor, wxWindow)
   EVT_SIZE        (wxVTKRenderWindowInteractor::OnSize)
 END_EVENT_TABLE()
 
+#if VTK_MAJOR_VERSION < 6
 vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.42 $")
+#else
+//vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.42 $")
+#endif
 vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor)
 
 //---------------------------------------------------------------------------
diff --git a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h
index ead4444..a7aa888 100644
--- a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h
+++ b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h
@@ -102,7 +102,11 @@ class wxVTKRenderWindowInteractor : public wxWindow, public vtkRenderWindowInter
                                 const wxSize &size = wxDefaultSize,
                                 long style = wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE,
                                 const wxString &name = wxPanelNameStr);
+#if VTK_MAJOR_VERSION < 6
     vtkTypeRevisionMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor);
+#else
+    vtkTypeMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor);
+#endif
     static wxVTKRenderWindowInteractor * New();
     void PrintSelf(ostream& os, vtkIndent indent);
 
diff --git a/Wrapping/Java/CMakeLists.txt b/Wrapping/Java/CMakeLists.txt
index a1f46b3..ef264f1 100644
--- a/Wrapping/Java/CMakeLists.txt
+++ b/Wrapping/Java/CMakeLists.txt
@@ -14,7 +14,7 @@ include_directories(
 
 # $ export JAVA_HOME=/usr/lib/j2sdk1.6-sun/
 # $ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
-find_package(Java 1.7 REQUIRED) # javac, jar
+find_package(Java ${GDCM_DEFAULT_JAVA_VERSION} REQUIRED) # javac, jar
 find_package(JNI REQUIRED)
 include_directories(
   ${JNI_INCLUDE_DIRS}
diff --git a/Wrapping/Java/gdcm.i b/Wrapping/Java/gdcm.i
index 772996e..21126e1 100644
--- a/Wrapping/Java/gdcm.i
+++ b/Wrapping/Java/gdcm.i
@@ -262,6 +262,15 @@ EXTEND_CLASS_PRINT_GENERAL(toString,classname)
 #define GDCM_EXPORT
 %include "gdcmLegacyMacro.h"
 
+// The following must be define early on as gdcmVL.h get included real early
+%rename(GetValueLength) gdcm::VL::operator uint32_t;
+//%csmethodmodifiers gdcm::VL::GetValueLength "private"
+//%csmethodmodifiers GetValueLength "private"
+//%rename(GetValue) VL::operator uint32_t ();
+//  public static implicit operator int( MyType a )
+//        {
+//            return a.value;
+//        }
 %include "gdcmSwapCode.h"
 
 //%feature("director") Event;
diff --git a/Wrapping/Python/Python.h.in b/Wrapping/Python/Python.h.in
index e083115..c9aeac6 100644
--- a/Wrapping/Python/Python.h.in
+++ b/Wrapping/Python/Python.h.in
@@ -44,7 +44,7 @@
 #    define _CRT_NOFORCE_MANIFEST 1
 #  endif
 #  include "@PYTHON_INCLUDE_PATH@/Python.h"
-#  define _DEBUG
+#  define _DEBUG 1
 # else
 #  include "@PYTHON_INCLUDE_PATH@/Python.h"
 # endif
diff --git a/appveyor.yml b/appveyor.yml
index 9322396..ceff370 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,7 +2,7 @@
 # http://www.appveyor.com/docs/appveyor-yml
 
 # Set build version format here instead of in the admin panel.
-version: 2.6.3.{build}
+version: 2.6.4.{build}
 
 # http://www.appveyor.com/docs/build-cache#caching-chocolatey-packages
 # https://github.com/kvirc/KVIrc/blob/master/.appveyor.yml
@@ -104,7 +104,7 @@ on_failure:
 
 # scripts to run before build
 before_build:
-  - cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DGDCM_BUILD_TESTING:BOOL=ON -DGDCM_BUILD_APPLICATIONS:BOOL=ON -DGDCM_BUILD_EXAMPLES:BOOL=ON -DGDCM_BUILD_SHARED_LIBS:BOOL=ON -DBUILDNAME:STRING=%COMPUTERNAME%-%branch%-%B_NAME% -DGDCM_WRAP_CSHARP:BOOL=ON -DGDCM_WRAP_JAVA:BOOL=ON -DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_USE_PVRG:BOOL=ON -DGDCM_LEGACY_SILENT:BOOL=ON -DCPACK_SYSTEM_NAME:STRING=%B_NAME% .
+  - cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DGDCM_BUILD_TESTING:BOOL=ON -DGDCM_BUILD_APPLICATIONS:BOOL=ON -DGDCM_BUILD_EXAMPLES:BOOL=ON -DGDCM_BUILD_SHARED_LIBS:BOOL=ON -DBUILDNAME:STRING=%COMPUTERNAME%-%APPVEYOR_REPO_BRANCH%-%B_NAME% -DGDCM_WRAP_CSHARP:BOOL=ON -DGDCM_WRAP_JAVA:BOOL=ON -DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_USE_PVRG:BOOL=ON -DGDCM_LEGACY_SILENT:BOOL=ON -DCPACK_SYSTEM_NAME:STRING=%B_NAME% .
   - ctest -D ExperimentalStart -C %CONFIG%
 
 # scripts to run after build

-- 
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