X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FCMakeLists.txt;h=da8c06aa326d994dafc1ceb7e07b54aea3581be0;hb=6d07e1c5ea5f9199082dc3e6873509a189d4f0f7;hp=68c49b2c18fdb6fb6cb5d5284620ce8700d9a0c2;hpb=83d6c83bfcdfa88b7f322286136f802e89d5830c;p=gdcm.git diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index 68c49b2c..da8c06aa 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -8,52 +8,70 @@ SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests) # add test that does not require data: # They usally return if no argument is given SET(TEST_SOURCES + TestEmpty.cxx TestUtil.cxx TestBug.cxx TestHash.cxx + TestCommand.cxx TestTS.cxx TestVR.cxx TestDictGroupName.cxx TestDict.cxx + TestDataEntry.cxx TestWriteSimple.cxx TestImageSet.cxx TestDicomDirElement.cxx TestDicomString.cxx + TestEnumVR.cxx + TestBuildUpDicomDir.cxx # writes a file named "NewDICOMDIR" ) +IF(UNIX) + SET(TEST_SOURCES ${TEST_SOURCES} + #TestInline.cxx + ) +ENDIF(UNIX) # add tests that require data IF (GDCM_DATA_ROOT) SET(TEST_SOURCES ${TEST_SOURCES} TestFileAccessors.cxx TestMakeIcon.cxx - TestPrintAllDocument.cxx # includes generated gdcmDataImages.h - TestAllEntryVerify.cxx # includes generated gdcmDataImages.h - TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h - TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h - #TestCopyDicom.cxx # includes generated gdcmDataImages.h - TestCopyRescaleDicom.cxx # includes generated gdcmDataImages.h + TestLoadAllDocumentsNoPrivNoSeq.cxx # includes generated gdcmDataImages.h + #TestLoadAllDocumentsNoShadow.cxx # includes generated gdcmDataImages.h + TestPrintAllDocument.cxx # includes generated gdcmDataImages.h + #TestAllEntryVerify.cxx # includes generated gdcmDataImages.h + TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h + TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h + #TestCopyDicom.cxx # includes generated gdcmDataImages.h + # TestCopyRescaleDicom.cxx # includes generated gdcmDataImages.h #TestChangeHeader.cxx - TestAnonymize.cxx + # TestAnonymize.cxx TestDirList.cxx TestDicomDir.cxx # require DICOMDIR - TestBuildUpDicomDir.cxx # writes a file named "NewDICOMDIR" + TestMakeDicomDir.cxx # writes a file named "NewDICOMDIR" TestSerieHelper.cxx # uses gdcmData as a default root directory + TestAllVM.cxx + TestValidate.cxx #Just to have on overviews of oddities ... ) # add test that require VTK: IF(GDCM_VTK) - IF(${VTK_MAJOR_VERSION} LESS 4) + 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) + ELSE("${VTK_MAJOR_VERSION}" LESS 4) + IF("${VTK_MAJOR_VERSION}" EQUAL 4 AND "${VTK_MINOR_VERSION}" EQUAL 2) 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) + ENDIF("${VTK_MAJOR_VERSION}" EQUAL 4 AND "${VTK_MINOR_VERSION}" EQUAL 2) + 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/ + ${GDCM_SOURCE_DIR}/vtk ) SET(TEST_SOURCES ${TEST_SOURCES} VTKTestRead.cxx @@ -61,7 +79,7 @@ IF (GDCM_DATA_ROOT) VTKTestWrite.cxx VTKTestWriteSeq.cxx ) - ENDIF(${VTK_MAJOR_VERSION} LESS 4) + ENDIF("${VTK_MAJOR_VERSION}" LESS 4) ENDIF(GDCM_VTK) ENDIF (GDCM_DATA_ROOT) @@ -69,14 +87,18 @@ ENDIF (GDCM_DATA_ROOT) # include stuff INCLUDE_DIRECTORIES( - ${GDCM_SOURCE_DIR}/src/ - ${GDCM_BINARY_DIR}/ + ${GDCM_SOURCE_DIR}/src + ${GDCM_BINARY_DIR} ) CREATE_TEST_SOURCELIST(Tests gdcmTests.cxx ${TEST_SOURCES}) ADD_EXECUTABLE(gdcmTests ${Tests}) IF(GDCM_VTK) - TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering) + IF(GDCM_DATA_ROOT) + TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering) + ELSE(GDCM_DATA_ROOT) + TARGET_LINK_LIBRARIES(gdcmTests gdcm) + ENDIF(GDCM_DATA_ROOT) ELSE(GDCM_VTK) TARGET_LINK_LIBRARIES(gdcmTests gdcm) ENDIF(GDCM_VTK) @@ -95,57 +117,15 @@ 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 -IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) - FILE(GLOB GDCM_DATA_IMAGES_GLOB - "${GDCM_DATA_ROOT}/*.acr" - "${GDCM_DATA_ROOT}/*.dcm" - "${GDCM_DATA_ROOT}/*.nema" - "${GDCM_DATA_ROOT}/*.ima" - ) - FILE(GLOB GDCM_DATA_SEQ_IMAGES_GLOB - "${GDCM_DATA_ROOT}/*FileSeq0.acr" - "${GDCM_DATA_ROOT}/*FileSeq0.dcm" - "${GDCM_DATA_ROOT}/*FileSeq0.nema" - "${GDCM_DATA_ROOT}/*FileSeq0.ima" - ) -ELSE(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) - # Since there is a bug in cmake 1.8.3, I'll have to do two separate globs - FILE(GLOB GDCM_DATA_IMAGES_GLOB_ACR - "${GDCM_DATA_ROOT}/*.acr" - ) - FILE(GLOB GDCM_DATA_IMAGES_GLOB_DCM - "${GDCM_DATA_ROOT}/*.dcm" - ) - FILE(GLOB GDCM_DATA_IMAGES_GLOB_NEMA - "${GDCM_DATA_ROOT}/*.nema" - ) - FILE(GLOB GDCM_DATA_IMAGES_GLOB_IMA - "${GDCM_DATA_ROOT}/*.ima" - ) - SET(GDCM_DATA_IMAGES_GLOB - ${GDCM_DATA_IMAGES_GLOB_DCM} ${GDCM_DATA_IMAGES_GLOB_ACR} - ${GDCM_DATA_IMAGES_GLOB_NEMA} ${GDCM_DATA_IMAGES_GLOB_IMA}) - - FILE(GLOB GDCM_DATA_SEQ_IMAGES_GLOB_ACR - "${GDCM_DATA_ROOT}/*FileSeq0.acr" - ) - FILE(GLOB GDCM_DATA_SEQ_IMAGES_GLOB_DCM - "${GDCM_DATA_ROOT}/*FileSeq0.dcm" - ) - FILE(GLOB GDCM_DATA_SEQ_IMAGES_GLOB_NEMA - "${GDCM_DATA_ROOT}/*FileSeq0.nema" - ) - FILE(GLOB GDCM_DATA_SEQ_IMAGES_GLOB_IMA - "${GDCM_DATA_ROOT}/*FileSeq0.ima" - ) - SET(GDCM_DATA_SEQ_IMAGES_GLOB - ${GDCM_DATA_SEQ_IMAGES_GLOB_DCM} ${GDCM_DATA_SEQ_IMAGES_GLOB_ACR} - ${GDCM_DATA_SEQ_IMAGES_GLOB_NEMA} ${GDCM_DATA_SEQ_IMAGES_GLOB_IMA}) -ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) +FILE(GLOB GDCM_DATA_IMAGES_GLOB + "${GDCM_DATA_ROOT}/*.acr" + "${GDCM_DATA_ROOT}/*.dcm" + "${GDCM_DATA_ROOT}/*.nema" + "${GDCM_DATA_ROOT}/*.ima" + ) # Black list of images known to break lots of readers (efilm, xmedcon ...): SET(BLACK_LIST - # Multiframe Papyrus format image # Just to remember this format exists, and is gdcm::File compliant # (NOT gdcm::FileHelper ...) @@ -154,12 +134,44 @@ SET(BLACK_LIST # From David Clunie's Compresion Dataset "D_CLUNIE_CT1_JLSN.dcm" "D_CLUNIE_CT1_JLSL.dcm" - "D_CLUNIE_CT1_J2KR.dcm" - "D_CLUNIE_CT1_J2KI.dcm" #Not a Dicom Image, but a RT Object "RS2.16.124.113534.2.3.5.0.120040728.21342.353.12747_anonimized.dcm" #Dicom MPEG image - "ETIAM_video_002.dcm" + "ETIAM_video_002.dcm" + #Something stupid occured in the code for LibIDO images. + #I Black list them for a while. JP + #"gdcm-ACR-LibIDO.acr" + "LIBIDO-24-ACR_NEMA-Rectangle.dcm" + #16 Bits per pixel images with LUT 16 Bits. + #I wait to be 100% sure before releasing them. JP + "rle16sti.dcm" + "rle16loo.dcm" + # Jasper cannot handle this image, only kakadu so far, unless you patch jasper + # but then it breaks other images... + "CT_Phillips_JPEG2K_Decompr_Problem.dcm" + # + # ------------ + # + #Still cause troubles (see the .README.txt file for more details) + "MR_Philips_Intera_in_SQ_2001_e05f_item_wrong_lgt_use_NOSHADOWSEQ.dcm" + "MR_Philips_Intera_PrivateSequenceExplicitVR.dcm" + #The 2 previous images are identical ! + #--> Replaced by more significant name + "MR_Philips_Intera_PrivateSequenceExplicitVR_in_SQ_2001_e05f_item_wrong_lgt_use_NOSHADOWSEQ.dcm" + + #hexedit shows something *very* strange around offset 0x76e ! + #the images looks *over*corrupted (on disc, not from the manufacturer!) + "MR_Philips_Intera_PrivateSequenceImplicitVR.dcm" + + # Seems this one hangs on 64 bits processors ?!? + # I blacklist it untill the pb is solved. + # (to get some more green on the Dasboards) + "MR_Philips-Intera_BreaksNOSHADOW.dcm" + ) + +# Create a specific list of dicom files that we know are part of a sequence +SET(SEQ_LIST + "SIEMENS_MAGNETOM-12-MONO2-FileSeq[0-9].dcm" ) # Add a special test that requires dciodvfy from dicom3tools @@ -167,6 +179,7 @@ INCLUDE(${GDCM_SOURCE_DIR}/CMake/FindDicom3Tools.cmake) # This is a GLOB expression, change it into a list separated with a comma and \n SET(GDCM_DATA_IMAGES) +SET(GDCM_DATA_SEQ_IMAGES) FOREACH(filename ${GDCM_DATA_IMAGES_GLOB}) GET_FILENAME_COMPONENT(filename_temp ${filename} NAME) IF(DCIODVFY_FOUND) @@ -176,17 +189,11 @@ FOREACH(filename ${GDCM_DATA_IMAGES_GLOB}) STRING(REGEX MATCH ${filename_temp} bad_dicom ${BLACK_LIST}) IF(NOT bad_dicom) SET(GDCM_DATA_IMAGES "${GDCM_DATA_IMAGES}\n\"${filename_temp}\",") - ENDIF(NOT bad_dicom) -ENDFOREACH(filename) - -SET(GDCM_DATA_SEQ_IMAGES) -FOREACH(filename ${GDCM_DATA_SEQ_IMAGES_GLOB}) - GET_FILENAME_COMPONENT(filename_temp ${filename} NAME) - STRING(REGEX MATCH ${filename_temp} bad_dicom ${BLACK_LIST}) - IF(NOT bad_dicom) - STRING(REGEX REPLACE "(.*)FileSeq0(.*)" "\\1FileSeq%d\\2" filename_temp2 ${filename_temp}) - - SET(GDCM_DATA_SEQ_IMAGES "${GDCM_DATA_SEQ_IMAGES}\n\"${filename_temp2}\",") + # SEQ_LIST is a regular expression: + STRING(REGEX MATCH ${SEQ_LIST} is_seq ${filename_temp}) + IF(is_seq) + SET(GDCM_DATA_SEQ_IMAGES "${GDCM_DATA_SEQ_IMAGES}\n\"${filename_temp}\",") + ENDIF(is_seq) ENDIF(NOT bad_dicom) ENDFOREACH(filename) @@ -199,3 +206,34 @@ FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataImages.h" FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataSeqImages.h" "const char * const gdcmDataSeqImages[] = { ${GDCM_DATA_SEQ_IMAGES}\n0 };\n" ) + +#----------------------------------------------------------------------------- +# Trying to solve a bizarre problem when loading shared lib if gdcm is static +# Therefore I disable the test when building SHAREDLIBS +IF(UNIX AND NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(dynmodule MODULE dynmodule.cxx) + TARGET_LINK_LIBRARIES(dynmodule gdcm) + ADD_EXECUTABLE(loadmodule loadmodule.cxx ) + TARGET_LINK_LIBRARIES(loadmodule gdcm -ldl) + ADD_TEST(loadmodule ${CXX_TEST_PATH}/loadmodule) +ENDIF(UNIX AND NOT BUILD_SHARED_LIBS) + + +#----------------------------------------------------------------------------- +# Do the build against an installed gdcm +SET(GDCM_TEST_INSTALL_LEFT "${CMAKE_INSTALL_PREFIX}") +SET(GDCM_TEST_INSTALL_RIGHT "${GDCM_BINARY_DIR}/InstallTest/Root") +STRING(COMPARE EQUAL "${GDCM_TEST_INSTALL_LEFT}" "${GDCM_TEST_INSTALL_RIGHT}" + GDCM_TEST_INSTALL) +IF(GDCM_TEST_INSTALL) + ADD_TEST(Install + ${CMAKE_CTEST_COMMAND} + # ${GDCM_INSTALL_TEST_CONFIG_TYPE} + --build-and-test ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + --build-generator ${CMAKE_GENERATOR} + --build-project GDCM + --build-makeprogram ${CMAKE_MAKE_PROGRAM} + --build-noclean + --build-target install) +ENDIF(GDCM_TEST_INSTALL) +