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
15 # add tests that require data
17 SET(TEST_SOURCES ${TEST_SOURCES}
18 TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h
19 PrintAllDocument.cxx # includes generated gdcmDataImages.h
20 TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h
21 TestAllEntryVerify.cxx # includes generated gdcmDataImages.h
24 TestDicomDir.cxx # require DICOMDIR
25 BuildUpDicomDir.cxx # writes a file named "NewDICOMDIR"
26 makeDicomDir.cxx # writes a file named "NewDICOMDIR"
29 # add test that require VTK:
32 ${GDCM_SOURCE_DIR}/vtk/
34 SET(TEST_SOURCES ${TEST_SOURCES}
38 ENDIF (GDCM_DATA_ROOT)
44 ${GDCM_SOURCE_DIR}/src/
48 CREATE_TEST_SOURCELIST(Tests gdcmTests.cxx ${TEST_SOURCES})
49 ADD_EXECUTABLE(gdcmTests ${Tests})
51 TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering)
53 TARGET_LINK_LIBRARIES(gdcmTests gdcm)
56 SET (TestsToRun ${Tests})
57 REMOVE (TestsToRun gdcmTests.cxx)
59 # Loop over files and create executables
60 FOREACH(file ${TEST_SOURCES})
61 GET_FILENAME_COMPONENT(name ${file} NAME_WE)
63 # ADD_TEST(${name} ${GDCM_TESTS} ${name}
64 # -D ${GDCM_DATA_ROOT}
65 # -T ${GDCM_BINARY_DIR}/Testing/Temporary
66 # -V Baseline/gdcm/${name}.png)
67 # ELSE (GDCM_DATA_ROOT)
68 ADD_TEST(${name} ${GDCM_TESTS} ${name})
69 # ENDIF (GDCM_DATA_ROOT)
70 ENDFOREACH(file ${TEST_SOURCES})
72 #-----------------------------------------------------------------------------
74 # We need to test the reading of all dicom images in the gdcmData directory
75 # First parse this directory and extract all images
77 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
78 FILE(GLOB GDCM_DATA_IMAGES_GLOB
79 "${GDCM_DATA_ROOT}/*.acr"
80 "${GDCM_DATA_ROOT}/*.dcm"
81 "${GDCM_DATA_ROOT}/*.nema"
82 "${GDCM_DATA_ROOT}/*.ima"
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 FILE(GLOB GDCM_DATA_IMAGES_GLOB_NEMA
93 "${GDCM_DATA_ROOT}/*.nema"
95 FILE(GLOB GDCM_DATA_IMAGES_GLOB_IMA
96 "${GDCM_DATA_ROOT}/*.ima"
98 SET(GDCM_DATA_IMAGES_GLOB
99 ${GDCM_DATA_IMAGES_GLOB_DCM} ${GDCM_DATA_IMAGES_GLOB_ACR}
100 ${GDCM_DATA_IMAGES_GLOB_NEMA} ${GDCM_DATA_IMAGES_GLOB_IMA})
101 #SET(GDCM_DATA_IMAGES_GLOB ${GDCM_DATA_IMAGES_GLOB_ACR})
102 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
104 # Black list of images known to break lots of readers (efilm, xmedcon ...):
106 # serial killer (also segfaults vtkgdcmViewer, but NOT PrintFile)
107 "gdcm-JPEG-LossLessThoravision.dcm"
108 #temporarily remove as it kills my gnome session (but not kde)
109 "KODAK-12-MONO1-Odd_Terminated_Sequence.dcm"
113 "PHILIPS_Gyroscan-8-MONO2-Odd_Sequence.dcm"
116 #segfaults TestReadWriteReadCompare (same pb as below)
117 "gdcm-MR-SIEMENS-16-1.acr"
118 # see comments in gdcmData ref file TestAllEntryVerifyReference.txt
119 "SIEMENS_GBS_III-16-ACR_NEMA_1.acr"
120 #segfaults TestReadWriteReadCompare (pixels not parsed properly):
122 "PICKER-16-MONO2-Nested_icon.dcm"
123 "SIEMENS_Sonata-16-MONO2-Value_Multiplicity.dcm"
124 # Fails on TestAllReadCompareDicom at the RE-reading stage with message:
125 # Big trouble : Pixel Element (7fe0,10) NOT found
126 # The temporary file GDCMDATAHOME/BaselineDicom/SIEMENS_Sonata-12-MONO2-SQ.dcm
127 # stops after the first binEntry (binary entry) as can be seen with
128 # " gdcmbin/bin/PrintHeader
129 # GDCMDATAHOME/BaselineDicom/SIEMENS_Sonata-12-MONO2-SQ.dcm "
130 # and effectively the pixels are missing (as well as all the entries
131 # after tag 0029|1010)
132 # Note: this file was previously known as E00001S03I0015.dcm
133 "SIEMENS_Sonata-12-MONO2-SQ.dcm"
134 # As of 14/09 this image creates a crash:
135 #Program received signal SIGSEGV, Segmentation fault.
136 #0x4032bc4b in gdcmHeader::GetLUTRGBA (this=0x8149228) at /home/malaterre/Creatis/gdcm/src/gdcmHeader.cxx:1170
137 #1170 *a = lutR[i*mult+1];
141 # gdcm-ACR-LibIDO seems to be cut
142 # test.acr is very bright
144 # This is a GLOB expression, change it into a list separated with a comma and \n
145 SET(GDCM_DATA_IMAGES)
146 FOREACH(filename ${GDCM_DATA_IMAGES_GLOB})
147 GET_FILENAME_COMPONENT(filename_temp ${filename} NAME)
148 STRING(REGEX MATCH ${filename_temp} bad_dicom ${BLACK_LIST})
150 SET(GDCM_DATA_IMAGES "${GDCM_DATA_IMAGES}\n\"${filename_temp}\",")
154 # Populate GDCM_DATA_IMAGES:
155 FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataImages.h"
156 "const char * const gdcmDataImages[] = { ${GDCM_DATA_IMAGES}\n0 };\n"