diff --git a/apps/BioModelCalc/BioModelCalc.cpp b/apps/BioModelCalc/BioModelCalc.cpp index 0cb4fad..8bbd785 100644 --- a/apps/BioModelCalc/BioModelCalc.cpp +++ b/apps/BioModelCalc/BioModelCalc.cpp @@ -1,155 +1,149 @@ // ----------------------------------------------------------------------- // 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: 1334 $ (last changed revision) -// @date $Date: 2016-04-22 11:13:22 +0200 (Fr, 22 Apr 2016) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ #include "BioModelCalcApplicationData.h" #include "BioModelCalcHelper.h" #include "BioModelCmdLineParser.h" #include "boost/shared_ptr.hpp" #include "boost/make_shared.hpp" #include "RTToolboxConfigure.h" #include "rttbException.h" #include "rttbDoseLoader.cpp" int main(int argc, const char** argv) { int result = 0; rttb::apps::bioModelCalc::ApplicationData appData; boost::shared_ptr<rttb::apps::bioModelCalc::BioModelCmdLineParser> argParser; const std::string appCategory = "RT-Toolbox App"; const std::string appName = "BioModelCalc"; const std::string appDesc = "An App to calculate the Linear quadratic (LQ) BioModel. The GUI for this app is currently under development and in an experimental state."; const std::string appContributor = "SIDT@DKFZ"; const std::string appVersion = RTTB_FULL_VERSION_STRING; try { argParser = boost::make_shared<rttb::apps::bioModelCalc::BioModelCmdLineParser>(argc, argv, appName, appVersion, appDesc, appContributor, appCategory); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return -1; } // This is vital. The application needs to exit if the "help" or "version" parameter is set // because this means the other parameters won't be parsed. if (argParser->isSet(argParser->OPTION_HELP) || argParser->isSet(argParser->OPTION_VERSION) || argParser->isSet(argParser->OPTION_XML)) { return 0; } rttb::apps::bioModelCalc::populateAppData(argParser, appData); std::cout << std::endl << "*******************************************" << std::endl; std::cout << "Dose file: " << appData._doseFileName << std::endl; std::cout << "Bio model output file: " << appData._outputFileName << std::endl; std::cout << "Model: " << appData._model << std::endl; std::cout << "Model parameters: "; for (size_t i = 0; i < appData._modelParameters.size(); i++) { if (i != 0) { std::cout << ", "; } std::cout << appData._modelParameters.at(i); } for (size_t i = 0; i < appData._modelParameterMapsFilename.size(); i++) { if (i != 0) { std::cout << ", "; } std::cout << appData._modelParameterMapsFilename.at(i); } std::cout << std::endl; std::cout << "Dose scaling: " << appData._doseScaling << std::endl; if (argParser->isSet(argParser->OPTION_N_FRACTIONS)){ std::cout << "#Fractions: " << appData._nFractions << std::endl; } std::cout << std::endl; std::cout << std::endl << "read dose file... "; try { appData._dose = rttb::io::utils::loadDose(appData._doseFileName, appData._doseLoadStyle); for (const auto& filename : appData._modelParameterMapsFilename){ appData._modelParameterMaps.push_front(rttb::io::utils::loadDose(filename, appData._parameterMapsLoadStyle)); } std::cout << "done." << std::endl; } catch (rttb::core::Exception& e) { std::cerr << "RTTB Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 1; } catch (const std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 1; } catch (...) { std::cerr << "Error!!! unknown error while reading input image." << std::endl; return 1; } try { rttb::apps::bioModelCalc::processData(appData); } catch (rttb::core::Exception& e) { std::cerr << "RTTB Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 2; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 2; } catch (...) { std::cerr << "Error!!! unknown error while calculating the bioModel or writing the image." << std::endl; return 2; } return result; } diff --git a/apps/BioModelCalc/BioModelCalcHelper.cpp b/apps/BioModelCalc/BioModelCalcHelper.cpp index d87a645..bfe7da7 100644 --- a/apps/BioModelCalc/BioModelCalcHelper.cpp +++ b/apps/BioModelCalc/BioModelCalcHelper.cpp @@ -1,96 +1,89 @@ // ----------------------------------------------------------------------- // 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: 1374 $ (last changed revision) -// @date $Date: 2016-05-30 14:15:42 +0200 (Mo, 30 Mai 2016) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ - #include "BioModelCalcHelper.h" #include "boost/make_shared.hpp" #include "boost/shared_ptr.hpp" #include "rttbExceptionMacros.h" #include "BioModelCalcApplicationData.h" #include "rttbITKImageAccessorConverter.h" #include "rttbImageWriter.h" #include "rttbLQModelAccessor.h" void rttb::apps::bioModelCalc::processData(rttb::apps::bioModelCalc::ApplicationData& appData) { rttb::core::DoseAccessorInterface::Pointer outputAccessor; std::cout << std::endl << "generate biomodel... "; rttb::core::AccessorInterface::Pointer bioModelAccessor; if (!appData._modelParameters.empty()){ bioModelAccessor = generateBioModel(appData._dose, appData._model, appData._modelParameters, appData._nFractions, appData._doseScaling); } else { bioModelAccessor = generateBioModelWithMaps(appData._dose, appData._model, appData._modelParameterMaps, appData._nFractions, appData._doseScaling); } std::cout << "done." << std::endl; std::cout << std::endl << "generate output image... "; io::itk::ITKImageAccessorConverter converter(bioModelAccessor); converter.setFailOnInvalidIDs(true); converter.process(); io::itk::ITKImageAccessorConverter::ITKImageType::Pointer itkImage = converter.getITKImage(); std::cout << "done." << std::endl; std::cout << std::endl << "write output image... "; io::itk::ImageWriter writer(appData._outputFileName, itkImage.GetPointer()); writer.writeFile(); std::cout << "done." << std::endl; } rttb::core::AccessorInterface::Pointer rttb::apps::bioModelCalc::generateBioModel( rttb::core::DoseAccessorInterface::Pointer dose, const std::string& model, const std::vector<double>& modelParameters, unsigned int nFractions, double doseScaling) { if (model == "LQ") { return boost::make_shared<rttb::models::LQModelAccessor>(dose, modelParameters.at(0), modelParameters.at(1), nFractions, doseScaling); } else { rttbDefaultExceptionStaticMacro( << "Unknown model selected. Cannot load data. Selected model: " << model); } } rttb::core::AccessorInterface::Pointer rttb::apps::bioModelCalc::generateBioModelWithMaps( rttb::core::DoseAccessorInterface::Pointer dose, const std::string& model, const std::deque<rttb::core::AccessorInterface::Pointer>& modelParameterMaps, unsigned int nFractions, double doseScaling) { if (model == "LQ") { return boost::make_shared<rttb::models::LQModelAccessor>(dose, modelParameterMaps.at(0), modelParameterMaps.at(1), nFractions, doseScaling); } else { rttbDefaultExceptionStaticMacro(<< "Unknown model selected. Cannot load data. Selected model: " << model); } } diff --git a/apps/BioModelCalc/BioModelCalcHelper.h b/apps/BioModelCalc/BioModelCalcHelper.h index a4078e2..41d5c75 100644 --- a/apps/BioModelCalc/BioModelCalcHelper.h +++ b/apps/BioModelCalc/BioModelCalcHelper.h @@ -1,53 +1,47 @@ // ----------------------------------------------------------------------- // 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: 1210 $ (last changed revision) -// @date $Date: 2015-11-24 15:52:45 +0100 (Di, 24 Nov 2015) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ #ifndef __BIO_MODEL_CALC_HELPER_H #define __BIO_MODEL_CALC_HELPER_H #include <deque> #include "rttbAccessorInterface.h" #include "rttbDoseAccessorInterface.h" namespace rttb { namespace apps { namespace bioModelCalc { class ApplicationData; void processData(ApplicationData& appData); core::AccessorInterface::Pointer generateBioModel( core::DoseAccessorInterface::Pointer dose, const std::string& model, const std::vector<double>& modelParameters, unsigned int nFractions=1, double doseScaling = 1.0); rttb::core::AccessorInterface::Pointer generateBioModelWithMaps( rttb::core::DoseAccessorInterface::Pointer dose, const std::string& model, const std::deque<rttb::core::AccessorInterface::Pointer>& modelParameterMaps, unsigned int nFractions = 1, double doseScaling = 1.0); } } } #endif diff --git a/apps/BioModelCalc/BioModelCmdLineParser.h b/apps/BioModelCalc/BioModelCmdLineParser.h index 355f939..ae57fd3 100644 --- a/apps/BioModelCalc/BioModelCmdLineParser.h +++ b/apps/BioModelCalc/BioModelCmdLineParser.h @@ -1,43 +1,58 @@ +// ----------------------------------------------------------------------- +// 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. +// +//------------------------------------------------------------------------ + #ifndef __BIO_MODEL_CMD_LINE_PARSER #define __BIO_MODEL_CMD_LINE_PARSER #include "CmdLineParserBase.h" namespace rttb { namespace apps { namespace bioModelCalc { /*! @class BioModelCmdLineParser @brief Argument parsing is parametrized here based on ArgParserLib @see cmdlineparsing::CmdLineParserBase */ class BioModelCmdLineParser : public cmdlineparsing::CmdLineParserBase { public: BioModelCmdLineParser(int argc, const char** argv, const std::string& name, const std::string& version, const std::string& description, const std::string& contributor, const std::string& category); void validateInput() const; void printHelp() const; // Option groups const std::string OPTION_GROUP_REQUIRED = "Required Arguments"; const std::string OPTION_GROUP_OPTIONAL = "Optional Arguments"; // Parameters const std::string OPTION_DOSE_FILE = "dose"; const std::string OPTION_OUTPUT_FILE = "outputFile"; const std::string OPTION_MODEL = "model"; const std::string OPTION_MODEL_PARAMETERS = "modelParameters"; const std::string OPTION_MODEL_PARAMETER_MAPS = "modelParameterMaps"; const std::string OPTION_LOAD_STYLE = "loadStyle"; const std::string OPTION_LOAD_STYLE_PARAMETER_MAPS = "loadStyleParameterMaps"; const std::string OPTION_DOSE_SCALING = "doseScaling"; const std::string OPTION_N_FRACTIONS = "nFractions"; }; } } } #endif \ No newline at end of file diff --git a/testing/apps/BioModelCalc/BioModelCalcInvalidParametersTest.cpp b/testing/apps/BioModelCalc/BioModelCalcInvalidParametersTest.cpp index ed5f185..0d1cb9c 100644 --- a/testing/apps/BioModelCalc/BioModelCalcInvalidParametersTest.cpp +++ b/testing/apps/BioModelCalc/BioModelCalcInvalidParametersTest.cpp @@ -1,98 +1,92 @@ // ----------------------------------------------------------------------- // 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 <iostream> #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 BioModelCalcInvalidParametersTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string bioModelCalcExecutable; if (argc > 1) { bioModelCalcExecutable = argv[1]; } boost::filesystem::path callingPath(_callingAppPath); std::string bioModelCalcExeWithPath = callingPath.parent_path().string() + "/" + bioModelCalcExecutable; //call with too few parameters std::string toofewParametersCommand = bioModelCalcExeWithPath; toofewParametersCommand += " test"; std::cout << "Command line call: " + toofewParametersCommand << std::endl; CHECK_EQUAL(system(toofewParametersCommand.c_str()) != 0, true); toofewParametersCommand = bioModelCalcExeWithPath; toofewParametersCommand += " test test"; std::cout << "Command line call: " + toofewParametersCommand << std::endl; CHECK_EQUAL(system(toofewParametersCommand.c_str()) != 0, true); toofewParametersCommand = bioModelCalcExeWithPath; toofewParametersCommand += " -d test"; toofewParametersCommand += " -o test"; std::cout << "Command line call: " + toofewParametersCommand << std::endl; CHECK_EQUAL(system(toofewParametersCommand.c_str()) != 0, true); //call with invalid model std::string minimalCLI = bioModelCalcExeWithPath + " test test -p 1.0 1.0 "; std::string invalidModelOption = minimalCLI; invalidModelOption += "-m wrongModel"; std::cout << "Command line call: " + invalidModelOption << std::endl; CHECK_EQUAL(system(invalidModelOption.c_str()) != 0, true); //call with only one parameter std::string toofewModelParameterOption = bioModelCalcExeWithPath + " test test -p 1.0"; std::cout << "Command line call: " + toofewModelParameterOption << std::endl; CHECK_EQUAL(system(toofewModelParameterOption.c_str()) != 0, true); toofewModelParameterOption = bioModelCalcExeWithPath + " test test -a parameterMapsTest"; std::cout << "Command line call: " + toofewModelParameterOption << std::endl; CHECK_EQUAL(system(toofewModelParameterOption.c_str()) != 0, true); //call with invalid dose load option std::string invalidDoseLoadOption = minimalCLI; invalidDoseLoadOption += "-t invalidLoadStyleOption"; std::cout << "Command line call: " + invalidDoseLoadOption << std::endl; CHECK_EQUAL(system(invalidDoseLoadOption.c_str()) != 0, true); //call with negative dose scaling std::string negativeDoseScalingCommand = minimalCLI; negativeDoseScalingCommand += "-e -1.0"; std::cout << "Command line call: " + negativeDoseScalingCommand << std::endl; CHECK_EQUAL(system(negativeDoseScalingCommand.c_str()) != 0, true); RETURN_AND_REPORT_TEST_SUCCESS; } } //namespace testing } //namespace rttb diff --git a/testing/apps/BioModelCalc/BioModelCalcParameterMapsTest.cpp b/testing/apps/BioModelCalc/BioModelCalcParameterMapsTest.cpp index 177f570..c683480 100644 --- a/testing/apps/BioModelCalc/BioModelCalcParameterMapsTest.cpp +++ b/testing/apps/BioModelCalc/BioModelCalcParameterMapsTest.cpp @@ -1,102 +1,96 @@ // ----------------------------------------------------------------------- // 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 "boost/algorithm/string.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 BioModelCalcParameterMapsTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string bioModelCalcExecutable; std::string doseFilename; std::string doseFilenameLoadStyle; std::string modelName; std::string modelParameterMaps; std::string modelParameterMapsLoadStyle; std::string referenceFilename; boost::filesystem::path callingPath(_callingAppPath); if (argc > 7) { bioModelCalcExecutable = argv[1]; doseFilename = argv[2]; doseFilenameLoadStyle = argv[3]; modelName = argv[4]; modelParameterMaps = argv[5]; modelParameterMapsLoadStyle = argv[6]; referenceFilename = argv[7]; } std::string bioModelCalcExeWithPath = callingPath.parent_path().string() + "/" + bioModelCalcExecutable; std::string defaultOutputFilename = "bioModelParameterMapOutput.nrrd"; std::string baseCommand = bioModelCalcExeWithPath; baseCommand += " -d \"" + doseFilename + "\""; baseCommand += " -t " + doseFilenameLoadStyle; baseCommand += " -o " + defaultOutputFilename; baseCommand += " -m " + modelName; baseCommand += " -a " + modelParameterMaps; baseCommand += " -u " + modelParameterMapsLoadStyle; std::string defaultDoseStatisticsCommand = baseCommand; std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); // Check result against reference typedef ::itk::Image<double, 3> TestImageType; TestImageType::Pointer referenceImage = io::itk::readITKDoubleImage(referenceFilename); TestImageType::Pointer outputImage = io::itk::readITKDoubleImage(defaultOutputFilename); lit::ImageTester<TestImageType, TestImageType> tester; tester.setExpectedImage(referenceImage); tester.setActualImage(outputImage); tester.setCheckThreshold(0.0); CHECK_TESTER(tester); CHECK_EQUAL(std::remove(defaultOutputFilename.c_str()), 0); RETURN_AND_REPORT_TEST_SUCCESS; } } //namespace testing } //namespace rttb diff --git a/testing/apps/BioModelCalc/BioModelCalcSimpleTest.cpp b/testing/apps/BioModelCalc/BioModelCalcSimpleTest.cpp index 2651225..a21bbda 100644 --- a/testing/apps/BioModelCalc/BioModelCalcSimpleTest.cpp +++ b/testing/apps/BioModelCalc/BioModelCalcSimpleTest.cpp @@ -1,130 +1,124 @@ // ----------------------------------------------------------------------- // 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 BioModelCalcSimpleTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string bioModelCalcExecutable; std::string doseFilename; std::string doseFilenameLoadStyle; std::string modelName; std::string modelArguments; std::string referenceFilename; std::string referenceWithNFractionsFilename; boost::filesystem::path callingPath(_callingAppPath); if (argc > 7) { bioModelCalcExecutable = argv[1]; doseFilename = argv[2]; doseFilenameLoadStyle = argv[3]; modelName = argv[4]; modelArguments = argv[5]; referenceFilename = argv[6]; referenceWithNFractionsFilename = argv[7]; } std::string bioModelCalcExeWithPath = callingPath.parent_path().string() + "/" + bioModelCalcExecutable; std::string defaultOutputFilename = "bioModelOutput.nrrd"; std::string baseCommand = bioModelCalcExeWithPath; baseCommand += " -d \"" + doseFilename + "\""; baseCommand += " -t " + doseFilenameLoadStyle; baseCommand += " -o " + defaultOutputFilename; baseCommand += " -m " + modelName; baseCommand += " -p " + modelArguments; std::string defaultDoseStatisticsCommand = baseCommand; std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); std::string defaultOutputWithNFractionsFilename = "bioModelWithNFractionsOutput.nrrd"; std::string baseCommandWithNFractions = bioModelCalcExeWithPath; baseCommandWithNFractions += " -d \"" + doseFilename + "\""; baseCommandWithNFractions += " -t " + doseFilenameLoadStyle; baseCommandWithNFractions += " -o " + defaultOutputWithNFractionsFilename; baseCommandWithNFractions += " -m " + modelName; baseCommandWithNFractions += " -p " + modelArguments; baseCommandWithNFractions += " -f 2"; std::cout << "Command line call: " + baseCommandWithNFractions << std::endl; CHECK_EQUAL(system(baseCommandWithNFractions.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); // Check result against reference typedef ::itk::Image<double, 3> TestImageType; TestImageType::Pointer referenceImage = io::itk::readITKDoubleImage(referenceFilename); TestImageType::Pointer outputImage = io::itk::readITKDoubleImage(defaultOutputFilename); lit::ImageTester<TestImageType, TestImageType> tester; tester.setExpectedImage(referenceImage); tester.setActualImage(outputImage); tester.setCheckThreshold(0.0); CHECK_TESTER(tester); CHECK_EQUAL(std::remove(defaultOutputFilename.c_str()), 0); CHECK_EQUAL(boost::filesystem::exists(defaultOutputWithNFractionsFilename), true); // Check result against reference TestImageType::Pointer referenceImageNFractions = io::itk::readITKDoubleImage(referenceWithNFractionsFilename); TestImageType::Pointer outputImageNFractions = io::itk::readITKDoubleImage(defaultOutputWithNFractionsFilename); lit::ImageTester<TestImageType, TestImageType> testerWithNFractions; testerWithNFractions.setExpectedImage(referenceImageNFractions); testerWithNFractions.setActualImage(outputImageNFractions); testerWithNFractions.setCheckThreshold(0.0); CHECK_TESTER(testerWithNFractions); CHECK_EQUAL(std::remove(defaultOutputWithNFractionsFilename.c_str()), 0); RETURN_AND_REPORT_TEST_SUCCESS; } } //namespace testing } //namespace rttb diff --git a/testing/apps/BioModelCalc/BioModelCalcTests.cpp b/testing/apps/BioModelCalc/BioModelCalcTests.cpp index b98b1b3..80c298d 100644 --- a/testing/apps/BioModelCalc/BioModelCalcTests.cpp +++ b/testing/apps/BioModelCalc/BioModelCalcTests.cpp @@ -1,71 +1,65 @@ // ----------------------------------------------------------------------- // 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: 1374 $ (last changed revision) -// @date $Date: 2016-05-30 14:15:42 +0200 (Mo, 30 Mai 2016) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ // this file defines the rttbCoreTests for the test driver // and all it expects is that you have a function called registerTests() #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #include "litMultiTestsMain.h" #include "RTToolboxConfigure.h" namespace rttb { namespace testing { const char* _callingAppPath = nullptr; void registerTests() { LIT_REGISTER_TEST(BioModelCalcInvalidParametersTest); LIT_REGISTER_TEST(BioModelCalcSimpleTest); LIT_REGISTER_TEST(BioModelCalcParameterMapsTest); } } //namespace testing } //namespace map int main(int argc, char* argv[]) { int result = 0; rttb::testing::registerTests(); if (argc > 0) { rttb::testing::_callingAppPath = argv[0]; } try { result = lit::multiTestsMain(argc, argv); } catch (...) { result = -1; } return result; }