#=========================================================
INCLUDE(cmake/common.cmake)
#=========================================================
-#Support for the CTest dashboard testing system
-INCLUDE(CTest)
-#=========================================================
#=========================================================
# Find ITK (required)
add_subdirectory(segmentation)
add_subdirectory(registration)
+
# Compilation options
OPTION(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
OPTION(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
add_subdirectory(vv)
ENDIF(CLITK_BUILD_VV)
+
+#=========================================================
+#Support for the CTest dashboard testing system
+INCLUDE(CTest)
+#=========================================================
+add_subdirectory(tests)
+add_subdirectory(tests/tools)
+#=========================================================
+
+
#=========================================================
--- /dev/null
+# Add test apps and test executions to this part
+# Test apps are compiled as any other app in the
+# project. Test executions are run using "make test"
+#
+IF (BUILD_TESTING)
+
+ # clitkImageInfo
+ ADD_EXECUTABLE(clitkImageInfoTest tools/clitkImageInfoTest.cxx)
+ TARGET_LINK_LIBRARIES(clitkImageInfoTest ITKIO)
+ ADD_TEST(NAME clitkImageInfoTest COMMAND clitkImageInfoTest)
+
+ # clitkWriteDicomSeries
+ ADD_EXECUTABLE(clitkWriteDicomSeriesTest tools/clitkWriteDicomSeriesTest.cxx)
+ TARGET_LINK_LIBRARIES(clitkWriteDicomSeriesTest ITKIO)
+ ADD_TEST(NAME clitkWriteDicomSeriesTest COMMAND clitkWriteDicomSeriesTest)
+
+ENDIF(BUILD_TESTING)
\ No newline at end of file
--- /dev/null
+#include <cstdlib>
+#include <cstdio>
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+#include <itksys/SystemTools.hxx>
+
+const size_t NUMTESTS=2;
+
+// test files
+const char mhd_files[NUMTESTS][128] = {
+ "data/4d/mhd/00.mhd",
+ "data/4d/mhd/bh.mhd"
+};
+
+// pre-written validation files. the idea
+// is that the output generated from the test
+// files match the verification files
+const char validation_files[NUMTESTS][128] = {
+ "data/tools/clitkImageInfoTestValidate3D.out",
+ "data/tools/clitkImageInfoTestValidate4D.out"
+};
+
+int main(int argc, char** argv)
+{
+ bool failed = false;
+ for (size_t i = 0; i < NUMTESTS; i++) {
+ std::ostringstream cmd_line;
+ cmd_line << "clitkImageInfo " << mhd_files[i] << " > clitkImageInfoTest.out";
+
+ std::cout << "Executing " << cmd_line.str() << std::endl;
+ system(cmd_line.str().c_str());
+
+ // compare output with validation file
+ std::cout << "Validating output against " << validation_files[i] << std::endl;
+ bool differ = itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", validation_files[i]);
+ if (differ)
+ {
+ failed = true;
+ std::cout << "FAILED: Program output and reference do not match." << std::endl;
+ }
+ else
+ {
+ itksys::SystemTools::RemoveFile("clitkImageInfoTest.out");
+ std::cout << "PASSED" << std::endl;
+ }
+ }
+ return failed ? -1 : 0;
+}
\ No newline at end of file
--- /dev/null
+#include <cstdlib>
+#include <cstdio>
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+#include <itksys/SystemTools.hxx>
+
+const size_t NUMTESTS=1;
+
+const char mhd_files[NUMTESTS][128] = {
+ "data/3d/mhd/CT_UNTAGGED2MM_0.mhd"
+};
+
+const char dcm_dirs[NUMTESTS][128] = {
+ "data/3d/dcm/1.2.840.113704.1.111.5556.1240990904.26"
+};
+
+int main(int argc, char** argv)
+{
+ bool failed = false;
+ for (size_t i = 0; i < NUMTESTS; i++) {
+ std::ostringstream cmd_line;
+ cmd_line << "clitkWriteDicomSeries -i " << mhd_files[i] << " -d " << dcm_dirs[i] << " -o dcm --verbose";
+
+ std::cout << "Executing " << cmd_line.str() << std::endl;
+ int err = system(cmd_line.str().c_str());
+ if (err != 0)
+ {
+ failed = true;
+ std::cout << "FAILED (errno = " << err << ")" << std::endl;
+ }
+ else
+ {
+ itksys::SystemTools::RemoveADirectory("dcm");
+ std::cout << "PASSED" << std::endl;
+ }
+ }
+ return failed ? -1 : 0;
+}
\ No newline at end of file