diff --git a/code/io/other/rttbDoseStatisticsXMLReader.cpp b/code/io/other/rttbDoseStatisticsXMLReader.cpp index 9f4348f..fc81b47 100644 --- a/code/io/other/rttbDoseStatisticsXMLReader.cpp +++ b/code/io/other/rttbDoseStatisticsXMLReader.cpp @@ -1,188 +1,186 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision: 1328 $ (last changed revision) // @date $Date: 2016-04-22 09:50:01 +0200 (Fr, 22 Apr 2016) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include #include - +#include #include "rttbDoseStatisticsXMLReader.h" #include "rttbInvalidParameterException.h" namespace rttb { namespace io { namespace other { typedef boost::shared_ptr DoseStatisticsPtr; DoseStatisticsXMLReader::DoseStatisticsXMLReader(const std::string& filename) : _filename(filename), _newFile(true){ } DoseStatisticsXMLReader::~DoseStatisticsXMLReader(){ } void DoseStatisticsXMLReader::setFilename(const std::string& filename){ _filename = filename; _newFile = true; } DoseStatisticsPtr DoseStatisticsXMLReader::generateDoseStatistic(){ if (_newFile){ this->createDoseStatistic(); } return _doseStatistic; } void DoseStatisticsXMLReader::createDoseStatistic(){ boost::property_tree::ptree pt; // Load the XML file into the property tree. If reading fails // (cannot open file, parse error), an exception is thrown. try { read_xml(_filename, pt); } catch (boost::property_tree::xml_parser_error& /*e*/) { throw rttb::core::InvalidParameterException("DoseStatistics file name invalid: could not open the xml file!"); } // data to fill the parameter for the DoseStatistics std::string name; std::string datum; unsigned int x; std::pair voxelid; std::vector < std::pair> vec; //parameter for the DoseSTatistics double minimum; double maximum; double numVoxels; double volume; double referenceDose = -1; double mean; double stdDeviation; boost::shared_ptr > > minimumVoxelPositions = nullptr; boost::shared_ptr > > maximumVoxelPositions = nullptr; std::map Dx; std::map Vx; std::map MOHx; std::map MOCx; std::map MaxOHx; std::map MinOCx; - BOOST_FOREACH(boost::property_tree::ptree::value_type & data, pt.get_child("statistics.results")){ datum = data.second.data(); -std::cout << "datum: " << datum << std::endl; + BOOST_FOREACH(boost::property_tree::ptree::value_type & middel, data.second){ BOOST_FOREACH(boost::property_tree::ptree::value_type & innernode, middel.second){ std::string mia = innernode.first; -std::cout << "mia: " << mia << std::endl; + if (innernode.first == "name"){ name = innernode.second.data(); } else if (innernode.first == "voxelGridID"){ -std::cout << 1.1 << std::endl; - datum.erase(std::remove(datum.begin(), datum.end(), '\t'), datum.end()); - datum.erase(std::remove(datum.begin(), datum.end(), '\n'), datum.end()); + + //datum.erase(std::remove(datum.begin(), datum.end(), '\t'), datum.end()); + //datum.erase(std::remove(datum.begin(), datum.end(), '\n'), datum.end()); + boost::replace_all(datum, "\r\n", ""); + boost::replace_all(datum, "\n", ""); + boost::trim(datum); + voxelid.first = boost::lexical_cast(datum); voxelid.second = boost::lexical_cast(innernode.second.data()); vec.push_back(voxelid); -std::cout << 1.2 << std::endl; } else if (innernode.first == "x"){ x = boost::lexical_cast(innernode.second.data()); } - else { - std::cout << "damn" << std::endl; - } } } -std::cout << name << std::endl; + // fill with the extracted data if (name == "numberOfVoxels"){ numVoxels = boost::lexical_cast(datum); } else if (name == "volume"){ volume = boost::lexical_cast(datum); } else if (name == "referenceDose"){ referenceDose = boost::lexical_cast(datum); } else if (name == "mean"){ mean = boost::lexical_cast(datum); } else if (name == "standardDeviation"){ stdDeviation = boost::lexical_cast(datum); } else if (name == "minimum"){ minimum = boost::lexical_cast(datum); if (!vec.empty()){ minimumVoxelPositions = boost::make_shared>>(vec); vec.clear(); } } else if (name == "maximum"){ maximum = boost::lexical_cast(datum); if (!vec.empty()){ maximumVoxelPositions = boost::make_shared>>(vec); vec.clear(); } } else if (name == "Dx"){ Dx[boost::lexical_cast(x)*volume / 100] = boost::lexical_cast(datum); } else if (name == "Vx"){ Vx[boost::lexical_cast(x)*referenceDose / 100] = boost::lexical_cast(datum); } else if (name == "MOHx"){ MOHx[boost::lexical_cast(x)*volume / 100] = boost::lexical_cast(datum); } else if (name == "MOCx"){ MOCx[boost::lexical_cast(x)*volume / 100] = boost::lexical_cast(datum); } else if (name == "MaxOHx"){ MaxOHx[boost::lexical_cast(x)*volume / 100] = boost::lexical_cast(datum); } else if (name == "MinOCx"){ MinOCx[boost::lexical_cast(x)*volume / 100] = boost::lexical_cast(datum); } -std::cout << "end" << std::endl; } // make DoseStatistcs - _doseStatistic = boost::make_shared(rttb::algorithms::DoseStatistics( + _doseStatistic = boost::make_shared( minimum, maximum, mean, stdDeviation, numVoxels, volume, minimumVoxelPositions, maximumVoxelPositions - ,Dx, Vx, MOHx, MOCx, MaxOHx, MinOCx, referenceDose)); + ,Dx, Vx, MOHx, MOCx, MaxOHx, MinOCx, referenceDose); } }//end namespace other }//end namespace io }//end namespace rttb diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index d3d25f2..116bbc3 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -1,93 +1,93 @@ MESSAGE(STATUS "processing RTToolbox testing code") # Testing branch PROJECT(RTTBTesting) #----------------------------------------------------------------------------- # extract and build Litmus #----------------------------------------------------------------------------- include(ExternalProject) message(STATUS "Litmus will be automatically downloaded and built.") set(LITMUS_SOURCE_DIR "${CMAKE_BINARY_DIR}/external/Litmus-src") set(LITMUS_BUILD_DIR "${CMAKE_BINARY_DIR}/external/Litmus-build") set(LITMUS_CMAKE_DIR "${CMAKE_BINARY_DIR}/external/Litmus-cmake") -IF ((BUILD_RTToolbox_interpolation_Tester AND BUILD_InterpolationMatchPointTransformation) OR (BUILD_RTToolbox_io_Tester AND BUILD_IO_ITK)) +IF ((BUILD_RTToolbox_interpolation_Tester AND BUILD_InterpolationMatchPointTransformation) OR (BUILD_RTToolbox_io_Tester AND BUILD_IO_ITK) OR (BUILD_RTToolbox_apps_Tester AND BUILD_App_DoseTool)) set(ENABLE_ITK "-DLIT_ENABLE_ITK_SUPPORT:BOOL=ON") set(ITK_DIRECTORY "-DITK_DIR:STRING=${ITK_DIR}") ENDIF() #extract and build Litmus ExternalProject_Add( Litmus URL ${RTToolbox_SOURCE_DIR}/utilities/Litmus/Litmus.tar.gz SOURCE_DIR ${LITMUS_SOURCE_DIR} BINARY_DIR ${LITMUS_BUILD_DIR} PREFIX ${LITMUS_CMAKE_DIR} INSTALL_COMMAND "" UPDATE_COMMAND "" # Don't update SVN on every build CMAKE_ARGS -DBUILD_TESTING:BOOL=OFF ${ENABLE_ITK} ${ITK_DIRECTORY} ) #----------------------------------------------------------------------------- # Configure Testing branch #----------------------------------------------------------------------------- MAKE_DIRECTORY(${RTTBTesting_BINARY_DIR}/Temporary) MESSAGE(STATUS "Process All Tests...") #----------------------------------------------------------------------------- # Include sub directories #----------------------------------------------------------------------------- OPTION(BUILD_RTToolbox_core_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_Test_examples "build project on/off" OFF) OPTION(BUILD_RTToolbox_algorithms_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_models_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_io_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_masks_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_interpolation_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_apps_Tester "build project on/off" OFF) OPTION(BUILD_RTToolbox_validation_Tester "build project on/off" OFF) IF(BUILD_RTToolbox_core_Tester) ADD_SUBDIRECTORY(core) ENDIF() IF(BUILD_RTToolbox_Test_examples) ADD_SUBDIRECTORY(examples) IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY(examples_virtuos) ENDIF() ENDIF() IF(BUILD_RTToolbox_algorithms_Tester) ADD_SUBDIRECTORY(algorithms) ENDIF() IF(BUILD_RTToolbox_models_Tester) ADD_SUBDIRECTORY(models) ENDIF() IF(BUILD_RTToolbox_io_Tester) ADD_SUBDIRECTORY(io) ENDIF() IF(BUILD_RTToolbox_masks_Tester) ADD_SUBDIRECTORY(masks) ENDIF() IF(BUILD_RTToolbox_interpolation_Tester) ADD_SUBDIRECTORY(interpolation) ENDIF() IF(BUILD_RTToolbox_validation_Tester) ADD_SUBDIRECTORY(validation) ENDIF() IF(BUILD_RTToolbox_apps_Tester) ADD_SUBDIRECTORY(apps) ENDIF() diff --git a/testing/apps/DoseAcc/CMakeLists.txt b/testing/apps/DoseAcc/CMakeLists.txt index dfc3b55..2b94257 100644 --- a/testing/apps/DoseAcc/CMakeLists.txt +++ b/testing/apps/DoseAcc/CMakeLists.txt @@ -1,30 +1,30 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- SET(DOSEACC_TEST ${EXECUTABLE_OUTPUT_PATH}/rttbDoseAccTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) #----------------------------------------------------------------------------- IF(MSVC) ADD_DEFINITIONS(/bigobj) ENDIF() IF (WIN32) SET(DOSEACCEXE "DoseAcc.exe") ELSE (WIN32) SET(DOSEACCEXE "./DoseAcc") ENDIF (WIN32) ADD_TEST(DoseAccInvalidParametersTest ${DOSEACC_TEST} DoseAccInvalidParametersTest ${DOSEACCEXE}) -ADD_TEST(DoseAccSimpleTest ${DOSEACC_TEST} DoseAccSimpleTest ${DOSEACCEXE} "${TEST_DATA_ROOT}/Dose/DICOM/ConstantTwo.dcm" "${TEST_DATA_ROOT}/Dose/DICOM/ConstantFifty.dcm" "${TEST_DATA_ROOT}/images/ITK/doseAccReference.nrrd") +ADD_TEST(DoseAccSimpleTest ${DOSEACC_TEST} DoseAccSimpleTest ${DOSEACCEXE} "${TEST_DATA_ROOT}/Dose/DICOM/ConstantTwo.dcm" "${TEST_DATA_ROOT}/Dose/DICOM/ConstantFifty.dcm" "${TEST_DATA_ROOT}/Images/ITK/doseAccReference.nrrd") ADD_TEST(DoseAccNeutralWeightTest ${DOSEACC_TEST} DoseAccNeutralWeightTest ${DOSEACCEXE} "${TEST_DATA_ROOT}/Dose/DICOM/ConstantFifty.dcm" "${TEST_DATA_ROOT}/Dose/ITK/constantFifty.nrrd" "${TEST_DATA_ROOT}/Dose/ITK/constant2500.nrrd") RTTB_CREATE_APPLICATION_TESTS(DoseAcc DEPENDS RTTBITKIO PACKAGE_DEPENDS Litmus ITK BoostBinaries) diff --git a/testing/apps/DoseAcc/DoseAccNeutralWeightTest.cpp b/testing/apps/DoseAcc/DoseAccNeutralWeightTest.cpp index 647a407..7362c23 100644 --- a/testing/apps/DoseAcc/DoseAccNeutralWeightTest.cpp +++ b/testing/apps/DoseAcc/DoseAccNeutralWeightTest.cpp @@ -1,108 +1,108 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision: 1221 $ (last changed revision) // @date $Date: 2015-12-01 13:43:31 +0100 (Di, 01 Dez 2015) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include "litCheckMacros.h" #include "litImageTester.h" #include "boost/filesystem.hpp" #include "itkImage.h" #include "rttbITKIOHelper.h" namespace rttb { namespace testing { //path to the current running directory. DoseTool is in the same directory (Debug/Release) extern const char* _callingAppPath; int DoseAccNeutralWeightTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string doseAccExecutable; std::string doseFilename; std::string referenceFilename; std::string reference2Filename; boost::filesystem::path callingPath(_callingAppPath); if (argc > 4) { doseAccExecutable = argv[1]; doseFilename = argv[2]; referenceFilename = argv[3]; reference2Filename = argv[4]; } std::string doseAccExeWithPath = callingPath.parent_path().string() + "/" + doseAccExecutable; const std::string defaultOutputAddFilename = "doseAccAddOutput.nrrd"; const std::string defaultOutputMultFilename = "doseAccMultOutput.nrrd"; std::string baseCommand = doseAccExeWithPath; baseCommand += " -d " + doseFilename; baseCommand += " -e " + doseFilename; std::string defaultDoseAccAddCommand = baseCommand + " -o " + defaultOutputAddFilename + " --weight1 0.0"; std::cout << "Command line call: " + defaultDoseAccAddCommand << std::endl; CHECK_EQUAL(system(defaultDoseAccAddCommand.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputAddFilename), true); - std::string defaultDoseAccMultCommand = baseCommand + " -o " + defaultOutputMultFilename + " --operator *"; + std::string defaultDoseAccMultCommand = baseCommand + " -o " + defaultOutputMultFilename + " --operator \"*\""; std::cout << "Command line call: " + defaultDoseAccMultCommand << std::endl; CHECK_EQUAL(system(defaultDoseAccMultCommand.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputMultFilename), true); // Check result against reference typedef ::itk::Image TestImageType; TestImageType::Pointer referenceAddImage = io::itk::readITKDoubleImage(referenceFilename); TestImageType::Pointer outputAddImage = io::itk::readITKDoubleImage(defaultOutputAddFilename); lit::ImageTester tester; tester.setExpectedImage(referenceAddImage); tester.setActualImage(outputAddImage); tester.setCheckThreshold(1e-5); CHECK_TESTER(tester); TestImageType::Pointer referenceMultImage = io::itk::readITKDoubleImage(reference2Filename); TestImageType::Pointer outputMultImage = io::itk::readITKDoubleImage(defaultOutputMultFilename); tester.setExpectedImage(referenceMultImage); tester.setActualImage(outputMultImage); tester.setCheckThreshold(1e-5); CHECK_TESTER(tester); CHECK_EQUAL(std::remove(defaultOutputAddFilename.c_str()), 0); CHECK_EQUAL(std::remove(defaultOutputMultFilename.c_str()), 0); RETURN_AND_REPORT_TEST_SUCCESS; } } //namespace testing } //namespace rttb diff --git a/testing/apps/DoseTool/DoseToolRegexTest.cpp b/testing/apps/DoseTool/DoseToolRegexTest.cpp index 2201b1f..87b7465 100644 --- a/testing/apps/DoseTool/DoseToolRegexTest.cpp +++ b/testing/apps/DoseTool/DoseToolRegexTest.cpp @@ -1,116 +1,119 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision: 1221 $ (last changed revision) // @date $Date: 2015-12-01 13:43:31 +0100 (Di, 01 Dez 2015) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include "rttbDoseStatisticsXMLReader.h" #include "../../io/other/CompareDoseStatistic.h" #include "litCheckMacros.h" #include "boost/filesystem.hpp" namespace rttb { namespace testing { //path to the current running directory. DoseTool is in the same directory (Debug/Release) extern const char* _callingAppPath; int DoseToolRegexTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string doseToolExecutable; std::string doseFilename; std::string doseLoadStyle; std::string structFilename; std::string structLoadStyle; std::string structName; std::string referenceXMLFilename; std::string referenceXMLFilename2; boost::filesystem::path callingPath(_callingAppPath); if (argc > 8) { doseToolExecutable = argv[1]; doseFilename = argv[2]; doseLoadStyle = argv[3]; structFilename = argv[4]; structLoadStyle = argv[5]; structName = argv[6]; referenceXMLFilename = argv[7]; referenceXMLFilename2 = argv[8]; } std::string doseToolExeWithPath = callingPath.parent_path().string() + "/" + doseToolExecutable; std::string defaultOutputFilename = "regexOutput.xml"; std::string defaultExpectedOutputFilename = "regexOutput_Nodes.xml"; std::string defaultExpectedOutputFilename2 = "regexOutput_Heart.xml"; std::string baseCommand = doseToolExeWithPath; baseCommand += " -d " + doseFilename; baseCommand += " -t " + doseLoadStyle; baseCommand += " -s " + structFilename; baseCommand += " -u " + structLoadStyle; baseCommand += " -n \"" + structName + "\""; baseCommand += " -y " + defaultOutputFilename; std::cout << "Command line call: " + baseCommand << std::endl; CHECK_EQUAL(system(baseCommand.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); CHECK_EQUAL(boost::filesystem::exists(defaultExpectedOutputFilename), false); CHECK_EQUAL(boost::filesystem::exists(defaultExpectedOutputFilename2), false); CHECK_EQUAL(std::remove(defaultOutputFilename.c_str()), 0); std::string defaultDoseStatisticsCommand = baseCommand + " -m"; std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); //check if two file were written CHECK_EQUAL(boost::filesystem::exists(defaultExpectedOutputFilename), true); CHECK_EQUAL(boost::filesystem::exists(defaultExpectedOutputFilename2), true); - //check if file has dose statistics that are same than these in than reference file - io::other::DoseStatisticsXMLReader readerDefaultExpected(referenceXMLFilename); - auto doseStatisticsDefaultExpected = readerDefaultExpected.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerDefaultActual(defaultExpectedOutputFilename); - auto doseStatisticsDefaultActual = readerDefaultActual.generateDoseStatistic(); + //check if file has dose statistics that are same than these in than reference file + io::other::DoseStatisticsXMLReader readerDefaultExpected(referenceXMLFilename); - CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected, doseStatisticsDefaultActual)); + auto doseStatisticsDefaultExpected = readerDefaultExpected.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerDefaultExpected2(referenceXMLFilename2); - auto doseStatisticsDefaultExpected2 = readerDefaultExpected2.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerDefaultActual2(defaultExpectedOutputFilename2); - auto doseStatisticsDefaultActual2 = readerDefaultActual2.generateDoseStatistic(); + io::other::DoseStatisticsXMLReader readerDefaultActual(defaultExpectedOutputFilename); - CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected2, doseStatisticsDefaultActual2)); + auto doseStatisticsDefaultActual = readerDefaultActual.generateDoseStatistic(); + + CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected, doseStatisticsDefaultActual)); + + io::other::DoseStatisticsXMLReader readerDefaultExpected2(referenceXMLFilename2); + auto doseStatisticsDefaultExpected2 = readerDefaultExpected2.generateDoseStatistic(); + io::other::DoseStatisticsXMLReader readerDefaultActual2(defaultExpectedOutputFilename2); + auto doseStatisticsDefaultActual2 = readerDefaultActual2.generateDoseStatistic(); + + CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected2, doseStatisticsDefaultActual2)); //delete file again CHECK_EQUAL(std::remove(defaultExpectedOutputFilename.c_str()), 0); CHECK_EQUAL(std::remove(defaultExpectedOutputFilename2.c_str()), 0); RETURN_AND_REPORT_TEST_SUCCESS; } } //namespace testing } //namespace rttb diff --git a/testing/apps/VoxelizerTool/CMakeLists.txt b/testing/apps/VoxelizerTool/CMakeLists.txt index 15047d2..2527c5e 100644 --- a/testing/apps/VoxelizerTool/CMakeLists.txt +++ b/testing/apps/VoxelizerTool/CMakeLists.txt @@ -1,30 +1,30 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- SET(VoxelizerTool_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbVoxelizerToolTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) -SET(TEST_DATA ${RTToolbox_BINARY_DIR}/Testing/apps/VoxelizerTool) +SET(TEST_DATA ${RTToolbox_BINARY_DIR}/testing/apps/VoxelizerTool) IF (WIN32) SET(VOXELIZERTOOL_EXE "VoxelizerTool") ELSE (WIN32) SET(VOXELIZERTOOL_EXE "./VoxelizerTool") ENDIF (WIN32) SET(STRUCT_FILE "${TEST_DATA_ROOT}/StructureSet/DICOM/RS1.3.6.1.4.1.2452.6.841242143.1311652612.1170940299.4217870819.dcm") SET(REFERENCE_FILE "${TEST_DATA_ROOT}/Dose/DICOM/ConstantTwo.dcm") #----------------------------------------------------------------------------- ADD_TEST(VoxelizerToolIncorrectCommandsTest ${VoxelizerTool_TESTS} VoxelizerToolIncorrectCommandsTest "${VOXELIZERTOOL_EXE}" ${STRUCT_FILE} "${TEST_DATA_ROOT}/StructureSet/DICOM/Wrong_Data_Struct_file.dicom" ${REFERENCE_FILE} "${TEST_DATA_ROOT}/Dose/DICOM/Wrong_Reference_file.dicom" "Rueckenmark" "blabla") ADD_TEST(VoxelizerToolVoxelizerAllStructsTest ${VoxelizerTool_TESTS} VoxelizerToolVoxelizerAllStructsTest "${VOXELIZERTOOL_EXE}" ${TEST_DATA} ${STRUCT_FILE} ${REFERENCE_FILE} ) ADD_TEST(VoxelizerToolDifferentCommandsTest ${VoxelizerTool_TESTS} VoxelizerToolDifferentCommandsTest "${VOXELIZERTOOL_EXE}" ${TEST_DATA} ${STRUCT_FILE} ${REFERENCE_FILE}) ADD_TEST(VoxelizerToolVoxelValueTest ${VoxelizerTool_TESTS} VoxelizerToolVoxelValue "${VOXELIZERTOOL_EXE}" ${TEST_DATA} ${STRUCT_FILE} ${REFERENCE_FILE} "Leber") RTTB_CREATE_APPLICATION_TESTS(VoxelizerTool PACKAGE_DEPENDS Litmus ITK BoostBinaries) diff --git a/testing/apps/VoxelizerTool/VoxelizerToolVoxelizerAllStructsTest.cpp b/testing/apps/VoxelizerTool/VoxelizerToolVoxelizerAllStructsTest.cpp index 30d5690..04119dd 100644 --- a/testing/apps/VoxelizerTool/VoxelizerToolVoxelizerAllStructsTest.cpp +++ b/testing/apps/VoxelizerTool/VoxelizerToolVoxelizerAllStructsTest.cpp @@ -1,103 +1,103 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision: 1333 $ (last changed revision) // @date $Date: 2016-04-22 11:12:14 +0200 (Fr, 22 Apr 2016) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include #include "litCheckMacros.h" #include #include /*! @brief VoxelizerToolTest. Tests a selection of structs. */ namespace rttb { namespace testing { //path to the current running directory. VoxelizerTool is in the same directory (Debug/Release) extern const char* _callingAppPath; int VoxelizerToolVoxelizerAllStructsTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string voxelizerToolExe; std::string tempDirectory; std::string structFile; std::string referenceFile; if (argc > 4) { voxelizerToolExe = argv[1]; tempDirectory = argv[2]; structFile = argv[3]; referenceFile = argv[4]; } boost::filesystem::path callingPath(_callingAppPath); std::string voxelizerToolExeWithPath = callingPath.parent_path().string() + "/" + voxelizerToolExe; std::vector structNames; structNames.push_back("Niere.*"); structNames.push_back("Magen/DD"); structNames.push_back("PTV"); std::string baseCommand = voxelizerToolExeWithPath; baseCommand += " -s " + structFile; baseCommand += " -r " + referenceFile; baseCommand += " -e \""; for (size_t i = 0; i < structNames.size(); i++) { std::string command = baseCommand + structNames.at(i) + "\""; std::cout << "Command line call: " + command << std::endl; int returnValue = system(command.c_str()); CHECK_EQUAL(returnValue, 0); boost::filesystem::path HDRFile(tempDirectory); HDRFile /= "out.hdr"; boost::filesystem::path IMGFile(tempDirectory); IMGFile /= "out.img"; - +std::cout << HDRFile.string() << std::endl; CHECK_EQUAL( boost::filesystem::exists(HDRFile), true); CHECK_EQUAL( boost::filesystem::exists(IMGFile), true); if (boost::filesystem::exists(IMGFile)) { boost::filesystem::remove(IMGFile); } if (boost::filesystem::exists(HDRFile)) { boost::filesystem::remove(HDRFile); } } RETURN_AND_REPORT_TEST_SUCCESS; } } }