]> Creatis software - gdcm.git/commitdiff
ENH: should be backward compatible
authormalaterre <malaterre>
Wed, 12 Sep 2007 13:43:10 +0000 (13:43 +0000)
committermalaterre <malaterre>
Wed, 12 Sep 2007 13:43:10 +0000 (13:43 +0000)
vtk/CMakeLists.txt
vtk/vtkgdcmViewer2.cxx

index b213ecb0200338aee397bf0888a57b898faa0f09..9d50b42e80eb2fb002889ad1474427b67f32fcae 100644 (file)
@@ -13,12 +13,20 @@ INCLUDE_DIRECTORIES(
   ${GDCM_BINARY_DIR}/
 )
 
-SET(VTKGDCM_LIB_SRCS
-  vtkGdcmReader.cxx
-  vtkGdcmWriter.cxx
-  vtkImageColorViewer.cxx
-  vtkImageMapToWindowLevelColors2.cxx
-)
+# Depending on VTK version build more stuff:
+IF("${VTK_MAJOR_VERSION}" GREATER 4)
+  SET(VTKGDCM_LIB_SRCS
+    vtkGdcmReader.cxx
+    vtkGdcmWriter.cxx
+    vtkImageColorViewer.cxx
+    vtkImageMapToWindowLevelColors2.cxx
+  )
+ELSE("${VTK_MAJOR_VERSION}" GREATER 4)
+  SET(VTKGDCM_LIB_SRCS
+    vtkGdcmReader.cxx
+    vtkGdcmWriter.cxx
+  )
+ENDIF("${VTK_MAJOR_VERSION}" GREATER 4)
 
 #-----------------------------------------------------------------------------
 # Create vtkgdcm library
@@ -28,8 +36,12 @@ TARGET_LINK_LIBRARIES(vtkgdcm
   vtkCommon
   vtkIO
   vtkFiltering
-  vtkRendering
 )
+IF("${VTK_MAJOR_VERSION}" GREATER 4)
+  TARGET_LINK_LIBRARIES(vtkgdcm
+    vtkRendering
+  )
+ENDIF("${VTK_MAJOR_VERSION}" GREATER 4)
 
 #-----------------------------------------------------------------------------
 SET(vtkgdcmdemo_SOURCES
index f672ab91936185c3e0e8609c3dfeb4ee961d7593..d9edf475380444c397d481744044e310d96ca716 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/09/12 13:38:14 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2007/09/12 13:43:10 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 // 
 //----------------------------------------------------------------------------
 #include <vtkRenderWindowInteractor.h>
+#if ( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
 #include "vtkImageColorViewer.h"
+#else
+#include <vtkImageViewer2.h>
+#endif
 #include <vtkStructuredPoints.h>
 #include <vtkStructuredPointsWriter.h>
 #include <vtkCommand.h>
@@ -86,7 +90,11 @@ public:
          }
       }
    }
+#if ( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
    vtkImageColorViewer *ImageViewer;
+#else
+   vtkImageViewer2 *ImageViewer;
+#endif
 };
 
 
@@ -119,7 +127,11 @@ int main(int argc, char *argv[])
    reader->GetOutput()->Print( cout );
 
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
+#if ( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
    vtkImageColorViewer *viewer = vtkImageColorViewer::New();
+#else
+   vtkImageViewer2 *viewer = vtkImageViewer2::New();
+#endif
 
    if( reader->GetLookupTable() )
    {