Browse files

BUG: Testing data was missing, and in the wrong location

The .raw files that correspond to the .mhd files were missing in the git submission
because .raw files are not permitted in the git repository.  Created teh external project
add DATA{} mechanism to allow these files to be downloaded at build time.
  • Loading branch information...
1 parent dbb61c5 commit a4336641b3e97eedbde45f48fdd4caac1433c83a @hjmjohnson hjmjohnson committed Nov 22, 2012
View
122 ConvertBetweenFileFormats/CMakeLists.txt
@@ -1,100 +1,124 @@
# This project is intended to be built outside the Insight source tree
-PROJECT(ConvertBetweenFileFormats)
+project(ConvertBetweenFileFormats)
-CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/castconvertConfigure.h.in
+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/castconvertConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/castconvertConfigure.h @ONLY IMMEDIATE )
-ADD_EXECUTABLE(ConvertBetweenFileFormats castconvert.cxx castconvertDicomScalar.cxx castconvertScalar.cxx castconvertScalar2D.cxx castconvertScalar3D.cxx castconvertScalar4D.cxx castconvertScalar4DA.cxx castconvertScalar2DA.cxx castconvertScalar3DA.cxx castconvertDicomScalarA.cxx)
+add_executable(ConvertBetweenFileFormats castconvert.cxx castconvertDicomScalar.cxx castconvertScalar.cxx castconvertScalar2D.cxx castconvertScalar3D.cxx castconvertScalar4D.cxx castconvertScalar4DA.cxx castconvertScalar2DA.cxx castconvertScalar3DA.cxx castconvertDicomScalarA.cxx)
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
)
-TARGET_LINK_LIBRARIES(ConvertBetweenFileFormats ${ITK_LIBRARIES} )
-IF (VTK_FOUND)
- TARGET_LINK_LIBRARIES(ConvertBetweenFileFormats vtkIO vtkCommon vtkFiltering vtkImaging )
- INCLUDE_DIRECTORIES( ${ITKApps_SOURCE_DIR}/Auxiliary/vtk )
-ENDIF (VTK_FOUND)
+target_link_libraries(ConvertBetweenFileFormats ${ITK_LIBRARIES} )
+if(VTK_FOUND)
+ target_link_libraries(ConvertBetweenFileFormats vtkIO vtkCommon vtkFiltering vtkImaging )
+ include_directories( ${ITKApps_SOURCE_DIR}/Auxiliary/vtk )
+endif(VTK_FOUND)
-INSTALL_TARGETS(/bin ConvertBetweenFileFormats)
+install_targets(/bin ConvertBetweenFileFormats)
-IF( BUILD_TESTING )
- SET(CXX_TEST_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
- SET(CONVERT_TESTS ${CXX_TEST_PATH}/ConvertBetweenFileFormats)
+if( BUILD_TESTING )
- SET(IMAGE_PATH ${ConvertBetweenFileFormats_SOURCE_DIR}/Testing/Data)
- SET(IMAGE_PATH_OUTPUTS ${ConvertBetweenFileFormats_BINARY_DIR})
+ set(IMAGE_PATH_OUTPUTS ${ConvertBetweenFileFormats_BINARY_DIR})
# Convert from grayscale mhd to other image file formats
- ADD_TEST(ccvnt_to_png ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.png)
- ADD_TEST(ccvnt_to_jpg_unsigned_int ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.jpg unsigned_int)
- ADD_TEST(ccvnt_to_tiff ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.tiff)
- ADD_TEST(ccvnt_to_analyze75 ${CONVERT_TESTS} ${IMAGE_PATH}/BigEndian.mhd ${IMAGE_PATH_OUTPUTS}/image_out.img)
- ADD_TEST(ccvnt_to_bmp_unsigned_char ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.bmp unsigned_char)
- ADD_TEST(ccvnt_to_nrrd_float ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.nrrd float)
- ADD_TEST(ccvnt_to_vtk_long ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.vtk long)
- ADD_TEST(ccvnt_to_gipl ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.gipl)
- ADD_TEST(ccvnt_to_nifti ${CONVERT_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_out.nii.gz)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_png COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.png)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_jpg_unsigned_int COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.jpg unsigned_int)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_tiff COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.tiff)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_analyze75 COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/BigEndian.mhd,BigEndian.raw} ${IMAGE_PATH_OUTPUTS}/image_out.img)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_bmp_unsigned_char COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.bmp unsigned_char)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_nrrd_float COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.nrrd float)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_vtk_long COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.vtk long)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_gipl COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.gipl)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_to_nifti COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_out.nii.gz)
# Convert back to mhd
- ADD_TEST(ccvnt_from_png ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.png ${IMAGE_PATH_OUTPUTS}/image_in1.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_png COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.png ${IMAGE_PATH_OUTPUTS}/image_in1.mhd)
set_tests_properties(ccvnt_from_png PROPERTIES DEPENDS ccvnt_to_png)
- ADD_TEST(ccvnt_from_jpg_unsigned_int ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.jpg ${IMAGE_PATH_OUTPUTS}/image_in2.mhd unsigned_short)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_jpg_unsigned_int COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.jpg ${IMAGE_PATH_OUTPUTS}/image_in2.mhd unsigned_short)
set_tests_properties(ccvnt_from_jpg_unsigned_int PROPERTIES DEPENDS ccvnt_to_jpg_unsigned_int)
- ADD_TEST(ccvnt_from_tiff ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.tiff ${IMAGE_PATH_OUTPUTS}/image_in3.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_tiff COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.tiff ${IMAGE_PATH_OUTPUTS}/image_in3.mhd)
set_tests_properties(ccvnt_from_tiff PROPERTIES DEPENDS ccvnt_to_tiff)
- ADD_TEST(ccvnt_from_analyze75 ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.hdr ${IMAGE_PATH_OUTPUTS}/image_in4.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_analyze75 COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.hdr ${IMAGE_PATH_OUTPUTS}/image_in4.mhd)
set_tests_properties(ccvnt_from_analyze75 PROPERTIES DEPENDS ccvnt_to_analyze75)
#
# Disabling this test because BMP are now only supporting reading of RGB images.
- # ADD_TEST(ccvnt_from_bmp_unsigned_char ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.bmp ${IMAGE_PATH_OUTPUTS}/image_in5.mhd unsigned_short)
+ # ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_bmp_unsigned_char COMMAND
+ # $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.bmp ${IMAGE_PATH_OUTPUTS}/image_in5.mhd unsigned_short)
#
- ADD_TEST(ccvnt_from_nrrd_float ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.nrrd ${IMAGE_PATH_OUTPUTS}/image_in6.mhd unsigned_short)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_nrrd_float COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.nrrd ${IMAGE_PATH_OUTPUTS}/image_in6.mhd unsigned_short)
set_tests_properties(ccvnt_from_nrrd_float PROPERTIES DEPENDS ccvnt_to_nrrd_float)
- ADD_TEST(ccvnt_from_vtk_long ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.vtk ${IMAGE_PATH_OUTPUTS}/image_in7.mhd unsigned_short)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_vtk_long COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.vtk ${IMAGE_PATH_OUTPUTS}/image_in7.mhd unsigned_short)
set_tests_properties(ccvnt_from_vtk_long PROPERTIES DEPENDS ccvnt_to_vtk_long)
- ADD_TEST(ccvnt_from_gipl ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.gipl ${IMAGE_PATH_OUTPUTS}/image_in8.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_gipl COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.gipl ${IMAGE_PATH_OUTPUTS}/image_in8.mhd)
set_tests_properties(ccvnt_from_gipl PROPERTIES DEPENDS ccvnt_to_gipl)
- ADD_TEST(ccvnt_from_nifti ${CONVERT_TESTS} ${IMAGE_PATH_OUTPUTS}/image_out.nii.gz ${IMAGE_PATH_OUTPUTS}/image_in8.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME ccvnt_from_nifti COMMAND
+ $<TARGET_FILE:ConvertBetweenFileFormats> ${IMAGE_PATH_OUTPUTS}/image_out.nii.gz ${IMAGE_PATH_OUTPUTS}/image_in8.mhd)
set_tests_properties(ccvnt_from_nifti PROPERTIES DEPENDS ccvnt_to_nifti)
- SET(IMAGE_COMPARE_TESTS ${CXX_TEST_PATH}/ImageCompareTests)
-
# Compare with original png
- ADD_TEST(compare_png ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in1.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_png COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in1.mhd Dummy)
set_tests_properties(compare_png PROPERTIES DEPENDS ccvnt_from_png)
- #ADD_TEST(compare_jpg_unsigned_int ${IMAGE_COMPARE_TESTS} ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in2.mhd)
- ADD_TEST(compare_tiff ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in3.mhd Dummy)
+ #ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_jpg_unsigned_int COMMAND
+ # $<TARGET_FILE:ImageCompareTests> DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in2.mhd)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_tiff COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in3.mhd Dummy)
set_tests_properties(compare_tiff PROPERTIES DEPENDS ccvnt_from_tiff)
- ADD_TEST(compare_analyze75 ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/BigEndian.mhd ${IMAGE_PATH_OUTPUTS}/image_in4.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_analyze75 COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/BigEndian.mhd,BigEndian.raw} ${IMAGE_PATH_OUTPUTS}/image_in4.mhd Dummy)
set_tests_properties(compare_analyze75 PROPERTIES DEPENDS ccvnt_from_analyze75)
#
# Disabling this test because BMP are now only supporting reading of RGB images.
- # ADD_TEST(compare_bmp_unsigned_char ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in5.mhd Dummy)
+ # ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_bmp_unsigned_char COMMAND
+ # $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in5.mhd Dummy)
#
- ADD_TEST(compare_nrrd_float ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in6.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_nrrd_float COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in6.mhd Dummy)
set_tests_properties(compare_nrrd_float PROPERTIES DEPENDS ccvnt_from_nrrd_float)
- ADD_TEST(compare_vtk_long ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in7.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_vtk_long COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in7.mhd Dummy)
set_tests_properties(compare_vtk_long PROPERTIES DEPENDS ccvnt_from_vtk_long)
- ADD_TEST(compare_gipl ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in8.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_gipl COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in8.mhd Dummy)
set_tests_properties(compare_gipl PROPERTIES DEPENDS ccvnt_from_gipl)
- ADD_TEST(compare_nifti ${IMAGE_COMPARE_TESTS} --compare ${IMAGE_PATH}/image_in.mhd ${IMAGE_PATH_OUTPUTS}/image_in8.mhd Dummy)
+ ExternalData_add_test( ${PROJECT_NAME}FetchData NAME compare_nifti COMMAND
+ $<TARGET_FILE:ImageCompareTests> --compare DATA{${TestData_DIR}/image_in.mhd,image_in.raw} ${IMAGE_PATH_OUTPUTS}/image_in8.mhd Dummy)
set_tests_properties(compare_nifti PROPERTIES DEPENDS ccvnt_from_nifti)
- ADD_EXECUTABLE(ImageCompareTests ImageCompareTests.cxx)
- TARGET_LINK_LIBRARIES(ImageCompareTests ${ITK_LIBRARIES})
-ENDIF( BUILD_TESTING )
+ add_executable(ImageCompareTests ImageCompareTests.cxx)
+ target_link_libraries(ImageCompareTests ${ITK_LIBRARIES})
+
+ ExternalData_Add_Target( ${PROJECT_NAME}FetchData ) # Name of data management target
+endif( BUILD_TESTING )
View
13 ConvertBetweenFileFormats/Testing/Data/BigEndian.mhd
@@ -1,13 +0,0 @@
-ObjectType = Image
-NDims = 3
-BinaryData = True
-BinaryDataByteOrderMSB = False
-CompressedData = False
-TransformMatrix = 1 0 0 0 0 1 0 -1 0
-Offset = 0 0 0
-CenterOfRotation = 0 0 0
-AnatomicalOrientation = RIP
-ElementSpacing = 1 1 1
-DimSize = 6 6 8
-ElementType = MET_SHORT
-ElementDataFile = BigEndian.raw
View
12 ConvertBetweenFileFormats/Testing/Data/image_in.mhd
@@ -1,12 +0,0 @@
-ObjectType = Image
-NDims = 2
-BinaryData = True
-BinaryDataByteOrderMSB = False
-TransformMatrix = 1 0 0 1
-Offset = 0 0
-CenterOfRotation = 0 0
-ElementSpacing = 1 1
-DimSize = 181 217
-AnatomicalOrientation = ??
-ElementType = MET_USHORT
-ElementDataFile = image_in.raw
View
1 TestData/BigEndian.mhd.md5
@@ -0,0 +1 @@
+99d06981ea12feffc14d508887b05332
View
1 TestData/BigEndian.raw.md5
@@ -0,0 +1 @@
+c05ad58b1e5547829f2d1e8c870e67ed
View
1 TestData/image_in.mhd.md5
@@ -0,0 +1 @@
+427d5e7467a5c8d94a998003c34bab43
View
1 TestData/image_in.raw.md5
@@ -0,0 +1 @@
+77f07224d347b8da380c099da9f325cc

0 comments on commit a433664

Please sign in to comment.