From: malaterre Date: Wed, 11 May 2005 14:40:56 +0000 (+0000) Subject: ENH: Some minor enhance: X-Git-Tag: Version1.2.bp~726 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=83d6c83bfcdfa88b7f322286136f802e89d5830c;p=gdcm.git ENH: Some minor enhance: 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 --- diff --git a/Example/TestPrintTime.cxx b/Example/TestPrintTime.cxx index 35ddc5a1..06529e29 100644 --- a/Example/TestPrintTime.cxx +++ b/Example/TestPrintTime.cxx @@ -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 // 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: diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index ac8b9df5..68c49b2c 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -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) diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index 2c362f64..8b437783 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -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 #endif -namespace gdcm +namespace gdcm { //----------------------------------------------------------------------------- // Constructor / Destructor diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 2702de2c..61c2652e 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -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; diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 780655e3..6ddba792 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -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 diff --git a/vtk/vtkGdcmWriter.cxx b/vtk/vtkGdcmWriter.cxx index d73ddccc..72f539f2 100644 --- a/vtk/vtkGdcmWriter.cxx +++ b/vtk/vtkGdcmWriter.cxx @@ -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 @@ -27,7 +27,11 @@ #include #include -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 diff --git a/vtk/vtkgdcmViewer.cxx b/vtk/vtkgdcmViewer.cxx index 6526c175..7d68c2f5 100644 --- a/vtk/vtkgdcmViewer.cxx +++ b/vtk/vtkgdcmViewer.cxx @@ -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]); diff --git a/vtk/vtkgdcmViewer2.cxx b/vtk/vtkgdcmViewer2.cxx index 26b93bc1..bb3b8f86 100644 --- a/vtk/vtkgdcmViewer2.cxx +++ b/vtk/vtkgdcmViewer2.cxx @@ -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]);