]> Creatis software - gdcm.git/commitdiff
ENH: Some minor enhance:
authormalaterre <malaterre>
Wed, 11 May 2005 14:40:56 +0000 (14:40 +0000)
committermalaterre <malaterre>
Wed, 11 May 2005 14:40:56 +0000 (14:40 +0000)
1. Support compilation of gdcm against VTK 4.2 but not testing
2. Support compilation of gdcm agains VTK <= 4.4.2 but not testing
3. Complain if the version is not matched
4. minor compilation glitch

Example/TestPrintTime.cxx
Testing/CMakeLists.txt
src/gdcmDirList.cxx
src/gdcmFile.cxx
src/gdcmUtil.cxx
vtk/vtkGdcmWriter.cxx
vtk/vtkgdcmViewer.cxx
vtk/vtkgdcmViewer2.cxx

index 35ddc5a1506f581f5670d80dba5d315e999a1db0..06529e2964315a9a2251416fd55c47d251f4a399 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestPrintTime.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/10 12:12:02 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/05/11 14:40:56 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -29,7 +29,7 @@
 #include <iomanip> // for std::ios::left, ...
 
 // Where is it?
-#define CLK_TCK 1
+//#define CLK_TCK 1  ///usr/include/bits/time.h:41: warning: this is the location of the previous definition
 
 
 //Generated file:
index ac8b9df56505cc012eba9aefeb3c04e6206e900b..68c49b2c18fdb6fb6cb5d5284620ce8700d9a0c2 100644 (file)
@@ -42,18 +42,26 @@ IF (GDCM_DATA_ROOT)
   )
   # add test that require VTK:
   IF(GDCM_VTK)
-    # Include the VTK library
-    INCLUDE(${VTK_USE_FILE})
-
-    INCLUDE_DIRECTORIES(
-      ${GDCM_SOURCE_DIR}/vtk/
-    )
-    SET(TEST_SOURCES ${TEST_SOURCES}
-      VTKTestRead.cxx
-      VTKTestReadSeq.cxx
-      VTKTestWrite.cxx
-      VTKTestWriteSeq.cxx
-    )
+    IF(${VTK_MAJOR_VERSION} LESS 4)
+      MESSAGE(FATAL_ERROR "This VTK version is not supported, you are on your own !")
+    ELSE(${VTK_MAJOR_VERSION} LESS 4)
+      IF(${VTK_MAJOR_VERSION} EQUAL 4 AND ${VTK_MINOR_VERSION} EQUAL 4 AND ${VTK_BUILD_VERSION} LESS 3)
+        MESSAGE(FATAL_ERROR "This VTK version is not supported, you are on your own !"
+                             "Although gdcm should compile fine. You just need to turn BUILD_TESTING:=OFF")
+      ENDIF(${VTK_MAJOR_VERSION} EQUAL 4 AND ${VTK_MINOR_VERSION} EQUAL 4 AND ${VTK_BUILD_VERSION} LESS 3)
+      # Include the VTK library since we know this is going to work
+      INCLUDE(${VTK_USE_FILE})
+
+      INCLUDE_DIRECTORIES(
+        ${GDCM_SOURCE_DIR}/vtk/
+      )
+      SET(TEST_SOURCES ${TEST_SOURCES}
+        VTKTestRead.cxx
+        VTKTestReadSeq.cxx
+        VTKTestWrite.cxx
+        VTKTestWriteSeq.cxx
+      )
+    ENDIF(${VTK_MAJOR_VERSION} LESS 4)
   ENDIF(GDCM_VTK)
 ENDIF (GDCM_DATA_ROOT)
 
index 2c362f645bbedf4dfe001f579796471d736d461b..8b437783b08703deedc4fccac6e3cbea6359a686 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDirList.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/18 02:29:07 $
-  Version:   $Revision: 1.49 $
+  Date:      $Date: 2005/05/11 14:40:57 $
+  Version:   $Revision: 1.50 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -31,7 +31,7 @@
    #include <sys/types.h>
 #endif
 
