1 # CMakeLists for Testing purpose
2 # Cxx file that need a file to run should be place aproprietly
4 SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
6 SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests)
8 # add test that does not require data:
9 # They usally return if no argument is given
18 # add tests that require data
20 SET(TEST_SOURCES ${TEST_SOURCES}
21 #PrintHeader.cxx #require test.acr
22 PrintDocument.cxx #require test.acr
26 TestDicomDir.cxx #require DICOMDIR
31 # add test that require VTK:
34 ${GDCM_SOURCE_DIR}/vtk/
36 SET(TEST_SOURCES ${TEST_SOURCES}
40 ENDIF (GDCM_DATA_ROOT)
46 ${GDCM_SOURCE_DIR}/src/
50 CREATE_TEST_SOURCELIST(Tests gdcmTests.cxx ${TEST_SOURCES})
51 ADD_EXECUTABLE(gdcmTests ${Tests})
53 TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering)
55 TARGET_LINK_LIBRARIES(gdcmTests gdcm)
58 SET (TestsToRun ${Tests})
59 REMOVE (TestsToRun gdcmTests.cxx)
61 # Loop over files and create executables
62 FOREACH(file ${TEST_SOURCES})
63 GET_FILENAME_COMPONENT(name ${file} NAME_WE)
65 # ADD_TEST(${name} ${GDCM_TESTS} ${name}
66 # -D ${GDCM_DATA_ROOT}
67 # -T ${GDCM_BINARY_DIR}/Testing/Temporary
68 # -V Baseline/gdcm/${name}.png)
69 # ELSE (GDCM_DATA_ROOT)
70 ADD_TEST(${name} ${GDCM_TESTS} ${name})
71 # ENDIF (GDCM_DATA_ROOT)
72 ENDFOREACH(file ${TEST_SOURCES})
74 #-----------------------------------------------------------------------------
76 # We need to test the reading of all dicom images in the gdcmData directory
77 # First parse this directory and extract all images
79 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
80 FILE(GLOB GDCM_DATA_IMAGES_GLOB
81 "${GDCM_DATA_ROOT}/*.acr"
82 "${GDCM_DATA_ROOT}/*.dcm"
84 ELSE(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
85 # Since there is a bug in cmake 1.8.3, I'll have to do two separate globs
86 FILE(GLOB GDCM_DATA_IMAGES_GLOB_ACR
87 "${GDCM_DATA_ROOT}/*.acr"
89 FILE(GLOB GDCM_DATA_IMAGES_GLOB_DCM
90 "${GDCM_DATA_ROOT}/*.dcm"
92 SET(GDCM_DATA_IMAGES_GLOB ${GDCM_DATA_IMAGES_GLOB_DCM} ${GDCM_DATA_IMAGES_GLOB_ACR})
93 #SET(GDCM_DATA_IMAGES_GLOB ${GDCM_DATA_IMAGES_GLOB_ACR})
94 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
96 # Black list of images known to break lots of readers (efilm, xmedcon ...):
98 "gdcm-JPEG-LossLessThoravision.dcm"
99 "cr172241.dcm" #temporarily remove as it kills my gnome session (but not kde)
100 "emptyImage.dcm" #the png looks ugly...
101 "gdcm-MR-PHILIPS-16-Multi-Seq.fixed.dcm" weird looks exactly the same as gdcm-MR-PHILIPS-16-Multi-Seq.dcm
102 "gdcm-MR-PHILIPS-16.dcm" png looks ugly
103 "irmPhlipsNew1.dcm" png looks ugly
104 "mriThruVPRO.dcm" png looks ugly
105 "US.3405.1.dcm" looks exactly the same as US.1.2.dcm
108 # gdcm-ACR-LibIDO seems to be cut
109 # test.acr is very bright
111 # This is a GLOB expression, change it into a list separated with a comma and \n
112 SET(GDCM_DATA_IMAGES)
113 FOREACH(filename ${GDCM_DATA_IMAGES_GLOB})
114 GET_FILENAME_COMPONENT(filename_temp ${filename} NAME)
115 STRING(REGEX MATCH ${filename_temp} bad_dicom ${BLACK_LIST})
117 SET(GDCM_DATA_IMAGES "${GDCM_DATA_IMAGES}\n\"${filename_temp}\",")
121 # Populate GDCM_DATA_IMAGES:
122 FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataImages.h"
123 "const char * const gdcmDataImages[] = { ${GDCM_DATA_IMAGES}\n0 };\n"