diff --git a/apps/DoseMap/DoseMap.cpp b/apps/DoseMap/DoseMap.cpp index 7b3fd1c..703751a 100644 --- a/apps/DoseMap/DoseMap.cpp +++ b/apps/DoseMap/DoseMap.cpp @@ -1,210 +1,212 @@ // ----------------------------------------------------------------------- // 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, const char** argv) { int result = 0; boost::shared_ptr argParser; try { std::string appName = "DoseMap"; std::string appVersion = RTTB_FULL_VERSION_STRING; argParser = boost::make_shared(argc, argv, appName, appVersion); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return 5; } // 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 << e.what() << "blablabla" << std::endl; + std::cerr << e.what() << std::endl; } std::cout << std::endl << "*******************************************" << std::endl; - std::cout << "Input dose file: " << appData._inputDoseFileName << std::endl; - std::cout << "Output file: " << appData._outputFileName << 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 049ff8f..a74c8e7 100644 --- a/apps/DoseMap/DoseMapApplicationData.cpp +++ b/apps/DoseMap/DoseMapApplicationData.cpp @@ -1,71 +1,73 @@ // ----------------------------------------------------------------------- // 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" namespace rttb { namespace apps { namespace doseMap { ApplicationData:: ApplicationData() { this->reset(); } void ApplicationData:: reset() { _inputDoseFileName = ""; _refDoseFileName = ""; _outputFileName = ""; _regFileName = ""; _interpolatorName = "linear"; } void populateAppData(boost::shared_ptr argParser, ApplicationData& appData) { 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); - appData._refDoseLoadStyle = argParser->get >(argParser->OPTION_REF_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); } else{ appData._refDoseFileName = argParser->get(argParser->OPTION_REF_DOSE_FILE); + appData._refDoseLoadStyle = argParser->get >(argParser->OPTION_REF_DOSE_LOAD_STYLE); } } } } } \ No newline at end of file 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/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)