-namespace gdcm 
+namespace gdcm
 {
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
index 2702de2c45e82b91548958f8fb068c680b4a4c5d..61c2652e31592ddfbb59e5c57f632ee77f8b1dec 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/27 10:00:35 $
-  Version:   $Revision: 1.235 $
+  Date:      $Date: 2005/05/11 14:40:57 $
+  Version:   $Revision: 1.236 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -431,7 +431,7 @@ float File::GetYSpacing()
    // if sscanf cannot read any float value, it won't affect yspacing
    int nbValues = sscanf( strSpacing.c_str(), "%f", &yspacing);
 
-   // if no values, xspacing is set to 1.0
+   // if no values, yspacing is set to 1.0
    if( nbValues == 0 )
       yspacing = 1.0;
 
index 780655e3a81a6fcc183fca66f3953d5298ab65f9..6ddba792fd5bcda525715a689687fa3d3d9bb7ff 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/19 09:58:19 $
-  Version:   $Revision: 1.148 $
+  Date:      $Date: 2005/05/11 14:40:57 $
+  Version:   $Revision: 1.149 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -331,18 +331,20 @@ unsigned int Util::GetCurrentThreadID()
 // FIXME the implementation is far from complete
 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
   return (unsigned int)GetCurrentThreadId();
-#endif
+#else
 #ifdef __linux__
    return 0;
    // Doesn't work on fedora, but is in the man page...
    //return (unsigned int)gettid();
-#endif
+#else
 #ifdef __sun
    return (unsigned int)thr_self();
 #else
    //default implementation
    return 0;
-#endif
+#endif // __sun
+#endif // __linux__
+#endif // Win32
 }
 
 unsigned int Util::GetCurrentProcessID()
@@ -448,6 +450,7 @@ bool Util::DicomStringEqual(const std::string &s1, const char *s2)
 #endif //_WIN32
 
 /// \brief gets current M.A.C adress (for internal use only)
+int GetMacAddrSys ( unsigned char *addr );
 int GetMacAddrSys ( unsigned char *addr )
 {
 #ifdef _WIN32
index d73ddccc8decb526cf072b7bdc72e96e55c8a318..72f539f2e0c6f6fdbb2e0ada854e24f2eb32bf59 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmWriter.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/11 17:01:16 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2005/05/11 14:40:58 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include <vtkPointData.h>
 #include <vtkLookupTable.h>
 
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.21 $");
+#ifndef vtkFloatingPointType
+#define vtkFloatingPointType float
+#endif
+
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.22 $");
 vtkStandardNewMacro(vtkGdcmWriter);
 
 //-----------------------------------------------------------------------------
@@ -183,7 +187,7 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image)
    ///       We should perform some checkings before forcing the Entry creation
 
    // Spacing
-   double *sp = image->GetSpacing();
+   vtkFloatingPointType *sp = image->GetSpacing();
 
    str.str("");
    // We are about to enter floating point value. By default ostringstream are smart and don't do fixed point
@@ -196,7 +200,7 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image)
    file->InsertValEntry(str.str(),0x0018,0x0088); // Spacing Between Slices
 
    // Origin
-   double *org = image->GetOrigin();
+   vtkFloatingPointType *org = image->GetOrigin();
 
    /// \todo : Image Position Patient is meaningfull ONLY for CT an MR modality
    ///       We should perform some checkings before forcing the Entry creation
@@ -207,7 +211,7 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image)
    str.unsetf( std::ios::fixed ); //done with floating point values
 
    // Window / Level
-   double *rng=image->GetScalarRange();
+   vtkFloatingPointType *rng = image->GetScalarRange();
 
    str.str("");
    str << rng[1]-rng[0];
@@ -279,6 +283,8 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache,
          {
             sprintf(this->InternalFileName, this->FilePattern,this->FileNumber);
          }
+// Remove this code in case user is using VTK 4.2...
+#if !(VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION == 2)
          if (this->FileNumber < this->MinimumFileNumber)
          {
             this->MinimumFileNumber = this->FileNumber;
@@ -287,6 +293,7 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache,
          {
             this->MaximumFileNumber = this->FileNumber;
          }
+#endif
       }
 
       // Write the file
index 6526c1753482d7afafc3bccfd37eda4ab7476788..7d68c2f57cadacb604d6c22a02c9c166657b2ec5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/02 20:10:50 $
-  Version:   $Revision: 1.24 $
+  Date:      $Date: 2005/05/11 14:40:58 $
+  Version:   $Revision: 1.25 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
    }
    else
    {
-      double *range = reader->GetOutput()->GetScalarRange();
+      vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
       viewer->SetColorLevel (0.5 * (range[1] + range[0]));
       viewer->SetColorWindow (range[1] - range[0]);
 
index 26b93bc1f8df1e1e6ae9161bca932cc2d0f9e7e7..bb3b8f865c7463be23a4689710506414b450fc7d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/02 20:10:50 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/05/11 14:40:58 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
    }
    else
    {
-      double *range = reader->GetOutput()->GetScalarRange();
+      vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
       viewer->SetColorLevel (0.5 * (range[1] + range[0]));
       viewer->SetColorWindow (range[1] - range[0]);