diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index afa3471..f4e1f76 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -1,61 +1,59 @@ MESSAGE(STATUS "processing RTToolbox apps") -IF (BUILD_App_DoseTool OR BUILD_App_VoxelizerTool OR BUILD_App_BioModelCalc OR BUILD_App_DoseAcc) - IF (WIN32) - IF (MSVC_VERSION LESS 1800) - MESSAGE(FATAL_ERROR "Some features of RTToolbox requires C++11 features that require Visual Studio 2013 or higher.") - ENDIF(MSVC_VERSION LESS 1800) - ENDIF(WIN32) - - #extract and build ArgumentParsingLib - include(ExternalProject) - message(STATUS "ArgumentParsingLib will be automatically downloaded and built.") - set(ArgumentParsingLib_SOURCE_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-src") - set(ArgumentParsingLib_BUILD_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-build") - set(ArgumentParsingLib_CMAKE_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-cmake") - - ExternalProject_Add( - ArgumentParsingLib - URL ${RTToolbox_SOURCE_DIR}/utilities/ArgumentParsingLib/ArgumentParsingLib.tar.gz - SOURCE_DIR ${ArgumentParsingLib_SOURCE_DIR} - BINARY_DIR ${ArgumentParsingLib_BUILD_DIR} - PREFIX ${ArgumentParsingLib_CMAKE_DIR} - INSTALL_COMMAND "" - UPDATE_COMMAND "" - CMAKE_ARGS - -DBUILD_TESTS:BOOL=OFF - -DBoost_INCLUDE_DIR:STRING=${Boost_INCLUDE_DIR} - -DBoost_DIR:STRING=${Boost_DIR} - ) -ENDIF() +IF (WIN32) + IF (MSVC_VERSION LESS 1800) + MESSAGE(FATAL_ERROR "Some features of RTToolbox requires C++11 features that require Visual Studio 2013 or higher.") + ENDIF(MSVC_VERSION LESS 1800) +ENDIF(WIN32) + +#extract and build ArgumentParsingLib +include(ExternalProject) +message(STATUS "ArgumentParsingLib will be automatically downloaded and built.") +set(ArgumentParsingLib_SOURCE_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-src") +set(ArgumentParsingLib_BUILD_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-build") +set(ArgumentParsingLib_CMAKE_DIR "${CMAKE_BINARY_DIR}/external/ArgumentParsingLib-cmake") + +ExternalProject_Add( + ArgumentParsingLib + URL ${RTToolbox_SOURCE_DIR}/utilities/ArgumentParsingLib/ArgumentParsingLib.tar.gz + SOURCE_DIR ${ArgumentParsingLib_SOURCE_DIR} + BINARY_DIR ${ArgumentParsingLib_BUILD_DIR} + PREFIX ${ArgumentParsingLib_CMAKE_DIR} + INSTALL_COMMAND "" + UPDATE_COMMAND "" + CMAKE_ARGS + -DBUILD_TESTS:BOOL=OFF + -DBoost_INCLUDE_DIR:STRING=${Boost_INCLUDE_DIR} + -DBoost_DIR:STRING=${Boost_DIR} +) OPTION(BUILD_App_DoseAcc "Determine if the application DoseAcc will be generated." OFF) IF(BUILD_App_DoseAcc AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY(DoseAcc) ENDIF() OPTION(BUILD_App_DoseMap "Determine if the application DoseMap will be generated." OFF) IF(BUILD_App_DoseMap AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY(DoseMap) ENDIF() OPTION(BUILD_App_DoseTool "Determine if the demo application DoseTool will be generated." OFF) IF(BUILD_App_DoseTool) ADD_SUBDIRECTORY(DoseTool) IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY(DoseTool4V) ENDIF() ENDIF(BUILD_App_DoseTool) OPTION(BUILD_App_VoxelizerTool "Determine if the application VoxelizerTool will be generated." OFF) IF(BUILD_App_VoxelizerTool) ADD_SUBDIRECTORY(VoxelizerTool) ENDIF(BUILD_App_VoxelizerTool) OPTION(BUILD_App_BioModelCalc "Determine if the demo application BioModelCalc will be generated." OFF) IF(BUILD_App_BioModelCalc) ADD_SUBDIRECTORY(BioModelCalc) IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY(BioModelCalc4V) ENDIF() ENDIF(BUILD_App_BioModelCalc) \ No newline at end of file diff --git a/apps/DoseMap/CMakeLists.txt b/apps/DoseMap/CMakeLists.txt index 6331182..d330313 100644 --- a/apps/DoseMap/CMakeLists.txt +++ b/apps/DoseMap/CMakeLists.txt @@ -1,3 +1,3 @@ MESSAGE (STATUS "generating demo app: DoseMap - simple dose mapping tool example") -RTTB_CREATE_APPLICATION(DoseMap DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK) \ No newline at end of file +RTTB_CREATE_APPLICATION(DoseMap DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK ArgumentParsingLib BoostBinaries) \ No newline at end of file diff --git a/apps/DoseMap/DoseMap.cpp b/apps/DoseMap/DoseMap.cpp index 5380149..9a2de01 100644 --- a/apps/DoseMap/DoseMap.cpp +++ b/apps/DoseMap/DoseMap.cpp @@ -1,201 +1,210 @@ // ----------------------------------------------------------------------- // 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 "DoseMapApplicationData.h" #include "DoseMapHelper.h" +#include "DoseMapCmdLineParser.h" + +#include "boost/shared_ptr.hpp" +#include "boost/make_shared.hpp" + +#include "RTToolboxConfigure.h" + +#include "rttbException.h" #include "mapDummyRegistrationAlgorithm.h" rttb::apps::doseMap::ApplicationData appData; /** Main function of dose mapper. @retval 0 normal program execution - @retval 1 showed help or version (flag was set). @retval 2 not enough required input files. - @retval 3 Argument parsing error @retval 4 Error loading input dose file @retval 5 Error loading reference dose file @retval 6 Error loading registration @retval 9 Error while mapping or storing result. */ -int main(int argc, char** argv) +int main(int argc, const char** argv) { int result = 0; - std::cout << "DoseMap - RTTB demo app for simple dose mapping." << std::endl; - - switch (rttb::apps::doseMap::ParseArgumentsForAppData(argc, argv, appData)) + boost::shared_ptr argParser; + + try { - case 1: - { - //showed version or help info. Done. - return 1; - } + std::string appName = "DoseMap"; + std::string appVersion = RTTB_FULL_VERSION_STRING; - case 2: - { - std::cerr << "Missing Parameters. Use one of the following flags for more information:" << - std::endl; - std::cerr << "-? or --help" << std::endl; - return 2; - } + argParser = boost::make_shared(argc, argv, appName, + appVersion,true); - case 3: - { - //wrong option usage. - return 3; - } } + catch (const std::exception& e) + { + std::cerr << e.what() << std::endl; + return 2; + } + - if (appData._fileCount < 2) + // 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)) + { + return 0; + } + try{ + rttb::apps::doseMap::populateAppData(argParser, appData); + } + catch (const std::exception& e) { - std::cerr << "Missing Parameters. Use one of the following flags for more information:" << - std::endl; - std::cerr << "-? or --help" << std::endl; - return 1; + std::cerr << e.what() << std::endl; } std::cout << std::endl << "*******************************************" << std::endl; - std::cout << "Input dose file: " << appData._inputDoseFileName << std::endl; + std::cout << "Input dose file: " << appData._inputDoseFileName << std::endl; + std::cout << "Input dose file load style: " << appData._inputDoseLoadStyle.at(0) << std::endl; + std::cout << "Output file: " << appData._outputFileName << std::endl; if (!(appData._regFileName.empty())) { - std::cout << "Registration file: " << appData._regFileName << std::endl; + std::cout << "Registration file: " << appData._regFileName << std::endl; } if (!(appData._refDoseFileName.empty())) { - std::cout << "Reference dose file: " << appData._refDoseFileName << std::endl; + std::cout << "Reference dose file: " << appData._refDoseFileName << std::endl; + std::cout << "Reference dose style: " << appData._refDoseLoadStyle.at(0) << std::endl; } try { appData._inputDose = rttb::apps::doseMap::loadDose(appData._inputDoseFileName, appData._inputDoseLoadStyle); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 4; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 4; } catch (...) { std::cerr << "Error!!! unknown error while reading input image." << std::endl; return 4; } if (!(appData._refDoseFileName.empty())) { try { appData._refDose = rttb::apps::doseMap::loadDose(appData._refDoseFileName, appData._refDoseLoadStyle); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 5; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 5; } catch (...) { std::cerr << "Error!!! unknown error while reading reference image." << std::endl; return 5; } } else { appData._refDose = appData._inputDose; } if (!(appData._regFileName.empty())) { try { appData._spReg = rttb::apps::doseMap::loadRegistration(appData._regFileName); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 6; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 6; } catch (...) { std::cerr << "Error!!! unknown error while reading registration file." << std::endl; return 6; } } else { //generate dummy identity registration typedef map::algorithm::DummyRegistrationAlgorithm<3> DummyRegType; DummyRegType::Pointer regAlg = DummyRegType::New(); appData._spReg = regAlg->getRegistration(); } try { rttb::apps::doseMap::processData(appData); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 9; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 9; } catch (...) { std::cerr << "Error!!! unknown error while mapping and writing image." << std::endl; return 9; } std::cout << std::endl; return result; } diff --git a/apps/DoseMap/DoseMapApplicationData.cpp b/apps/DoseMap/DoseMapApplicationData.cpp index b3cf506..44241b8 100644 --- a/apps/DoseMap/DoseMapApplicationData.cpp +++ b/apps/DoseMap/DoseMapApplicationData.cpp @@ -1,175 +1,72 @@ // ----------------------------------------------------------------------- // 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: 1145 $ (last changed revision) // @date $Date: 2015-10-12 17:06:10 +0200 (Mo, 12 Okt 2015) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include "DoseMapApplicationData.h" -#include "itksys/SystemTools.hxx" -#include "itksys/CommandLineArguments.hxx" - -#include "RTToolboxConfigure.h" namespace rttb { namespace apps { namespace doseMap { - int unknown_argument(const char* argument, void* call_data) - { - std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; - return 0; - } - ApplicationData:: - ApplicationData() + ApplicationData() { - this->Reset(); + this->reset(); } void - ApplicationData:: - Reset() + ApplicationData:: + reset() { _inputDoseFileName = ""; _refDoseFileName = ""; _outputFileName = ""; _regFileName = ""; - _interpolatorName = "linear"; - - _showVersion = false; - _showHelp = false; - - _fileCount = 0; } - unsigned int - ParseArgumentsForAppData(int argc, char** argv, ApplicationData& appData) + void populateAppData(boost::shared_ptr argParser, ApplicationData& appData) { - itksys::CommandLineArguments cmdParser; - - appData.Reset(); - - if (argc > 2) - { - appData._inputDoseFileName = argv[1]; - ++appData._fileCount; - --argc; - ++argv; - - appData._outputFileName = argv[1]; - ++appData._fileCount; - --argc; - ++argv; + appData.reset(); + + appData._inputDoseFileName = argParser->get(argParser->OPTION_INPUT_DOSE_FILE_NAME); + appData._outputFileName = argParser->get(argParser->OPTION_OUTPUT_FILE_NAME); + appData._interpolatorName = argParser->get(argParser->OPTION_INTERPOLATOR); + appData._regFileName = argParser->get(argParser->OPTION_REG_FILE_NAME); + appData._inputDoseLoadStyle = argParser->get > (argParser->OPTION_INPUT_DOSE_LOAD_STYLE); + + + if (!argParser->isSet(argParser->OPTION_REF_DOSE_FILE)){ + appData._refDoseFileName = argParser->get(argParser->OPTION_INPUT_DOSE_FILE_NAME); + appData._refDoseLoadStyle = argParser->get >(argParser->OPTION_INPUT_DOSE_LOAD_STYLE); } - - cmdParser.Initialize(argc, argv); - - cmdParser.SetUnknownArgumentCallback(unknown_argument); - - cmdParser.AddArgument("--interpolator", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._interpolatorName), - "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); - cmdParser.AddArgument("-i", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._interpolatorName), - "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); - - cmdParser.AddArgument("--registration", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._regFileName), - "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); - cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._regFileName), - "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); - - cmdParser.AddArgument("--template", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._refDoseFileName), - "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); - cmdParser.AddArgument("-t", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._refDoseFileName), - "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); - - cmdParser.AddArgument("--loadStyleInput", itksys::CommandLineArguments::MULTI_ARGUMENT, - &(appData._inputDoseLoadStyle), - "Indicates the load style that should be used for the input dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle1 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); - - cmdParser.AddArgument("--loadStyleReference", itksys::CommandLineArguments::MULTI_ARGUMENT, - &(appData._refDoseLoadStyle), - "Indicates the load style that should be used for the reference dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle2 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); - - cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showVersion), - "Shows the version of the program."); - - cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("/h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("/?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - - if (!cmdParser.Parse()) - { - std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; - std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << - "Use one of the following flags for more information:" << std::endl; - std::cerr << "-? or --help" << std::endl; - return 3; - }; - - if (appData._showHelp) - { - std::cout << std::endl << "Usage: " << std::endl << std::endl; - std::cout << " DoseMap [options]" << std::endl << std::endl; - std::cout << " Dose1: File path to the input dose." << std::endl; - std::cout << " DoseOutput: File path where the output should be stored." << std::endl << - std::endl; - std::cout << "Command-Line Options:" << std::endl << std::endl; - std::cout << cmdParser.GetHelp() << std::endl << std::endl; - std::cout << " Example:" << std::endl << std::endl; - std::cout << - " DoseMap dose1.mhd result.mhd -r reg.mapr --loadStyleInput itk --loadStyleReference itk" << - std::endl << std::endl; - std::cout << - " This will map \"dose1.mhd\" by using \"reg.mapr\" into the grid geometry of the input dose. The resulting dose will be stored in \"result.mhd\"." - << std::endl; - return 1; + else{ + appData._refDoseFileName = argParser->get(argParser->OPTION_REF_DOSE_FILE); + appData._refDoseLoadStyle = argParser->get >(argParser->OPTION_REF_DOSE_LOAD_STYLE); } - - if (appData._showVersion) - { - std::cout << std::endl << "Version: " << RTTB_FULL_VERSION_STRING; - return 1; - } - - if (appData._fileCount < 2) - { - return 2; - } - - return 0; - }; - + + } } } -} +} \ No newline at end of file diff --git a/apps/DoseMap/DoseMapApplicationData.h b/apps/DoseMap/DoseMapApplicationData.h index 737b0c6..a172fbf 100644 --- a/apps/DoseMap/DoseMapApplicationData.h +++ b/apps/DoseMap/DoseMapApplicationData.h @@ -1,87 +1,76 @@ // ----------------------------------------------------------------------- // 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) */ -#ifndef __DOSE_MAP_APPLICATION_DATA_H -#define __DOSE_MAP_APPLICATION_DATA_H +#ifndef __DOSEMAP_APPLICATION_DATA_H +#define __DOSEMAP_APPLICATION_DATA_H #include "mapRegistration.h" -#include "rttbBaseType.h" + #include "rttbDoseAccessorInterface.h" +#include "DoseMapCmdLineParser.h" namespace rttb { namespace apps { namespace doseMap { class ApplicationData { public: typedef map::core::Registration<3, 3> RegistrationType; /**Vector of arguments used to specify the loading style (always the first argument) * and, if needed, additional arguments for the specified loading style (e.g. location of the * Virtuos plan file for the Virtuos IO style). */ typedef std::vector LoadingStyleArgType; /** Loaded Dose.*/ core::DoseAccessorInterface::DoseAccessorPointer _inputDose; std::string _inputDoseFileName; LoadingStyleArgType _inputDoseLoadStyle; core::DoseAccessorInterface::DoseAccessorPointer _refDose; std::string _refDoseFileName; LoadingStyleArgType _refDoseLoadStyle; RegistrationType::Pointer _spReg; std::string _regFileName; std::string _outputFileName; std::string _interpolatorName; - bool _showVersion; - bool _showHelp; - - int _fileCount; - - void Reset(); + void reset(); ApplicationData(); }; - /** Parse the application argument passed when starting the application. - * If no error or special request occurred the return is 0. Otherwise the return values - * have the following meaning: \n - * 0: Normal parsing.\n - * 1: showed help or version (flag was set).\n - * 2: not enough required input files.\n - * 3: Parsing error.\n - * @param argc Number of parameter arguments - * @param argv Pointer to the passed arguments - * @return Result code of the parsing (see above).**/ - unsigned int ParseArgumentsForAppData(int argc, char** argv, ApplicationData& appData); + + /*! @brief Reads the necessary arguments from the DoseToolCmdLineParser and writes them in the respective variables of ApplicationData. + */ + void populateAppData(boost::shared_ptr argParser, ApplicationData& appData); } } } #endif diff --git a/apps/DoseMap/DoseMapCmdLineParser.cpp b/apps/DoseMap/DoseMapCmdLineParser.cpp new file mode 100644 index 0000000..f4a8326 --- /dev/null +++ b/apps/DoseMap/DoseMapCmdLineParser.cpp @@ -0,0 +1,118 @@ +// ----------------------------------------------------------------------- +// 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: 1145 $ (last changed revision) +// @date $Date: 2015-10-12 17:06:10 +0200 (Mo, 12 Okt 2015) $ (last change date) +// @author $Author: hentsch $ (last changed by) +*/ + +#include "DoseMapCmdLineParser.h" + +namespace rttb +{ + namespace apps + { + namespace doseMap + { + + DoseMapCmdLineParser::DoseMapCmdLineParser(int argc, const char** argv, const std::string& name, + const std::string& version, bool virtuosSupport) : + CmdLineParserBase(name, version), _virtuosSupport(virtuosSupport) + { + std::vector defaultLoadingStyle; + defaultLoadingStyle.push_back("dicom"); + std::string doseLoadStyleDescription = "Indicates the load style that should be used for the input dose. Available styles: \"dicom\": normal dicom dose (default);" + "\"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle1 virtuos myFavorite.pln\");" + "\"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."; + + addOption(OPTION_INPUT_DOSE_FILE_NAME, OPTION_GROUP_REQUIRED, + "The name of the input dose file. Can be omitted if used as positional argument (see above).", 'd', true); + + addOption(OPTION_OUTPUT_FILE_NAME, OPTION_GROUP_REQUIRED, + "The name of the output file. Can be omitted if used as positional argument (see above).", 'o', true); + + addOptionWithDefaultValue(OPTION_INTERPOLATOR, OPTION_GROUP_REQUIRED, "Specifies the interpolator that should be used for mapping." + "Available options are: \"nn\": nearest neighbour,\"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\".", + "linear", "linear", 'i', true); + + addOptionWithDefaultValue(OPTION_REG_FILE_NAME, OPTION_GROUP_REQUIRED, "Specifies name and location of the registration file that should be used to map the input dose. " + "Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration.", "", "no mapping", 'r',true); + + addOption(OPTION_REF_DOSE_FILE, OPTION_GROUP_OPTIONAL, "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. " + "If flag is not specified, the input dose is the reference.", 't'); + + addOptionWithDefaultValue >(OPTION_INPUT_DOSE_LOAD_STYLE, OPTION_GROUP_REQUIRED, doseLoadStyleDescription, + defaultLoadingStyle, defaultLoadingStyle.at(0),'l',true); + + addOptionWithDefaultValue >(OPTION_REF_DOSE_LOAD_STYLE, OPTION_GROUP_OPTIONAL, doseLoadStyleDescription, + defaultLoadingStyle, defaultLoadingStyle.at(0), 's', true); + + addPositionalOption(OPTION_INPUT_DOSE_FILE_NAME, 1); + addPositionalOption(OPTION_OUTPUT_FILE_NAME, 1); + + parse(argc, argv); + } + + void DoseMapCmdLineParser::validateInput() const + { + auto interpolator = get(OPTION_INTERPOLATOR); + if (interpolator != "nn" && interpolator != "linear" + && interpolator != "rosu") + { + throw cmdlineparsing::InvalidConstraintException("Unknown interpolator: " + + interpolator + + ".\nPlease refer to the help for valid interpolator settings."); + } + + + std::vector inputDoseLoadStyle = get >(OPTION_INPUT_DOSE_LOAD_STYLE); + std::string indoseLoadStyleAbbreviation = inputDoseLoadStyle.at(0); + if (indoseLoadStyleAbbreviation != "dicom" && indoseLoadStyleAbbreviation != "virtuos" + && indoseLoadStyleAbbreviation != "itk" && indoseLoadStyleAbbreviation != "helax") + { + throw cmdlineparsing::InvalidConstraintException("Unknown load style for input dose file: " + + indoseLoadStyleAbbreviation + + ".\nPlease refer to the help for valid loading style settings."); + } + + if (isSet(OPTION_REF_DOSE_FILE)){ + std::vector refDoseLoadStyle = get >(OPTION_REF_DOSE_LOAD_STYLE); + std::string refDoseLoadStyleAbbreviation = refDoseLoadStyle.at(0); + if (refDoseLoadStyleAbbreviation != "dicom" && refDoseLoadStyleAbbreviation != "virtuos" + && refDoseLoadStyleAbbreviation != "itk" && refDoseLoadStyleAbbreviation != "helax") + { + throw cmdlineparsing::InvalidConstraintException("Unknown load style for reference dose file: " + + refDoseLoadStyleAbbreviation + + ".\nPlease refer to the help for valid loading style settings."); + } + } + + } + + void DoseMapCmdLineParser::printHelp() const + { + cmdlineparsing::CmdLineParserBase::printHelp(); + std::cout << "Example:" << std::endl << std::endl; + std::cout << m_programName << + " dose1.mhd result.mhd -r reg.mapr --" << OPTION_INPUT_DOSE_LOAD_STYLE << " itk --" << OPTION_REF_DOSE_LOAD_STYLE+ " itk" << + std::endl << std::endl; + std::cout << + "This will map \"dose1.mhd\" by using \"reg.mapr\" into the grid geometry of the input dose. The resulting dose will be stored in \"result.mhd\"." + << std::endl; + } + } + } +} diff --git a/apps/DoseMap/DoseMapCmdLineParser.h b/apps/DoseMap/DoseMapCmdLineParser.h new file mode 100644 index 0000000..7989736 --- /dev/null +++ b/apps/DoseMap/DoseMapCmdLineParser.h @@ -0,0 +1,66 @@ +// ----------------------------------------------------------------------- +// 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) +*/ + + +#ifndef __DOSEMAP_CMD_LINE_PARSER +#define __DOSEMAP_CMD_LINE_PARSER + +#include "CmdLineParserBase.h" +namespace rttb +{ + namespace apps + { + namespace doseMap + { + /*! @class BioModelCmdLineParser + @brief Argument parsing is parametrized here based on ArgParserLib + @see cmdlineparsing::CmdLineParserBase + */ + class DoseMapCmdLineParser : public cmdlineparsing::CmdLineParserBase + { + public: + DoseMapCmdLineParser(int argc, const char** argv, const std::string& name, + const std::string& version, bool virtuosSupport = false); + 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_INPUT_DOSE_FILE_NAME = "inputDoseFileName"; + const std::string OPTION_OUTPUT_FILE_NAME = "outputFileName"; + const std::string OPTION_INTERPOLATOR = "interpolator"; + const std::string OPTION_REG_FILE_NAME = "regFileName"; + const std::string OPTION_REF_DOSE_FILE = "refDoseFile"; + const std::string OPTION_REF_DOSE_LOAD_STYLE = "refDoseLoadStyle"; + const std::string OPTION_INPUT_DOSE_LOAD_STYLE = "inputDoseLoadStyle"; + + + bool _virtuosSupport; + }; + + } + } +} + +#endif \ No newline at end of file diff --git a/apps/DoseMap/DoseMapHelper.h b/apps/DoseMap/DoseMapHelper.h index 1704090..4524458 100644 --- a/apps/DoseMap/DoseMapHelper.h +++ b/apps/DoseMap/DoseMapHelper.h @@ -1,58 +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: 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) */ #ifndef __DOSE_MAP_HELPER_H #define __DOSE_MAP_HELPER_H #include "DoseMapApplicationData.h" namespace rttb { namespace apps { namespace doseMap { /**loads the dose from a file. Throws exception if loading fails*/ core::DoseAccessorInterface::DoseAccessorPointer loadDose(const std::string& fileName, const rttb::apps::doseMap::ApplicationData::LoadingStyleArgType& args); /**loads the dose from a file using the dicom dose generator. Throws exception if loading fails*/ core::DoseAccessorInterface::DoseAccessorPointer loadDicomDose(const std::string& fileName); + /**loads the dose from a path using the helax io dose generator. Throws exception if loading fails*/ core::DoseAccessorInterface::DoseAccessorPointer loadHelaxDose(const std::string& path); + /**loads the dose from a file stored in an ITK supported data format. Throws exception if loading fails*/ core::DoseAccessorInterface::DoseAccessorPointer loadITKDose(const std::string& fileName); + + + + + /**loads the dose from a file stored in Virtuos data format. Throws exception if loading fails*/ core::DoseAccessorInterface::DoseAccessorPointer loadVirtuosDose(const std::string& fileName, const std::string& planFileName); ApplicationData::RegistrationType::Pointer loadRegistration(const std::string& fileName); /**Containes the business logic for the accumulation of the doses and the storing of the result. Uses appData for the input data and the correct configuration.*/ void processData(ApplicationData& appData); } } } #endif diff --git a/apps/DoseMap/files.cmake b/apps/DoseMap/files.cmake index 69e97c4..8f16067 100644 --- a/apps/DoseMap/files.cmake +++ b/apps/DoseMap/files.cmake @@ -1,13 +1,15 @@ SET(CPP_FILES DoseMap.cpp DoseMapHelper.cpp DoseMapApplicationData.cpp +DoseMapCmdLineParser.cpp ) SET(H_FILES DoseMapHelper.h DoseMapApplicationData.h +DoseMapCmdLineParser.h ) SET(TPP_FILES ) diff --git a/testing/apps/CMakeLists.txt b/testing/apps/CMakeLists.txt index d85d9f6..79b699d 100644 --- a/testing/apps/CMakeLists.txt +++ b/testing/apps/CMakeLists.txt @@ -1,13 +1,17 @@ MESSAGE (STATUS "Process All apps Tests...") #----------------------------------------------------------------------------- # Include sub directories #----------------------------------------------------------------------------- IF(BUILD_App_DoseTool) ADD_SUBDIRECTORY (DoseTool) ENDIF(BUILD_App_DoseTool) IF(BUILD_App_VoxelizerTool) ADD_SUBDIRECTORY (VoxelizerTool) ENDIF(BUILD_App_VoxelizerTool) + +IF(BUILD_App_DoseMap) + ADD_SUBDIRECTORY (DoseMap) +ENDIF() diff --git a/testing/apps/DoseMap/CMakeLists.txt b/testing/apps/DoseMap/CMakeLists.txt new file mode 100644 index 0000000..0235e70 --- /dev/null +++ b/testing/apps/DoseMap/CMakeLists.txt @@ -0,0 +1,30 @@ +#----------------------------------------------------------------------------- +# Setup the system information test. Write out some basic failsafe +# information in case the test doesn't run. +#----------------------------------------------------------------------------- + + +SET(DOSEMAP_TEST ${EXECUTABLE_OUTPUT_PATH}/rttbDoseMapTests) + +SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) + +SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) + + +#----------------------------------------------------------------------------- + +IF(MSVC) + ADD_DEFINITIONS(/bigobj) +ENDIF() + +IF (WIN32) + SET(DOSEMAPEXE "DoseMap.exe") +ELSE (WIN32) + SET(DOSEMAPEXE "./DoseMap") +ENDIF (WIN32) + +ADD_TEST(DoseMapInvalidParametersTest ${DOSEMAP_TEST} DoseMapInvalidParametersTest ${DOSEMAPEXE}) +ADD_TEST(DoseMapSimpleTest ${DOSEMAP_TEST} DoseMapSimpleTest ${DOSEMAPEXE} "${TEST_DATA_ROOT}/DoseMap/input.mhd" "${TEST_DATA_ROOT}/DoseMap/outputfile.mhd" "itk" "${TEST_DATA_ROOT}/DoseMap/Identity.mapr" ) + + +RTTB_CREATE_APPLICATION_TESTS(DoseMap PACKAGE_DEPENDS Litmus BoostBinaries) diff --git a/testing/apps/DoseMap/DoseMapInvalidParametersTest.cpp b/testing/apps/DoseMap/DoseMapInvalidParametersTest.cpp new file mode 100644 index 0000000..960224d --- /dev/null +++ b/testing/apps/DoseMap/DoseMapInvalidParametersTest.cpp @@ -0,0 +1,74 @@ +// ----------------------------------------------------------------------- +// 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 + +#include "litCheckMacros.h" + +#include "boost/filesystem.hpp" + +namespace rttb +{ + namespace testing + { + + //path to the current running directory. DoseMap is in the same directory (Debug/Release) + extern const char* _callingAppPath; + + int DoseMapInvalidParametersTest(int argc, char* argv[]) + { + PREPARE_DEFAULT_TEST_REPORTING; + + std::string doseMapExecutable; + + if (argc > 1) + { + doseMapExecutable = argv[1]; + } + + boost::filesystem::path callingPath(_callingAppPath); + std::string doseMapExeWithPath = callingPath.parent_path().string() + "/" + doseMapExecutable; + + //call with too few parameters + std::string toofewParametersCommand = doseMapExeWithPath + " -d test"; + std::cout << "Command line call: " + toofewParametersCommand << std::endl; + CHECK_EQUAL(system(toofewParametersCommand.c_str()) != 0, true); + + toofewParametersCommand = doseMapExeWithPath + " test"; + std::cout << "Command line call: " + toofewParametersCommand << std::endl; + CHECK_EQUAL(system(toofewParametersCommand.c_str()) != 0, true); + + + //call with invalid dose load option + std::string minimalCLI = doseMapExeWithPath + " test test "; + std::string invalidDoseLoadOption = minimalCLI + "-l wrongOption"; + std::cout << "Command line call: " + invalidDoseLoadOption << std::endl; + CHECK_EQUAL(system(invalidDoseLoadOption.c_str()) != 0, true); + + //call with invalid interpolator + std::string invalidInterpolatorOption = minimalCLI + "-i wrongOption"; + std::cout << "Command line call: " + invalidInterpolatorOption << std::endl; + CHECK_EQUAL(system(invalidInterpolatorOption.c_str()) != 0, true); + + RETURN_AND_REPORT_TEST_SUCCESS; + } + } //namespace testing +} //namespace rttb diff --git a/testing/apps/DoseMap/DoseMapSimpleTest.cpp b/testing/apps/DoseMap/DoseMapSimpleTest.cpp new file mode 100644 index 0000000..4fc6b49 --- /dev/null +++ b/testing/apps/DoseMap/DoseMapSimpleTest.cpp @@ -0,0 +1,94 @@ +// ----------------------------------------------------------------------- +// 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 + + + +#include "litCheckMacros.h" + +#include "boost/filesystem.hpp" + + +namespace rttb +{ + namespace testing + { + + //path to the current running directory. DoseMap is in the same directory (Debug/Release) + extern const char* _callingAppPath; + + static std::string readFile(const std::string& filename); + + int DoseMapSimpleTest(int argc, char* argv[]) + { + PREPARE_DEFAULT_TEST_REPORTING; + + std::string doseMapExecutable; + std::string regFilename; + std::string inputFilename; + std::string outputFilename; + std::string refDoseLoadStyle; + std::string inputDoseLoadStyle; + + + boost::filesystem::path callingPath(_callingAppPath); + + + if (argc > 5 ) + { + doseMapExecutable = argv[1]; + inputFilename = argv[2]; + outputFilename = argv[3]; + inputDoseLoadStyle = argv[4]; + regFilename = argv[5]; + + } + + + //check if file exists + + + + std::string doseMapExeWithPath = callingPath.parent_path().string() + "/" + doseMapExecutable; + std::string baseCommand = doseMapExeWithPath +" "+ inputFilename +" "+ outputFilename; + + + + std::string defaultDoseStatisticsCommand = baseCommand+" -l "+ inputDoseLoadStyle; + std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; + CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); + + CHECK_EQUAL(boost::filesystem::exists(outputFilename), true); + CHECK_EQUAL(std::remove(outputFilename.c_str()),0); + + std::string defaultDoseStatisticsCommandwithregistration = defaultDoseStatisticsCommand+ " -r " + regFilename; + std::cout << "Command line call: " + defaultDoseStatisticsCommandwithregistration << std::endl; + CHECK_EQUAL(system(defaultDoseStatisticsCommandwithregistration.c_str()), 0); + + CHECK_EQUAL(boost::filesystem::exists(outputFilename), true); + CHECK_EQUAL(std::remove(outputFilename.c_str()), 0); + + + RETURN_AND_REPORT_TEST_SUCCESS; + } + } //namespace testing +} //namespace rttb diff --git a/testing/apps/DoseMap/DoseMapTests.cpp b/testing/apps/DoseMap/DoseMapTests.cpp new file mode 100644 index 0000000..6606858 --- /dev/null +++ b/testing/apps/DoseMap/DoseMapTests.cpp @@ -0,0 +1,70 @@ +// ----------------------------------------------------------------------- +// 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 = NULL; + + void registerTests() + { + LIT_REGISTER_TEST(DoseMapInvalidParametersTest); + LIT_REGISTER_TEST(DoseMapSimpleTest); + } + + } //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; +} diff --git a/testing/apps/DoseMap/files.cmake b/testing/apps/DoseMap/files.cmake new file mode 100644 index 0000000..5169ca5 --- /dev/null +++ b/testing/apps/DoseMap/files.cmake @@ -0,0 +1,8 @@ +SET(CPP_FILES + DoseMapInvalidParametersTest.cpp + DoseMapSimpleTest.cpp + DoseMapTests.cpp + ) + +SET(H_FILES +) diff --git a/testing/apps/DoseTool/CMakeLists.txt b/testing/apps/DoseTool/CMakeLists.txt index 6f2bbcd..7c19a1a 100644 --- a/testing/apps/DoseTool/CMakeLists.txt +++ b/testing/apps/DoseTool/CMakeLists.txt @@ -1,46 +1,45 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- - SET(DOSETOOL_TEST ${EXECUTABLE_OUTPUT_PATH}/rttbDoseToolTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) #----------------------------------------------------------------------------- IF(MSVC) ADD_DEFINITIONS(/bigobj) ENDIF() IF (WIN32) SET(DOSETOOLEXE "DoseTool.exe") SET(DOSETOOL4VEXE "DoseTool4V.exe") ELSE (WIN32) SET(DOSETOOLEXE "./DoseTool") SET(DOSETOOL4VEXE "./DoseTool4V") ENDIF (WIN32) ADD_TEST(DoseToolBasicUsageTest ${DOSETOOL_TEST} DoseToolBasicUsageTest ${DOSETOOLEXE}) ADD_TEST(DoseToolInvalidParametersTest ${DOSETOOL_TEST} DoseToolInvalidParametersTest ${DOSETOOLEXE}) IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) ADD_TEST(DoseToolVirtuosDoseVirtuosStructTest ${DOSETOOL_TEST} DoseToolVirtuosDoseTest ${DOSETOOL4VEXE} "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.pln" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.ctx.gz" "DARM" "${TEST_DATA_ROOT}/DoseStatistics/virtuos.xml" "${TEST_DATA_ROOT}/DoseStatistics/virtuosComplex.xml") ADD_TEST(DoseToolITKDoseVirtuosStructTest ${DOSETOOL_TEST} DoseToolITKDoseTest ${DOSETOOL4VEXE} "${TEST_DATA_ROOT}/ITK/virtuosTestDose.mhd" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.ctx.gz" "DARM" "${TEST_DATA_ROOT}/DoseStatistics/itkVirtuosStruct.xml" "${TEST_DATA_ROOT}/DoseStatistics/itkVirtuosStructComplex.xml") ENDIF() ADD_TEST(DoseToolDicomDoseDicomStructTest ${DOSETOOL_TEST} DoseToolDicomDoseTest ${DOSETOOLEXE} "${TEST_DATA_ROOT}/DICOM/TestDose/dicompylerTestDose.dcm" "${TEST_DATA_ROOT}/DICOM/StructureSet/rtss.dcm" "Nodes" "${TEST_DATA_ROOT}/DoseStatistics/dicom.xml" "${TEST_DATA_ROOT}/TestDVH/dicompylerDVH.xml" "${TEST_DATA_ROOT}/DoseStatistics/dicomComplex.xml") ADD_TEST(DoseToolITKDoseDicomStructTest ${DOSETOOL_TEST} DoseToolITKDoseTest ${DOSETOOLEXE} "${TEST_DATA_ROOT}/ITK/dicompylerTestDose.mhd" "${TEST_DATA_ROOT}/DICOM/StructureSet/rtss.dcm" "" "Nodes" "${TEST_DATA_ROOT}/DoseStatistics/itkDicomStruct.xml" "${TEST_DATA_ROOT}/DoseStatistics/itkDicomStructComplex.xml") ADD_TEST(DoseToolDicomDoseDicomStructRegexTest ${DOSETOOL_TEST} DoseToolRegexTest ${DOSETOOLEXE} "${TEST_DATA_ROOT}/DICOM/TestDose/dicompylerTestDose.dcm" "dicom" "${TEST_DATA_ROOT}/DICOM/StructureSet/rtss.dcm" "dicom" "Nodes|Heart" "${TEST_DATA_ROOT}/DoseStatistics/dicom.xml" "${TEST_DATA_ROOT}/DoseStatistics/dicom_heart.xml") ADD_TEST(DoseToolDVHTest ${DOSETOOL_TEST} DoseToolDVHTest ${DOSETOOLEXE} "${TEST_DATA_ROOT}/DICOM/TestDose/dicompylerTestDose.dcm" "${TEST_DATA_ROOT}/DICOM/StructureSet/rtss.dcm" "Nodes" "${TEST_DATA_ROOT}/TestDVH/dicompylerDVH.xml") RTTB_CREATE_APPLICATION_TESTS(DoseTool PACKAGE_DEPENDS Litmus BoostBinaries)