]> Creatis software - gdcm.git/commitdiff
Add a new test: ShowDicom, for now this is just the c++ version of
authormalaterre <malaterre>
Sun, 2 May 2004 23:48:43 +0000 (23:48 +0000)
committermalaterre <malaterre>
Sun, 2 May 2004 23:48:43 +0000 (23:48 +0000)
       checkRead.sh, later it will be able to compare the image read against a
       baseline.

ChangeLog
Testing/CMakeLists.txt
gdcmPython/CMakeLists.txt

index 04801c0dfaa0def8b8a44641f5eb0c1b75574ece..813b1e90f65f407c79963382d317b23518de94e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-02  Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
+     * Add a new test: ShowDicom, for now this is just the c++ version of
+       checkRead.sh, later it will be able to compare the image read against a
+       baseline.
+
 2004-04-30  Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
      * Add an example subdir, with a real example on how to read + write a 
        dicom image
index 6c5a415dcacc7e7460996837d99529f8ef272205..2cdda5f9ee93e5d02e32ad175b5445411acd0b81 100644 (file)
@@ -16,20 +16,29 @@ SET(TEST_SOURCES
 
 # add tests that require data
 IF (GDCM_DATA_ROOT)
-SET(TEST_SOURCES ${TEST_SOURCES}     
-  PrintHeader.cxx     #require test.acr
-  PrintDicomDir.cxx
-  pourFindTaggs.cxx
-  testChangeEntete.cxx
-  testDicomDir.cxx    #require DICOMDIR
-  BuildUpDicomDir.cxx
-  TestReadWrite.cxx
-
-# Disable makeDicomDir for now
-#  makeDicomDir.cxx
-)
+  SET(TEST_SOURCES ${TEST_SOURCES}     
+    PrintHeader.cxx       #require test.acr
+    PrintDicomDir.cxx
+    pourFindTaggs.cxx
+    testChangeEntete.cxx
+    testDicomDir.cxx      #require DICOMDIR
+    BuildUpDicomDir.cxx
+    TestReadWrite.cxx
+    makeDicomDir.cxx
+  )
+  # add test that require VTK:
+  IF(GDCM_VTK)
+    INCLUDE_DIRECTORIES(
+      ${GDCM_SOURCE_DIR}/vtk/
+      )
+    SET(TEST_SOURCES ${TEST_SOURCES}
+      ShowDicom.cxx    
+      )
+  ENDIF(GDCM_VTK)
 ENDIF (GDCM_DATA_ROOT)
 
+
+
 # include stuff
 INCLUDE_DIRECTORIES(
   ${GDCM_SOURCE_DIR}/src/
@@ -38,7 +47,12 @@ INCLUDE_DIRECTORIES(
 
 CREATE_TEST_SOURCELIST(Tests gdcmTests.cxx ${TEST_SOURCES})
 ADD_EXECUTABLE(gdcmTests ${Tests})
-TARGET_LINK_LIBRARIES(gdcmTests gdcm)
+IF(GDCM_VTK)
+  TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering)
+ELSE(GDCM_VTK)
+  TARGET_LINK_LIBRARIES(gdcmTests gdcm)
+ENDIF(GDCM_VTK)
+
 SET (TestsToRun ${Tests})
 REMOVE (TestsToRun gdcmTests.cxx)
 
@@ -55,6 +69,31 @@ FOREACH(file ${TEST_SOURCES})
 #  ENDIF (GDCM_DATA_ROOT)
 ENDFOREACH(file ${TEST_SOURCES})
 
+#-----------------------------------------------------------------------------
+
+# We need to test the reading of all dicom images in the gdcmData directory
+# First parse this directory and extract all images
+
+# For now only *.dcm will be picked up, since there is a bug in cmake 1.8.3
+# and I don't know how to work around
+FILE(GLOB GDCM_DATA_IMAGES_GLOB 
+  "${GDCM_DATA_ROOT}/*.dcm"
+#  "${GDCM_DATA_ROOT}/*.acr"
+  )
 
+# This is a GLOB expression, change it into a list separated with a comma and \n
+SET(GDCM_DATA_IMAGES)
+FOREACH(filename ${GDCM_DATA_IMAGES_GLOB})
+  SET(GDCM_DATA_IMAGES "${GDCM_DATA_IMAGES}\n\"${filename}\",")
+ENDFOREACH(filename)
 
+# Populate GDCM_DATA_IMAGES:
+FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataImages.h.in"
+  "const char * const gdcmDataImages[] = { @GDCM_DATA_IMAGES@ \n 0 };" 
+  )
 
+# Generate the header file:
+CONFIGURE_FILE(
+  ${GDCM_BINARY_DIR}/gdcmDataImages.h.in
+  ${GDCM_BINARY_DIR}/gdcmDataImages.h
+  )
index 2d47656509efcd7a6fee17579f5cf26277016658..9a96db541983222e1dedaa3ba3098dba043484d1 100644 (file)
@@ -1,6 +1,3 @@
-#IF(GDCM_WRAP_PYTHON)
-#If we reach this dir we have selected this option
-
 # TODO
 # http://www.cmake.org/pipermail/cmake/2003-August/004185.html
 # http://www.cmake.org/pipermail/cmake/2003-January/001092.html
@@ -11,24 +8,20 @@ INCLUDE_DIRECTORIES(
   ${GDCM_BINARY_DIR}/
 )
 
-SET(GDCM_INC
-  ${GDCM_SOURCE_DIR}/src
-)
-
-SET(SWIG_INC
-  ${PYTHON_INCLUDES}
-  ${GDCM_INC}
-)
+#-----------------------------------------------------------------------------
+# SWIG Wrapping
+#
 
+# Since the file gdcm_wrap.cxx does not exist, mark it as GENERATED:
 SET_SOURCE_FILES_PROPERTIES(gdcm_wrap.cxx GENERATED)
-
 ADD_LIBRARY(pygdcm gdcm_wrap.cxx)
-# http://www.cmake.org/pipermail/cmake/2003-August/004190.html
-# SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "_")
+
 TARGET_LINK_LIBRARIES(pygdcm 
   ${PYTHON_LIBRARY}
   gdcm
 )
+# http://www.cmake.org/pipermail/cmake/2003-August/004190.html
+# SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "_")
 
 #-----------------------------------------------------------------------------
 # SWIG Wrapping
@@ -38,16 +31,19 @@ TARGET_LINK_LIBRARIES(pygdcm
 # later we should use SWIG instead of swig
 # Build our custom command :
 ADD_CUSTOM_COMMAND(
-  SOURCE    ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i
+  TARGET    pygdcm
   COMMAND   swig
   ARGS      -python -c++ -I${GDCM_SOURCE_DIR}/src -o 
             ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx 
             ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i 
-  TARGET    pygdcm
+  SOURCE    ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i
   OUTPUTS   ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx
-  COMMENT   "Generating gdcm_wrap.cxx based on gdcm.i"
+  COMMENT   "Generating gdcm_wrap.cxx/gdcm.py based on gdcm.i"
 )
 
+# This swig command will also outputs gdcm.py :
+SET_SOURCE_FILES_PROPERTIES(gdcm.py GENERATED)
+
 #-----------------------------------------------------------------------------
 # VTK Wrapping
 # 
@@ -84,20 +80,26 @@ IF(GDCM_VTK)
       ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in
       ${GDCM_BINARY_DIR}/setup.py
   )
-
+  #MESSAGE(STATUS ${VTKPATH})
 ENDIF(GDCM_VTK)
 
-#I should install in path of PYTHON_LIBRARY
-#GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH)
-#GET_FILENAME_COMPONENT(SITEPACKAGE ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE)
+#-----------------------------------------------------------------------------
+# Install stuff:
+
+#Should install in path of PYTHON_LIBRARY and not the default CMAKE_INSTALL_PREFIX
+
+GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH)
+GET_FILENAME_COMPONENT(SITEPACKAGE 
+  ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE)
 #MESSAGE(STATUS ${SITEPACKAGE})
 #INSTALL_FILES(/include "\\.h$")
 #INSTALL_TARGETS(/lib/ gdcm)
 
-#INSTALL_TARGETS(/lib/ gdcm.py)
 # gdcm.py is a file generated by swig
 # then from python you can do import gdcm, and it will load _gdcm.so
-INSTALL_FILES(/lib/ .py gdcm.py)
+#INSTALL_TARGETS(/lib/ gdcm.py)
+#INSTALL_PROGRAMS(/lib/ gdcm.py)
+#INSTALL_FILES(/lib/ .py gdcm.py)
 
 # When installing swig-generated python module one should pay attention
 # to library naming convention, see here for more detail: