diff --git a/CMakeLists.txt b/CMakeLists.txt index 314a19e..a79dd44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,330 +1,322 @@ #----------------------------------------------------------------------------- # This is the root RTToolbox CMakeList file. #----------------------------------------------------------------------------- PROJECT(RTToolbox) CMAKE_MINIMUM_REQUIRED(VERSION 3.1) # RTToolbox version number. SET(RTToolbox_VERSION_MAJOR "5") SET(RTToolbox_VERSION_MINOR "1") SET(RTToolbox_VERSION_PATCH "0") # Version string should not include patch level. The major.minor is # enough to distinguish available features of the toolbox. SET(RTToolbox_VERSION_STRING "${RTToolbox_VERSION_MAJOR}.${RTToolbox_VERSION_MINOR}") SET(RTToolbox_FULL_VERSION_STRING "${RTToolbox_VERSION_MAJOR}.${RTToolbox_VERSION_MINOR}.${RTToolbox_VERSION_PATCH}") # default build type SET(CMAKE_BUILD_TYPE Release) MARK_AS_ADVANCED(BUILD_SHARED_LIBS) IF (WIN32) IF (MSVC_VERSION LESS 1800) MESSAGE(FATAL_ERROR "RTToolbox requires at least Visual Studio 2013.") ENDIF() add_definitions(-D_SCL_SECURE_NO_WARNINGS) ELSE (WIN32) IF (CMAKE_COMPILER_IS_GNUCC) IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0) MESSAGE(AUTHOR_WARNING "RTToolbox requires at leas GCC 4.8. GCC 5.x and 6.x were not tested. You are using GCC " ${CMAKE_CXX_COMPILER_VERSION} ". This compiler version might not work.") ENDIF() ENDIF() ENDIF(WIN32) IF(COMMAND CMAKE_POLICY) # Enable old CMake behaviour when dealing with export_library_dependencies(). # This is necessary to avoid warnings in CMake versions # greater than 3.0 # See http://www.cmake.org/cmake/help/v3.0/policy/CMP0033.html CMAKE_POLICY(SET CMP0033 OLD) IF(POLICY CMP0062) CMAKE_POLICY(SET CMP0062 OLD) ENDIF() ENDIF(COMMAND CMAKE_POLICY) #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- include(cmake/MacroParseArguments.cmake) include(cmake/rttbMacroCreateModuleConf.cmake) include(cmake/rttbMacroCreateModule.cmake) include(cmake/rttbMacroCreateApplication.cmake) include(cmake/rttbMacroCheckModule.cmake) include(cmake/rttbMacroUseModule.cmake) include(cmake/rttbMacroCreateTestModule.cmake) include(cmake/rttbFunctionOrganizeSources.cmake) include(cmake/rttbMacroCreateApplicationTests.cmake) #----------------------------------------------------------------------------- # Basis config RTTB module infrastructure #----------------------------------------------------------------------------- set(RTTB_MODULES_CONF_DIR ${RTToolbox_BINARY_DIR}/modulesConf CACHE INTERNAL "Modules Conf") set(RTTB_MODULES_PACKAGE_DEPENDS_DIR ${RTToolbox_SOURCE_DIR}/cmake/PackageDepends) set(MODULES_PACKAGE_DEPENDS_DIRS ${RTTB_MODULES_PACKAGE_DEPENDS_DIR}) #----------------------------------------------------------------------------- # Testing setup # Configure Dart testing support. This should be done before any # MESSAGE(FATAL_ERROR ...) commands are invoked. #----------------------------------------------------------------------------- #build no tests as default OPTION(BUILD_TESTING "build tests" OFF) IF(BUILD_TESTING) SET(CTEST_NEW_FORMAT 1) INCLUDE(CTest) ENABLE_TESTING() CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/cmake/RemoveTemporaryFiles.cmake.in ${RTToolbox_BINARY_DIR}/cmake/RemoveTemporaryFiles.cmake @ONLY IMMEDIATE) CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/cmake/rttbSampleBuildTest.cmake.in ${RTToolbox_BINARY_DIR}/cmake/rttbSampleBuildTest.cmake @ONLY) CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/cmake/CTestCustom.ctest.in ${RTToolbox_BINARY_DIR}/cmake/CTestCustom.ctest @ONLY) FILE(WRITE ${RTToolbox_BINARY_DIR}/CTestCustom.cmake "INCLUDE(\"${RTToolbox_BINARY_DIR}/cmake/CTestCustom.ctest\")\n") SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard") MARK_AS_ADVANCED(BUILDNAME) ENDIF(BUILD_TESTING) #----------------------------------------------------------------------------- # Output directories. #----------------------------------------------------------------------------- IF(NOT LIBRARY_OUTPUT_PATH) SET (LIBRARY_OUTPUT_PATH ${RTToolbox_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.") ENDIF(NOT LIBRARY_OUTPUT_PATH) IF(NOT EXECUTABLE_OUTPUT_PATH) SET (EXECUTABLE_OUTPUT_PATH ${RTToolbox_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.") ENDIF(NOT EXECUTABLE_OUTPUT_PATH) MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) SET(RTToolbox_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}") SET(RTToolbox_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}") #----------------------------------------------------------------------------- # Find Doxygen. #----------------------------------------------------------------------------- FIND_PROGRAM(DOXYGEN_EXECUTABLE "doxygen") #----------------------------------------------------------------------------- # Installation vars. # RTToolbox_INSTALL_BIN_DIR - binary dir (executables) # RTToolbox_INSTALL_LIB_DIR - library dir (libs) # RTToolbox_INSTALL_INCLUDE_DIR - include dir (headers) # RTToolbox_INSTALL_NO_DEVELOPMENT - do not install development files # RTToolbox_INSTALL_NO_RUNTIME - do not install runtime files # RTToolbox_INSTALL_NO_DOCUMENTATION - do not install documentation files # Remark: needs directory are stored with no leading slash (CMake 2.4 and newer) #----------------------------------------------------------------------------- IF(NOT RTTOOLBOX_INSTALL_BIN_DIR) SET(RTTOOLBOX_INSTALL_BIN_DIR "bin") ENDIF(NOT RTTOOLBOX_INSTALL_BIN_DIR) IF(NOT RTTOOLBOX_INSTALL_LIB_DIR) SET(RTTOOLBOX_INSTALL_LIB_DIR "lib") ENDIF(NOT RTTOOLBOX_INSTALL_LIB_DIR) IF(NOT RTTOOLBOX_INSTALL_PACKAGE_DIR) SET(RTTOOLBOX_INSTALL_PACKAGE_DIR "lib") ENDIF(NOT RTTOOLBOX_INSTALL_PACKAGE_DIR) IF(NOT RTTOOLBOX_INSTALL_INCLUDE_DIR) SET(RTTOOLBOX_INSTALL_INCLUDE_DIR "include") ENDIF(NOT RTTOOLBOX_INSTALL_INCLUDE_DIR) IF(NOT RTTOOLBOX_INSTALL_NO_DEVELOPMENT) SET(RTTOOLBOX_INSTALL_NO_DEVELOPMENT 0) ENDIF(NOT RTTOOLBOX_INSTALL_NO_DEVELOPMENT) IF(NOT RTTOOLBOX_INSTALL_NO_RUNTIME) SET(RTTOOLBOX_INSTALL_NO_RUNTIME 0) ENDIF(NOT RTTOOLBOX_INSTALL_NO_RUNTIME) IF(NOT RTTOOLBOX_INSTALL_NO_DOCUMENTATION) SET(RTTOOLBOX_INSTALL_NO_DOCUMENTATION 0) ENDIF(NOT RTTOOLBOX_INSTALL_NO_DOCUMENTATION) SET(RTTOOLBOX_INSTALL_NO_LIBRARIES) IF(RTTOOLBOX_BUILD_SHARED_LIBS) IF(RTTOOLBOX_INSTALL_NO_RUNTIME AND RTTOOLBOX_INSTALL_NO_DEVELOPMENT) SET(RTTOOLBOX_INSTALL_NO_LIBRARIES 1) ENDIF(RTTOOLBOX_INSTALL_NO_RUNTIME AND RTTOOLBOX_INSTALL_NO_DEVELOPMENT) ELSE(RTTOOLBOX_BUILD_SHARED_LIBS) IF(RTTOOLBOX_INSTALL_NO_DEVELOPMENT) SET(RTTOOLBOX_INSTALL_NO_LIBRARIES 1) ENDIF(RTTOOLBOX_INSTALL_NO_DEVELOPMENT) ENDIF(RTTOOLBOX_BUILD_SHARED_LIBS) # set RTToolbox_DIR so it can be used by subprojects SET(RTToolbox_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "RTToolbox dir to be used by subprojects") #----------------------------------------------------------------------------- # DCMTK MT-Flag treat #----------------------------------------------------------------------------- option(RTTB_DCMTK_COMPLIANCE_ENFORCE_MT "This enforces the whole RTToolbox to be compiled with /MT,/MTd to be compliant with DCMTK" OFF) string(FIND ${CMAKE_GENERATOR} "Visual Studio" RTTB_VS_USED) if(RTTB_DCMTK_COMPLIANCE_ENFORCE_MT AND RTTB_VS_USED EQUAL 0) message(STATUS "Enforce DCMTK compliance: /MT and /MTd flags are used") string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) message(STATUS "CMAKE_C_FLAGS_DEBUG set to: ${CMAKE_C_FLAGS_DEBUG}") string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) message(STATUS "CMAKE_C_FLAGS_RELEASE set to: ${CMAKE_C_FLAGS_RELEASE}") string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL}) message(STATUS "CMAKE_C_FLAGS_MINSIZEREL set to: ${CMAKE_C_FLAGS_MINSIZEREL}") string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO}) message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO set to: ${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) message(STATUS "CMAKE_CXX_FLAGS_DEBUG set to: ${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) message(STATUS "CMAKE_CXX_FLAGS_RELEASE set to: ${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL}) message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL set to: ${CMAKE_CXX_FLAGS_MINSIZEREL}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO set to: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") endif() #----------------------------------------------------------------------------- # Advanced RTToolbox configuration #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # RTToolbox build configuration options. IF (NOT RTTB_CXX_STANDARD) set(RTTB_CXX_STANDARD 11) ENDIF (NOT RTTB_CXX_STANDARD) set(CMAKE_CXX_STANDARD ${RTTB_CXX_STANDARD} CACHE STRING "") set(CMAKE_CXX_STANDARD_REQUIRED 1) OPTION(CMAKE_CXX_EXTENSIONS "" ON) MARK_AS_ADVANCED(CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_CXX_EXTENSIONS) #Raise warning level (MSVC has W3 default warning level) IF (WIN32) set(CMAKE_CXX_FLAGS "/W4 /EHsc") ELSE() IF (CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "-W4") ENDIF() ENDIF() IF (WIN32) OPTION(BUILD_SHARED_LIBS "Build RTToolbox with shared libraries." OFF) ELSE (WIN32) OPTION(BUILD_SHARED_LIBS "Build RTToolbox with shared libraries." ON) ENDIF (WIN32) -OPTION (RTTB_VIRTUOS_SUPPORT "Build RTToolbox with Virtuos support." OFF) - -IF (RTTB_VIRTUOS_SUPPORT) - SET(RTToolbox_VIRTUOS_SUPPORT "1") -ELSE() - SET(RTToolbox_VIRTUOS_SUPPORT "0") -ENDIF() - IF(NOT BUILD_SHARED_LIBS) IF(UNIX) MESSAGE(FATAL_ERROR "RTToolbox currently does not support a static build on unix like systems. We are working on that...") ENDIF(UNIX) ENDIF(NOT BUILD_SHARED_LIBS) SET(RTTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) IF(NOT RTToolbox_NO_LIBRARY_VERSION) # This setting of SOVERSION assumes that any API change # will increment either the minor or major version number of RTToolbox. SET(RTToolbox_LIBRARY_PROPERTIES VERSION "${RTToolbox_VERSION_MAJOR}.${RTToolbox_VERSION_MINOR}.${RTToolbox_VERSION_PATCH}" SOVERSION "${RTToolbox_VERSION_MAJOR}.${RTToolbox_VERSION_MINOR}" ) ENDIF(NOT RTToolbox_NO_LIBRARY_VERSION) #----------------------------------------------------------------------------- # Configure files with settings for use by the build. # #----------------------------------------------------------------------------- CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/RTToolboxConfigure.h.in ${RTToolbox_BINARY_DIR}/RTToolboxConfigure.h) IF(NOT RTTOOLBOX_INSTALL_NO_DEVELOPMENT) INSTALL(FILES ${RTToolbox_BINARY_DIR}/RTToolboxConfigure.h DESTINATION ${RTTOOLBOX_INSTALL_INCLUDE_DIR} COMPONENT Development) ENDIF(NOT RTTOOLBOX_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- # The entire RTToolbox tree should use the same include path #----------------------------------------------------------------------------- #Default include dir. Others dirs will be defined by activated subprojects INCLUDE_DIRECTORIES(${RTToolbox_BINARY_DIR}) LINK_DIRECTORIES(${LIBARY_OUTPUT_PATH}) #Prepare the correct target information export by the subprojects SET(RTToolbox_TARGETS_FILE "${RTToolbox_BINARY_DIR}/RTToolboxTargets.cmake") FILE(WRITE ${RTToolbox_TARGETS_FILE} "# Generated by CMake, do not edit!") #----------------------------------------------------------------------------- # Dispatch the build into the proper subdirectories. #----------------------------------------------------------------------------- OPTION(BUILD_All_Modules "All modules will be built" OFF) OPTION(BUILD_Apps "Determine if the CLI applications will be generated." OFF) MESSAGE (STATUS "generating Project RTToolbox") ADD_SUBDIRECTORY (code) IF (BUILD_Apps) ADD_SUBDIRECTORY (apps) ENDIF() IF (BUILD_TESTING) ADD_SUBDIRECTORY (testing) ENDIF (BUILD_TESTING) ADD_SUBDIRECTORY (documentation) #----------------------------------------------------------------------------- # Help other projects use RTToolbox. #----------------------------------------------------------------------------- EXPORT(PACKAGE RTToolbox) # Copy the UseRTToolbox.cmake file to the binary tree for backward compatability. CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/UseRTToolbox.cmake.in ${RTToolbox_BINARY_DIR}/UseRTToolbox.cmake COPYONLY IMMEDIATE) # Save library dependencies. EXPORT_LIBRARY_DEPENDENCIES(${RTToolbox_BINARY_DIR}/RTToolboxLibraryDepends.cmake) # Create the RTToolboxConfig.cmake file containing the RTToolbox configuration. INCLUDE (${RTToolbox_SOURCE_DIR}/rttbGenerateRTToolboxConfig.cmake) IF(NOT RTToolbox_INSTALL_NO_DEVELOPMENT) INSTALL(FILES ${RTToolbox_BINARY_DIR}/RTToolboxConfig.cmake ${RTToolbox_BINARY_DIR}/RTToolboxTargets.cmake ${RTToolbox_BINARY_DIR}/RTToolboxLibraryDepends.cmake ${RTToolbox_BINARY_DIR}/UseRTToolbox.cmake DESTINATION ${RTTOOLBOX_INSTALL_PACKAGE_DIR} COMPONENT Development ) ENDIF(NOT RTToolbox_INSTALL_NO_DEVELOPMENT) diff --git a/RTToolboxConfigure.h.in b/RTToolboxConfigure.h.in index d8cf1c0..34f0556 100644 --- a/RTToolboxConfigure.h.in +++ b/RTToolboxConfigure.h.in @@ -1,104 +1,102 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ SIDT RT Interface // // 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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // // Subversion HeadURL: $HeadURL: http://sidt-hpc1/dkfz_repository/NotMeVisLab/SIDT/RTToolbox/branch/restructure/RTToolboxConfigure.h.in $ */ //---------------------------------------------------------- // !!!EXPERIMENTAL CODE!!! // // This code may not be used for release. // Add #define SIDT_ENFORCE_MATURE_CODE to any release module // to ensure this policy. //---------------------------------------------------------- #ifdef SIDT_ENFORCE_MATURE_CODE #error “This code is marked as experimental code. It must not be used because this build enforces mature code.” #endif #ifndef SIDT_CONTAINS_EXPERIMENTAL_CODE #define SIDT_CONTAINS_EXPERIMENTAL_CODE 1 #endif /*! @def RTTB_BUILD_SHARED_LIBS * This define indicates if RTTB will be build as static library (define RTTB_STATIC) or as DLL (define RTTB_DLL). * By default RTTB_BUILD_SHARED_LIBS is not defined. */ #cmakedefine RTTB_BUILD_SHARED_LIBS #ifdef RTTB_BUILD_SHARED_LIBS #define RTTB_DLL #else #define RTTB_STATIC #endif #ifndef __RTTB_CONFIGURE_H #define __RTTB_CONFIGURE_H /*! @def RTTB_BUILD_SHARED_LIBS * This define indicates if RTTB will be build as static library (define RTTB_STATIC) or as DLL (define RTTB_DLL). * By default RTTB_BUILD_SHARED_LIBS is not defined. */ #cmakedefine RTTB_BUILD_SHARED_LIBS #ifdef RTTB_BUILD_SHARED_LIBS #define RTTB_DLL #else #define RTTB_STATIC #endif /*! @def RTTB_ENFORCE_MATURE_CODE * This define controls if RTToolbox should force the whole build to be mature code. * Mature code convention is part of the SIDT coding styles. * Projects that use RTToolbox are able to ensure with SIDT_ENFORCE_MATURE_CODE * that used code is guaranteed to be tested and reviewed regarding the strict * SIDT coding styles.\n * RTTB_ENFORCE_MATURE_CODE can be used to ensure that strictness when prebuilding * static or dynamic libraries. * @remark This definition should by configured via the advance options in CMake. */ #cmakedefine RTTB_ENFORCE_MATURE_CODE #ifdef RTTB_ENFORCE_MATURE_CODE #define SIDT_ENFORCE_MATURE_CODE #endif /*! @def RTTB_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER * This define controls if RTToolbox should disable the auto * register functionality of the itk io factory, when RTToolbox * io reader and writer classes are used. * This is needed in cases where RTToolbox is build "dynamic" and * used in an application that also uses the ITK shared objects * under Windows systems (e.g. MITK). Loading and unloading RTToolbox * shared objects in such an application would lead to an corrupted * itk factory stack, because its implementation is not fail safe * in this scenario. * @remark This definition should by configured via the advance options in CMake. */ #cmakedefine RTTB_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER #define RTTB_VERSION_MAJOR @RTToolbox_VERSION_MAJOR@ #define RTTB_VERSION_MINOR @RTToolbox_VERSION_MINOR@ #define RTTB_VERSION_PATCH @RTToolbox_VERSION_PATCH@ #define RTTB_VERSION_STRING "@RTToolbox_VERSION_STRING@" #define RTTB_FULL_VERSION_STRING "@RTToolbox_FULL_VERSION_STRING@" -#define RTTB_VIRTUOS_SUPPORT @RTToolbox_VIRTUOS_SUPPORT@ - #endif diff --git a/apps/BioModelCalc4V/BioModelCalc4V.cpp b/apps/BioModelCalc4V/BioModelCalc4V.cpp deleted file mode 100644 index cd583ac..0000000 --- a/apps/BioModelCalc4V/BioModelCalc4V.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// ----------------------------------------------------------------------- -// 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 "../BioModelCalc/BioModelCalcApplicationData.h" -#include "../BioModelCalc/BioModelCalcHelper.h" -#include "../BioModelCalc/BioModelCmdLineParser.h" -#include "../DoseTool4V/DoseTool4VHelper.h" - -#include "boost/shared_ptr.hpp" -#include "boost/make_shared.hpp" - -#include "RTToolboxConfigure.h" - -#include "rttbException.h" - -int main(int argc, const char** argv) -{ - int result = 0; - - rttb::apps::bioModelCalc::ApplicationData appData; - boost::shared_ptr argParser; - - const std::string appCategory = "RT-Toolbox App"; - const std::string appName = "BioModelCalc4V"; - const std::string appDesc = "An App to calculate the Linear quadratic (LQ) BioModel with virtuos support. 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(argc, argv, appName, - appVersion, appDesc, appContributor, appCategory, true); - } - 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)) - { - 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; - - std::cout << std::endl; - - try - { - appData._dose = rttb::apps::doseTool4V::loadDose(appData._doseFileName, appData._doseLoadStyle); - for (const auto& filename : appData._modelParameterMapsFilename){ - appData._modelParameterMaps.push_front(rttb::apps::bioModelCalc::loadDose(filename, appData._parameterMapsLoadStyle)); - } - } - 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/BioModelCalc4V/CMakeLists.txt b/apps/BioModelCalc4V/CMakeLists.txt deleted file mode 100644 index fea7354..0000000 --- a/apps/BioModelCalc4V/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -MESSAGE (STATUS "generating app: BioModelCalc4V - calculating the radiobiological effect based on dose with Virtuos support") -SET(RTTB_Boost_ADDITIONAL_COMPONENT program_options) -RTTB_CREATE_APPLICATION(BioModelCalc4V DEPENDS RTTBCore RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO RTTBModels PACKAGE_DEPENDS ArgumentParsingLib BoostBinaries) - diff --git a/apps/BioModelCalc4V/files.cmake b/apps/BioModelCalc4V/files.cmake deleted file mode 100644 index 6e39b80..0000000 --- a/apps/BioModelCalc4V/files.cmake +++ /dev/null @@ -1,13 +0,0 @@ -SET(CPP_FILES -BioModelCalc4V.cpp -../DoseTool4V/DoseTool4VHelper.cpp -../BioModelCalc/BioModelCalcHelper.cpp -../BioModelCalc/BioModelCalcApplicationData.cpp -../BioModelCalc/BioModelCmdLineParser.cpp -) - -SET(H_FILES -../DoseTool4V/DoseTool4VHelper.h -../BioModelCalc/BioModelCalcApplicationData.h -../BioModelCalc/BioModelCmdLineParser.h -) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 01d1e21..6cca16f 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -1,64 +1,55 @@ MESSAGE(STATUS "processing RTToolbox apps") #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") IF(BUILD_SHARED_LIBS OR RTTB_USE_MITK_BOOST) SET(ARG_BUILD_SHARED_LIBS ON) ELSE(BUILD_SHARED_LIBS OR RTTB_USE_MITK_BOOST) SET(ARG_BUILD_SHARED_LIBS OFF) ENDIF(BUILD_SHARED_LIBS OR RTTB_USE_MITK_BOOST) 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} -DBUILD_SHARED_LIBS:BOOL=${ARG_BUILD_SHARED_LIBS} ) OPTION(BUILD_App_DoseAcc "Determine if the demo application DoseAcc will be generated." ON) IF(BUILD_App_DoseAcc) ADD_SUBDIRECTORY(DoseAcc) - IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(DoseAcc4V) - ENDIF() ENDIF() OPTION(BUILD_App_DoseMap "Determine if the application DoseMap will be generated." ON) IF(BUILD_App_DoseMap) ADD_SUBDIRECTORY(DoseMap) ENDIF() OPTION(BUILD_App_DoseTool "Determine if the application DoseTool will be generated." ON) IF(BUILD_App_DoseTool) ADD_SUBDIRECTORY(DoseTool) - IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(DoseTool4V) - ENDIF() ENDIF() OPTION(BUILD_App_VoxelizerTool "Determine if the application VoxelizerTool will be generated." ON) IF(BUILD_App_VoxelizerTool) ADD_SUBDIRECTORY(VoxelizerTool) ENDIF() OPTION(BUILD_App_BioModelCalc "Determine if the demo application BioModelCalc will be generated." ON) IF(BUILD_App_BioModelCalc) ADD_SUBDIRECTORY(BioModelCalc) - IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(BioModelCalc4V) - ENDIF() ENDIF() \ No newline at end of file diff --git a/apps/DoseAcc4V/CMakeLists.txt b/apps/DoseAcc4V/CMakeLists.txt deleted file mode 100644 index ae998b6..0000000 --- a/apps/DoseAcc4V/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -MESSAGE (STATUS "generating app: DoseAcc4V - simple dose accumulation tool with Virtuos") -SET(RTTB_Boost_ADDITIONAL_COMPONENT program_options) -RTTB_CREATE_APPLICATION(DoseAcc4V DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS ArgumentParsingLib MatchPoint ITK) - diff --git a/apps/DoseAcc4V/DoseAcc4V.cpp b/apps/DoseAcc4V/DoseAcc4V.cpp deleted file mode 100644 index 3277822..0000000 --- a/apps/DoseAcc4V/DoseAcc4V.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// ----------------------------------------------------------------------- -// 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 "../DoseAcc/DoseAccApplicationData.h" -#include "../DoseAcc/DoseAccHelper.h" -#include "../DoseAcc/DoseAccCmdLineParser.h" -#include "../DoseTool4V/DoseTool4VHelper.h" - -#include "boost/shared_ptr.hpp" -#include "boost/make_shared.hpp" - -#include "RTToolboxConfigure.h" - -#include "rttbException.h" - -int main(int argc, const char** argv) -{ - int result = 0; - - rttb::apps::doseAcc::ApplicationData appData; - boost::shared_ptr argParser; - - const std::string appCategory = "RT-Toolbox App"; - const std::string appName = "DoseAcc4V"; - const std::string appDesc = "An App to accumulate two doses with virtuos support. 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(argc, argv, appName, - appVersion, appDesc, appContributor, appCategory, true); - } - 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)) - { - return 0; - } - - rttb::apps::doseAcc::populateAppData(argParser, appData); - - std::cout << std::endl << "*******************************************" << std::endl; - std::cout << "Dose 1 file: " << appData._dose1FileName << std::endl; - std::cout << "Dose 2 file: " << appData._dose2FileName << std::endl; - std::cout << "Dose output file: " << appData._outputFileName << std::endl; - - if (!(appData._regFileName.empty())) - { - std::cout << "Registration file: " << appData._regFileName << std::endl; - } - - std::cout << "Dose 1 weight: " << appData._weightDose1 << std::endl; - std::cout << "Dose 2 weight: " << appData._weightDose2 << std::endl; - std::cout << "Operator: " << appData._operator << std::endl; - - try - { - appData._dose1 = rttb::apps::doseTool4V::loadDose(appData._dose1FileName, appData._dose1LoadStyle); - } - 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; - } - - try - { - appData._dose2 = rttb::apps::doseTool4V::loadDose(appData._dose2FileName, appData._dose2LoadStyle); - } - 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._regFileName.empty())) - { - try - { - appData._spReg = rttb::apps::doseAcc::loadRegistration(appData._regFileName); - } - 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 registration file." << std::endl; - return 5; - } - } - - try - { - rttb::apps::doseAcc::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/DoseAcc4V/files.cmake b/apps/DoseAcc4V/files.cmake deleted file mode 100644 index 8e3eac2..0000000 --- a/apps/DoseAcc4V/files.cmake +++ /dev/null @@ -1,13 +0,0 @@ -SET(CPP_FILES -DoseAcc4V.cpp -../DoseTool4V/DoseTool4VHelper.cpp -../DoseAcc/DoseAccHelper.cpp -../DoseAcc/DoseAccApplicationData.cpp -../DoseAcc/DoseAccCmdLineParser.cpp -) - -SET(H_FILES -../DoseTool4V/DoseTool4VHelper.h -../DoseAcc/DoseAccApplicationData.h -../DoseAcc/DoseAccCmdLineParser.h -) diff --git a/apps/DoseTool4V/CMakeLists.txt b/apps/DoseTool4V/CMakeLists.txt deleted file mode 100644 index 84943b3..0000000 --- a/apps/DoseTool4V/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -MESSAGE (STATUS "generating app: DoseTool4V - calculating dose statistics and DVH with Virtuos support") -SET(RTTB_Boost_ADDITIONAL_COMPONENT program_options) -RTTB_CREATE_APPLICATION(DoseTool4V DEPENDS RTTBCore RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO RTTBMasks RTTBMasks RTTBBoostMask RTTBOtherIO RTTBAlgorithms PACKAGE_DEPENDS ArgumentParsingLib BoostBinaries) -IF (NOT WIN32) -# target_compile_features(DoseTool4V PRIVATE cxx_auto_type cxx_nullptr cxx_override)# -# set(CMAKE_CXX_FLAGS "-fpermissive") -ENDIF() diff --git a/apps/DoseTool4V/DoseTool4V.cpp b/apps/DoseTool4V/DoseTool4V.cpp deleted file mode 100644 index 6ed78c1..0000000 --- a/apps/DoseTool4V/DoseTool4V.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// ----------------------------------------------------------------------- -// 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: 1315 $ (last changed revision) -// @date $Date: 2016-04-12 14:18:24 +0200 (Di, 12 Apr 2016) $ (last change date) -// @author $Author: floca $ (last changed by) -*/ - -#include "../DoseTool/DoseToolApplicationData.h" -#include "../DoseTool/DoseToolHelper.h" -#include "../DoseTool/DoseToolCmdLineParser.h" -#include "DoseTool4VHelper.h" - -#include "boost/shared_ptr.hpp" -#include "boost/make_shared.hpp" - -#include "RTToolboxConfigure.h" - -#include "rttbException.h" - -int main(int argc, const char** argv) -{ - int result = 0; - - rttb::apps::doseTool::ApplicationData appData; - boost::shared_ptr argParser; - - const std::string appCategory = "RT-Toolbox App"; - const std::string appName = "DoseTool4V"; - const std::string appDesc = "An App to calculate the dose statistics and compute the DVH with virtuos support. 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(argc, argv, appName, - appVersion, appDesc, appContributor, appCategory, true); - } - 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; - } - - rttb::apps::doseTool::populateAppData(argParser, appData); - - std::cout << std::endl << "*******************************************" << std::endl; - std::cout << "Dose file: " << appData._doseFileName << std::endl; - std::cout << "Struct file: " << appData._structFileName << std::endl; - std::cout << "Struct name: " << appData._structNameRegex << std::endl; - - if (appData._computeDoseStatistics) - { - std::cout << "Dose statistic output file: " << appData._doseStatisticOutputFileName << std::endl; - std::cout << "Compute complex statistics: " << appData._computeComplexDoseStatistics << std::endl; - - if (appData._computeComplexDoseStatistics) - { - std::cout << "Prescribed dose: " << appData._prescribedDose << std::endl; - } - - std::cout << "Allow self intersections: " << appData._allowSelfIntersection << std::endl; - } - - if (appData._computeDVH) - { - std::cout << "DVH output file: " << appData._dvhOutputFilename << std::endl; - } - - try - { - appData._dose = rttb::apps::doseTool4V::loadDose(appData._doseFileName, appData._doseLoadStyle); - } - 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 dose image." << std::endl; - return 1; - } - - //loading of structure file not necessary in ITK case as it can be used directly as mask input. - if (appData._structLoadStyle.front() != "itk") - { - try - { - appData._struct = rttb::apps::doseTool4V::loadStruct(appData._structFileName, - appData._structLoadStyle, appData._structNameRegex); - } - catch (rttb::core::Exception& e) - { - std::cerr << "RTTB Error!!!" << std::endl; - std::cerr << e.what() << std::endl; - return 2; - } - catch (const std::exception& e) - { - std::cerr << "Error!!!" << std::endl; - std::cerr << e.what() << std::endl; - return 2; - } - catch (...) - { - std::cerr << "Error!!! unknown error while reading struct image." << std::endl; - return 2; - } - } - - try - { - rttb::apps::doseTool::processData(appData); - } - catch (rttb::core::Exception& e) - { - std::cerr << "RTTB Error!!!" << std::endl; - std::cerr << e.what() << std::endl; - return 3; - } - catch (std::exception& e) - { - std::cerr << "Error!!!" << std::endl; - std::cerr << e.what() << std::endl; - return 3; - } - catch (...) - { - std::cerr << "Error!!! unknown error while processing the data or writing the image." << std::endl; - return 3; - } - - return result; -} diff --git a/apps/DoseTool4V/DoseTool4VHelper.cpp b/apps/DoseTool4V/DoseTool4VHelper.cpp deleted file mode 100644 index 8834d62..0000000 --- a/apps/DoseTool4V/DoseTool4VHelper.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// ----------------------------------------------------------------------- -// 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 "DoseTool4VHelper.h" - -#include "rttbExceptionMacros.h" - -#include "rttbDicomFileDoseAccessorGenerator.h" -#include "rttbDicomHelaxFileDoseAccessorGenerator.h" -#include "rttbITKImageFileAccessorGenerator.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbDicomFileStructureSetGenerator.h" -#include "rttbVirtuosFileStructureSetGenerator.h" - -rttb::core::DoseAccessorInterface::DoseAccessorPointer -rttb::apps::doseTool4V::loadDose(const std::string& fileName, -const LoadingStyleArgType& args) -{ - rttb::core::DoseAccessorInterface::DoseAccessorPointer result; - - std::cout << std::endl << "read dose file... "; - - if (args.empty() || args[0] == "dicom") - { - std::cout << "use RTTB dicom IO... "; - result = loadDicomDose(fileName); - } - else if (args[0] == "helax") - { - std::cout << "use RTTB Helax IO... "; - result = loadHelaxDose(fileName); - } - else if (args[0] == "itk") - { - std::cout << "use RTTB itk IO... "; - result = loadITKDose(fileName); - } - else if (args[0] == "virtuos") - { - if (args.size() < 2) - { - rttbDefaultExceptionStaticMacro( << - "Cannot load virtuos dose. Plan file is missing. Specify plan file as 2nd io stlye argument."); - } - - std::cout << "use RTTB virtuos IO... " << std::endl; - std::cout << " virtuos plan file: " << args[1] << " ... "; - result = loadVirtuosDose(fileName, args[1]); - } - else - { - rttbDefaultExceptionStaticMacro( << "Unknown io style selected. Cannot load data. Selected style: " - << args[0]); - } - - std::cout << "done." << std::endl; - - return result; -} - -rttb::core::DoseAccessorInterface::DoseAccessorPointer -rttb::apps::doseTool4V::loadDicomDose(const std::string& fileName) -{ - rttb::io::dicom::DicomFileDoseAccessorGenerator generator(fileName); - return generator.generateDoseAccessor(); -} - -rttb::core::DoseAccessorInterface::DoseAccessorPointer -rttb::apps::doseTool4V::loadHelaxDose(const std::string& path) -{ - rttb::io::helax::DicomHelaxFileDoseAccessorGenerator generator(path); - return generator.generateDoseAccessor(); -} - -rttb::core::DoseAccessorInterface::DoseAccessorPointer -rttb::apps::doseTool4V::loadITKDose(const std::string& fileName) -{ - rttb::io::itk::ITKImageFileAccessorGenerator generator(fileName); - return generator.generateDoseAccessor(); -} - -rttb::core::DoseAccessorInterface::DoseAccessorPointer -rttb::apps::doseTool4V::loadVirtuosDose(const std::string& fileName, const std::string& planFileName) -{ - rttb::io::virtuos::VirtuosPlanFileDoseAccessorGenerator generator(fileName, planFileName); - return generator.generateDoseAccessor(); -} - -rttb::apps::doseTool4V::StructureSetPointer rttb::apps::doseTool4V::loadStruct( - const std::string& fileName, const LoadingStyleArgType& args, - const std::string& structNameRegex) -{ - rttb::core::StructureSetGeneratorInterface::StructureSetPointer result; - - std::cout << std::endl << "read struct file... "; - - if (args.empty() || args[0] == "dicom") - { - std::cout << "use RTTB dicom IO... "; - result = loadDicomStruct(fileName, structNameRegex); - } - else if (args[0] == "virtuos") - { - std::cout << "use RTTB virtuos IO... " << std::endl; - std::cout << " virtuos CTX file: " << args[1] << " ... "; - result = loadVirtuosStruct(fileName, args[1]); - } - else - { - rttbDefaultExceptionStaticMacro( << "Unknown io style selected. Cannot load data. Selected style: " - << args[0]); - } - - std::cout << "done." << std::endl; - - return result; -} - -rttb::apps::doseTool4V::StructureSetPointer -rttb::apps::doseTool4V::loadDicomStruct( -const std::string& fileName, const std::string& structNameRegex) -{ - rttb::io::dicom::DicomFileStructureSetGenerator generator(fileName); - - if (!structNameRegex.empty()) - { - generator.setStructureLableFilterActive(true); - generator.setFilterRegEx(structNameRegex); - } - - return generator.generateStructureSet(); -} - -rttb::apps::doseTool4V::StructureSetPointer -rttb::apps::doseTool4V::loadVirtuosStruct( - const std::string& fileName, const std::string& ctxFileName) -{ - rttb::io::virtuos::VirtuosFileStructureSetGenerator generator(fileName, ctxFileName.c_str()); - return generator.generateStructureSet(); -} - - diff --git a/apps/DoseTool4V/DoseTool4VHelper.h b/apps/DoseTool4V/DoseTool4VHelper.h deleted file mode 100644 index 3b4ebd5..0000000 --- a/apps/DoseTool4V/DoseTool4VHelper.h +++ /dev/null @@ -1,98 +0,0 @@ -// ----------------------------------------------------------------------- -// 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: 1315 $ (last changed revision) -// @date $Date: 2016-04-12 14:18:24 +0200 (Di, 12 Apr 2016) $ (last change date) -// @author $Author: floca $ (last changed by) -*/ - -#ifndef __DOSETOOL4V_HELPER_H -#define __DOSETOOL4V_HELPER_H - -#include "rttbDoseAccessorInterface.h" -#include "rttbStructureSet.h" - -namespace rttb -{ - namespace apps - { - namespace doseTool4V - { - typedef std::vector LoadingStyleArgType; - typedef boost::shared_ptr StructureSetPointer; - /*! @brief loads a dose from a file based on the loadingStyle. - @exception Throws an rttb::Exception if loading fails - */ - core::DoseAccessorInterface::DoseAccessorPointer loadDose(const std::string& fileName, - const LoadingStyleArgType& args); - - /*! @brief loads a dicom dose from a file. - @exception Throws an rttb::Exception if loading fails - @sa DicomFileDoseAccessorGenerator - */ - core::DoseAccessorInterface::DoseAccessorPointer loadDicomDose(const std::string& fileName); - /*! @brief loads a helax dose from a file. - @exception Throws an rttb::Exception if loading fails - @sa DicomHelaxFileDoseAccessorGenerator - */ - core::DoseAccessorInterface::DoseAccessorPointer loadHelaxDose(const std::string& path); - /*! @brief loads an itk dose from a file. - @exception Throws an rttb::Exception if loading fails. - @details Might be of all formats that ITK know (*.mhd, *.nrrd, ...). The absolute image values are taken as dose. - @sa ITKImageFileAccessorGenerator - */ - core::DoseAccessorInterface::DoseAccessorPointer loadITKDose(const std::string& fileName); - - /*! @brief loads a virtuos dose from a file. - @exception Throws an rttb::Exception if loading fails - @sa VirtuosPlanFileDoseAccessorGenerator - */ - core::DoseAccessorInterface::DoseAccessorPointer loadVirtuosDose(const std::string& fileName, - const std::string& planFileName); - - /*! @brief loads a struct from a file based on the loadingStyle. - You may pass a structure name regex. If is not empty, it will be used to filter structure in the - loading process. Only structures with a name matching the reg ex will be loaded. This speeds up the - loading process significantly if you need only one structure out of a structure set. - @exception Throws an rttb::Exception if loading fails - @details voxelized itk images are read in generateMask() directly - */ - StructureSetPointer loadStruct(const std::string& fileName, - const LoadingStyleArgType& args, const std::string& structNameRegex = ""); - - /*! @brief loads a dicom struct from a file. - You may pass a structure name regex. If is not empty, it will be used to filter structure in the - loading process. Only structures with a name matching the reg ex will be loaded. This speeds up the - loading process significantly if you need only one structure out of a structure set. - @exception Throws an rttb::Exception if loading fails - @sa DicomFileStructureSetGenerator - */ - StructureSetPointer loadDicomStruct( - const std::string& fileName, const std::string& structNameRegex = ""); - - /*! @brief loads a virtuos struct from a file. - @exception Throws an rttb::Exception if loading fails - @sa VirtuosPlanFileDoseAccessorGenerator - */ - StructureSetPointer loadVirtuosStruct( - const std::string& fileName, - const std::string& ctxFileName); - } - } -} - - -#endif diff --git a/apps/DoseTool4V/files.cmake b/apps/DoseTool4V/files.cmake deleted file mode 100644 index 1783e7d..0000000 --- a/apps/DoseTool4V/files.cmake +++ /dev/null @@ -1,13 +0,0 @@ -SET(CPP_FILES -DoseTool4V.cpp -DoseTool4VHelper.cpp -../DoseTool/DoseToolHelper.cpp -../DoseTool/DoseToolApplicationData.cpp -../DoseTool/DoseToolCmdLineParser.cpp -) - -SET(H_FILES -DoseTool4VHelper.h -../DoseTool/DoseToolApplicationData.h -../DoseTool/DoseToolCmdLineParser.h -) diff --git a/cmake/PackageDepends/RTTB_VirtuosIO_Config.cmake b/cmake/PackageDepends/RTTB_VirtuosIO_Config.cmake deleted file mode 100644 index 29c88c5..0000000 --- a/cmake/PackageDepends/RTTB_VirtuosIO_Config.cmake +++ /dev/null @@ -1,17 +0,0 @@ -#----------------------------------------------------------------------------- -# Find Virtuos IO -#----------------------------------------------------------------------------- -FIND_PACKAGE(VirtuosIOCore) -IF(VirtuosIOCore_FOUND) - INCLUDE(${VirtuosIOCore_USE_FILE}) -ELSE(VirtuosIOCore_FOUND) - MESSAGE(FATAL_ERROR - "Cannot build without VirtuosIOCore. Please set VirtuosIOCore_DIR.") -ENDIF(VirtuosIOCore_FOUND) - -LIST(APPEND ALL_INCLUDE_DIRECTORIES ${VirtuosIOCore_INCLUDE_DIRS}) -LIST(APPEND ALL_LIBRARIES VirtuosIO) - -LINK_DIRECTORIES(${VirtuosIOCore_LIBRARY_DIRS}) - -# include path to gzip/gunzip diff --git a/code/io/CMakeLists.txt b/code/io/CMakeLists.txt index 8bf9cee..2365e7f 100644 --- a/code/io/CMakeLists.txt +++ b/code/io/CMakeLists.txt @@ -1,31 +1,23 @@ MESSAGE (STATUS "processing RTToolbox io") ADD_SUBDIRECTORY (other) OPTION(BUILD_IO_Dicom "Determine if the IO class wrappers for DICOM format will be generated." ON) IF(BUILD_All_Modules OR BUILD_IO_Dicom) ADD_SUBDIRECTORY(dicom) OPTION(BUILD_IO_HELAX "Determine if the IO class wrappers for HELAX format will be generated." OFF) IF(BUILD_All_Modules OR BUILD_IO_HELAX) ADD_SUBDIRECTORY(helax) SET(BUILD_IO_HELAX ON CACHE BOOL ON FORCE) ENDIF() ENDIF() OPTION(BUILD_IO_ITK "Determine if the IO class wrappers for ITK image formats will be generated." OFF) IF(BUILD_All_Modules OR BUILD_IO_ITK) ADD_SUBDIRECTORY(itk) SET(BUILD_IO_ITK ON CACHE BOOL ON FORCE) ENDIF() - IF(BUILD_All_Modules OR BUILD_Models) ADD_SUBDIRECTORY(models) ENDIF() -IF (RTTB_VIRTUOS_SUPPORT) - OPTION(BUILD_IO_Virtuos "Determine if the IO class wrappers for Virtuos format will be generated." OFF) - IF(BUILD_All_Modules OR BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(virtuos) - ENDIF() -ENDIF() - diff --git a/code/io/virtuos/CMakeLists.txt b/code/io/virtuos/CMakeLists.txt deleted file mode 100644 index 8c6c045..0000000 --- a/code/io/virtuos/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -RTTB_CREATE_MODULE(RTTBVirtuosIO DEPENDS RTTBCore PACKAGE_DEPENDS BoostBinaries VirtuosIO) - diff --git a/code/io/virtuos/files.cmake b/code/io/virtuos/files.cmake deleted file mode 100644 index 4d8ebf3..0000000 --- a/code/io/virtuos/files.cmake +++ /dev/null @@ -1,15 +0,0 @@ -SET(CPP_FILES - rttbVirtuosCubeinfoDoseAccessorGenerator.cpp - rttbVirtuosDoseAccessor.cpp - rttbVirtuosDoseFileDoseAccessorGenerator.cpp - rttbVirtuosFileStructureSetGenerator.cpp - rttbVirtuosPlanFileDoseAccessorGenerator.cpp - ) - -SET(H_FILES - rttbVirtuosCubeinfoDoseAccessorGenerator.h - rttbVirtuosDoseAccessor.h - rttbVirtuosDoseFileDoseAccessorGenerator.h - rttbVirtuosFileStructureSetGenerator.h - rttbVirtuosPlanFileDoseAccessorGenerator.h - ) diff --git a/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.cpp b/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.cpp deleted file mode 100644 index 031c1d1..0000000 --- a/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#include -#include - -#include "rttbVirtuosCubeinfoDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - - -//VIRTUOS -#include "pln1file.h" -#include "plt_type.h" -#include "rtp_type.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - - VirtuosCubeinfoDoseAccessorGenerator::~VirtuosCubeinfoDoseAccessorGenerator() {} - - - VirtuosCubeinfoDoseAccessorGenerator::VirtuosCubeinfoDoseAccessorGenerator( - Cubeinfo* aPointerOnVirtuosCube, - DoseTypeGy normalizationDose, DoseTypeGy prescribedDose): - _pPointerOnVirtuosCube(new Cubeinfo*) - { - //initialize cube pointer - *_pPointerOnVirtuosCube = create_cubeinfo(0); - *_pPointerOnVirtuosCube = aPointerOnVirtuosCube; - _normalizationDose = normalizationDose; - _prescribedDose = prescribedDose; - - } - - VirtuosCubeinfoDoseAccessorGenerator::DoseAccessorPointer - VirtuosCubeinfoDoseAccessorGenerator::generateDoseAccessor() - { - _doseAccessor = boost::make_shared(*_pPointerOnVirtuosCube, false, - _normalizationDose, - _prescribedDose); - return _doseAccessor; - } - - - - } - } -} - diff --git a/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.h b/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.h deleted file mode 100644 index b1ab379..0000000 --- a/code/io/virtuos/rttbVirtuosCubeinfoDoseAccessorGenerator.h +++ /dev/null @@ -1,82 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#ifndef __VIRTUOS_CUBEINFO_DOSE_ACCESSOR_GENERATOR_H -#define __VIRTUOS_CUBEINFO_DOSE_ACCESSOR_GENERATOR_H - -#include -#include -#include - -#include "rttbDoseAccessorGeneratorBase.h" -#include "rttbDoseAccessorInterface.h" -#include "rttbGeometricInfo.h" -#include "rttbBaseType.h" - -#include "ncfile.h" - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - /*! @class VirtuosCubeinfoDoseAccessorGenerator - @brief Generate DoseAccessor with Virtuos Cubeinfo - */ - class VirtuosCubeinfoDoseAccessorGenerator: public core::DoseAccessorGeneratorBase - { - public: - typedef core::DoseAccessorInterface::DoseAccessorPointer DoseAccessorPointer; - - private: - Cubeinfo** _pPointerOnVirtuosCube; - DoseTypeGy _normalizationDose; - DoseTypeGy _prescribedDose; - - - VirtuosCubeinfoDoseAccessorGenerator(); - - protected: - - - - public: - ~VirtuosCubeinfoDoseAccessorGenerator(); - - /*! @brief Constructor. Initialisation with a Cubeinfo*. - @param normalizationDose is defined as (prescribedDose*1000)/maxDoseInGy. Default is 1 Gy. - @param prescribedDose the does that was planned in the reference point in Gy. Default is 1 Gy. - */ - VirtuosCubeinfoDoseAccessorGenerator(Cubeinfo* aPointerOnVirtuosCube, - DoseTypeGy normalizationDose = 1, - DoseTypeGy prescribedDose = 1); - /*! @brief Generate DoseAccessor - @return Return shared pointer of DoseAccessor. - */ - DoseAccessorPointer generateDoseAccessor() ; - - }; - } - } -} - -#endif diff --git a/code/io/virtuos/rttbVirtuosDoseAccessor.cpp b/code/io/virtuos/rttbVirtuosDoseAccessor.cpp deleted file mode 100644 index a66ed42..0000000 --- a/code/io/virtuos/rttbVirtuosDoseAccessor.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - - -#include "rttbVirtuosDoseAccessor.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - -//VIRTUOS -#include "pln1file.h" -#include "plt_type.h" -#include "rtp_type.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - VirtuosDoseAccessor::~VirtuosDoseAccessor() - { - if (_freeVirtuosData) - { - this->freeVirtuosData(); - } - } - - VirtuosDoseAccessor::VirtuosDoseAccessor(Cubeinfo* aPointerOnVirtuosCube, bool freeVirtuosData, - DoseTypeGy normalizationDose, DoseTypeGy prescribedDose): - _pPointerOnVirtuosCube(new Cubeinfo*), _freeVirtuosData(freeVirtuosData), _doseGridScaling(0), - _doseUID(""), _doseScalingFactor(0) - { - //initialize cube pointer - *_pPointerOnVirtuosCube = create_cubeinfo(0); - *_pPointerOnVirtuosCube = aPointerOnVirtuosCube; - - - _prescribedDose = prescribedDose; - _normalizationDose = normalizationDose; - - if (_prescribedDose == 0) - { - _prescribedDose = 1; - } - - if (_normalizationDose == 0) - { - _normalizationDose = 1; - } - - _doseScalingFactor = _prescribedDose / _normalizationDose; - std::cout << "Prescribed dose: " << _prescribedDose << std::endl; - std::cout << "Normalization dose: " << _normalizationDose << std::endl; - - //dose import - this->begin(); - } - - void VirtuosDoseAccessor::begin() - { - if (!_pPointerOnVirtuosCube) - { - throw core::NullPointerException(" *_pPointerOnVirtuosCube must not be NULL!"); - } - - assembleGeometricInfo(); - - //load data - if ((*_pPointerOnVirtuosCube)->data_type == 1) - { - this->importPixelData(); - } - else if ((*_pPointerOnVirtuosCube)->data_type == 2) - { - this->importPixelData(); - } - else - { - throw core::InvalidParameterException(" cube has wrong data type!"); - } - } - - template - void VirtuosDoseAccessor::importPixelData() - { - doseData.clear(); - - int dimX = (*_pPointerOnVirtuosCube)->dimx; - int dimY = (*_pPointerOnVirtuosCube)->dimy; - int dimZ = (*_pPointerOnVirtuosCube)->dimz; - - GridVolumeType pixelSpacing = (*_pPointerOnVirtuosCube)->pixdist; - GridVolumeType sliceThickness = (*_pPointerOnVirtuosCube)->slicedist; - - TPixelType** * access_pointer = (TPixelType***)(*_pPointerOnVirtuosCube)->cube_direct_access; - - for (int k = 0; k < dimZ; k++) - { - for (int j = 0; j < dimY; j++) - { - for (int i = 0; i < dimX; i++) - { - TPixelType voxel_value = access_pointer[k][j][i]; - doseData.push_back(voxel_value * _doseScalingFactor); - } - - }//end for j - }//end for k - } - - void VirtuosDoseAccessor::assembleGeometricInfo() - { - if (!_pPointerOnVirtuosCube) - { - throw core::NullPointerException(" _pPointerOnVirtuosCube must not be NULL!"); - } - - _geoInfo.setNumColumns((*_pPointerOnVirtuosCube)->dimx); - - _geoInfo.setNumRows((*_pPointerOnVirtuosCube)->dimy); - - _geoInfo.setNumSlices((*_pPointerOnVirtuosCube)->dimz); - - if (_geoInfo.getNumColumns() == 0 || _geoInfo.getNumRows() == 0 || _geoInfo.getNumSlices() == 0) - { - throw core::InvalidDoseException("Empty Virtuos dose!") ; - } - - OrientationMatrix orientation; - _geoInfo.setOrientationMatrix(orientation); - - WorldCoordinate3D imagePositionPatient; - imagePositionPatient(0) = (*this->_pPointerOnVirtuosCube)->pixdist / 2; - imagePositionPatient(1) = (*this->_pPointerOnVirtuosCube)->pixdist / 2; - - if (!((*this->_pPointerOnVirtuosCube)->pos_list)) - { - throw core::InvalidDoseException("Empty Virtuos dose!") ; - } - - imagePositionPatient(2) = (*this->_pPointerOnVirtuosCube)->pos_list[0].position; - - _geoInfo.setImagePositionPatient(imagePositionPatient); - - SpacingVectorType3D spacingVector; - spacingVector(0) = (*_pPointerOnVirtuosCube)->pixdist; - spacingVector(1) = (*_pPointerOnVirtuosCube)->pixdist; - _geoInfo.setSpacing(spacingVector); - - if (_geoInfo.getPixelSpacingRow() == 0 || _geoInfo.getPixelSpacingColumn() == 0) - { - throw core::InvalidDoseException("Pixel spacing = 0!"); - } - - spacingVector(2) = (*_pPointerOnVirtuosCube)->slicedist; - - if (spacingVector(2) == 0) - { - std::cerr << "sliceThickness == 0! It will be replaced with pixelSpacingRow=" << - _geoInfo.getPixelSpacingRow() - << "!" << std::endl; - spacingVector(2) = spacingVector(0); - } - - _geoInfo.setSpacing(spacingVector); - } - - - GenericValueType VirtuosDoseAccessor::getValueAt(const VoxelGridID aID) const - { - return doseData.at(aID); - } - - GenericValueType VirtuosDoseAccessor::getValueAt(const VoxelGridIndex3D& aIndex) const - { - VoxelGridID aVoxelGridID; - - if (_geoInfo.convert(aIndex, aVoxelGridID)) - { - return getValueAt(aVoxelGridID); - } - else - { - return -1; - } - } - - void VirtuosDoseAccessor::freeVirtuosData() - { - if (*(this->_pPointerOnVirtuosCube) != NULL) - { - closecube((*(this->_pPointerOnVirtuosCube))); - nc_free_cubeinfo((*(this->_pPointerOnVirtuosCube))); - delete this->_pPointerOnVirtuosCube; - - // initialize attributes again - //this->_pPointerOnVirtuosCube = new Cubeinfo*; - //*(this->_pPointerOnVirtuosCube) = create_cubeinfo(0); - } - - } - - } - } -} - diff --git a/code/io/virtuos/rttbVirtuosDoseAccessor.h b/code/io/virtuos/rttbVirtuosDoseAccessor.h deleted file mode 100644 index 103891b..0000000 --- a/code/io/virtuos/rttbVirtuosDoseAccessor.h +++ /dev/null @@ -1,129 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#ifndef __VIRTUOS_DOSE_ACCESSOR_H -#define __VIRTUOS_DOSE_ACCESSOR_H - -#include -#include -#include - -#include "rttbAccessorWithGeoInfoBase.h" -#include "rttbGeometricInfo.h" -#include "rttbBaseType.h" - -#include "ncfile.h" - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - /*! @class VirtuosDoseAccessor - @brief This class gives access to dose information from Virtuos Cubeinfo - */ - class VirtuosDoseAccessor : public core::AccessorWithGeoInfoBase - { - private: - Cubeinfo** _pPointerOnVirtuosCube; - - - /*! absolute Gy dose/doseGridScaling*/ - std::vector doseData; - - double _doseGridScaling; - - IDType _doseUID; - - DoseTypeGy _prescribedDose; - DoseTypeGy _normalizationDose; - - DoseTypeGy _doseScalingFactor; - - bool _freeVirtuosData;//if virtuos cube info should be closed - - - /*! close virtuos data cube. - */ - void freeVirtuosData(); - - /*! load actual pixel data from virtuos cube to doseData. TPixelType is usually int but may be float for - special virtuos cubes (data_type = 2). - @pre virtuos cube contains data (dimensions are at least 1) - - */ - template - void importPixelData(); - - protected: - /*! @brief import dose data and relevant geometric information - @throw NullPointerException Thrown if _pPointerOnVirtuosCube is NULL - @throw InvalidDoseException Thrown if one dimension of the virtuos cube is zero - @throw InvalidParameterException Thrown if _pPointerOnVirtuosCube is invalid - */ - void begin(); - - /*! @brief get all required geometrical data from virtuos cube - */ - void assembleGeometricInfo(); - - - public: - ~VirtuosDoseAccessor(); - - /*! @brief Constructor. Initialisation with a Cubeinfo pointer. - @param normalizationDose is defined as (prescribedDose*1000)/maxDoseInGy. Default is 1 Gy. - @param prescribedDose the does that was planned in the reference point in Gy. Default is 1 Gy. - @param freeVirtuoData If virtuos cube info should be closed, freeVirtuosData should be true. - @throw NullPointerException Thrown if _pPointerOnVirtuosCube is NULL - @throw InvalidDoseException Thrown if one dimension of the virtuos cube is zero - @throw InvalidParameterException Thrown if aPointerOnVirtuosCube is invalid - */ - VirtuosDoseAccessor(Cubeinfo* aPointerOnVirtuosCube, bool freeVirtuosData, - DoseTypeGy normalizationDose = 1, DoseTypeGy prescribedDose = 1); - - GenericValueType getValueAt(const VoxelGridID aID) const; - - /*! @return dose value at given grid position. If position is invalid return -1 - */ - GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const; - - const IDType getUID() const - { - return _doseUID; - }; - - const DoseTypeGy getPrescribedDose() const - { - return _prescribedDose; - }; - - const DoseTypeGy getNormalizationDose() const - { - return _normalizationDose; - }; - }; - } - } -} - -#endif diff --git a/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.cpp b/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.cpp deleted file mode 100644 index 8a8a979..0000000 --- a/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#include -#include -#include - - -#include "rttbVirtuosDoseFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - -//VIRTUOS -#include "pln1file.h" -#include "plt_type.h" -#include "rtp_type.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - VirtuosDoseFileDoseAccessorGenerator::~VirtuosDoseFileDoseAccessorGenerator() - { - } - - - VirtuosDoseFileDoseAccessorGenerator::VirtuosDoseFileDoseAccessorGenerator( - const FileNameType aVirtuosDoseFileName, DoseTypeGy normalizationDose, DoseTypeGy prescribedDose): - _pPointerOnVirtuosCube(new Cubeinfo*) - { - _doseFileName = aVirtuosDoseFileName; - _normalizationDose = normalizationDose; - _prescribedDose = prescribedDose; - - - } - - - void VirtuosDoseFileDoseAccessorGenerator::initializeVirtuosCube(FileNameType aVirtuosDoseFileName) - { - if (aVirtuosDoseFileName.empty()) - { - throw core::InvalidParameterException("empty File Name"); - } - - size_t gzPosition = aVirtuosDoseFileName.find(".gz"); - - if (gzPosition != std::string::npos) - { - aVirtuosDoseFileName.erase(gzPosition, aVirtuosDoseFileName.length()); - } - - nc_init_cubeinfo(*_pPointerOnVirtuosCube); - - int opencubeErrorCode = opencube(aVirtuosDoseFileName.c_str() , *_pPointerOnVirtuosCube); - - if (opencubeErrorCode != 0) - { - std::stringstream opencubeErrorCodeAsStringStream; - opencubeErrorCodeAsStringStream << opencubeErrorCode; - throw core::InvalidParameterException(std::string("VirtuosIO::openCube returned error Code: ") + - opencubeErrorCodeAsStringStream.str()); - } - - - if ((*_pPointerOnVirtuosCube)->dimx == 0 || (*_pPointerOnVirtuosCube)->dimy == 0 - || (*_pPointerOnVirtuosCube)->dimz == 0) - { - throw core::InvalidParameterException("invalid Cube dimension"); - } - - } - - VirtuosDoseFileDoseAccessorGenerator::DoseAccessorPointer - VirtuosDoseFileDoseAccessorGenerator::generateDoseAccessor() - { - //check if file names are valid - if (!boost::filesystem::exists(_doseFileName)) - { - throw core::InvalidParameterException("invalid dose file name"); - } - - //initialize cube pointer - *_pPointerOnVirtuosCube = create_cubeinfo(0); - - if (!(_doseFileName.empty())) - { - //initialize dose import - - this->initializeVirtuosCube(_doseFileName); - - if (_prescribedDose == 0) - { - _prescribedDose = 1; - } - - if (_normalizationDose == 0) - { - _normalizationDose = 1; - } - - _doseAccessor = boost::make_shared(*_pPointerOnVirtuosCube, true, - _normalizationDose, _prescribedDose); - - - } - else - { - throw core::InvalidParameterException("empty dose file name"); - } - - return _doseAccessor; - } - - - } - } -} - diff --git a/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.h b/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.h deleted file mode 100644 index 5b0b1a0..0000000 --- a/code/io/virtuos/rttbVirtuosDoseFileDoseAccessorGenerator.h +++ /dev/null @@ -1,93 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#ifndef __VIRTUOS_DOSE_FILE_DOSE_ACCESSOR_GENERATOR_H -#define __VIRTUOS_DOSE_FILE_DOSE_ACCESSOR_GENERATOR_H - -#include -#include -#include - -#include "rttbDoseAccessorGeneratorBase.h" -#include "rttbDoseAccessorInterface.h" -#include "rttbGeometricInfo.h" -#include "rttbBaseType.h" - -#include "ncfile.h" - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - /*! @class VirtuosDoseFileDoseAccessorGenerator - @brief Load dose data from a Virtuos dose file and generate DoseAccessor. - @warning Manual dose normalization is done as no virtuos plan file is given! I.e., the DoseAccessor returns pixels having no physical unit (!= Gy) in case of wrong values. It's the responsibility of the user to specify the correct values. Consider using VirtuosPlanFileDoseAccessorGenerator instead! - */ - class VirtuosDoseFileDoseAccessorGenerator: public core::DoseAccessorGeneratorBase - { - public: - typedef core::DoseAccessorInterface::DoseAccessorPointer DoseAccessorPointer; - - private: - FileNameType _doseFileName; - DoseTypeGy _normalizationDose; - DoseTypeGy _prescribedDose; - Cubeinfo** _pPointerOnVirtuosCube; - - /*! prepare virtuos dose cube for data import. Actual data import is performed in importPixelData() - and assembleGeometricInfo(). - @pre filename needs to point to an existing file. - @throw InvalidParameterException Thrown if aVirtuosDoseFileName is invalid or if virtuos cube can not be read - */ - void initializeVirtuosCube(FileNameType aVirtuosDoseFileName); - - VirtuosDoseFileDoseAccessorGenerator(); - - - protected: - - - - public: - - ~VirtuosDoseFileDoseAccessorGenerator(); - - /*! @brief Constructor. Initialisation with a Virtuos-RT dose file with name aVirtuosDoseFileName. - @param normalizationDose is defined as (prescribedDose*1000)/maxDoseInGy. - @param prescribedDose the does that was planned in the reference point in Gy. - */ - VirtuosDoseFileDoseAccessorGenerator(const FileNameType aVirtuosDoseFileName, - DoseTypeGy normalizationDose, DoseTypeGy prescribedDose); - - /*@brief Generate DoseAccessor - @return Return shared pointer of DoseAccessor. - @throw InvalidParameterException Thrown if one of the file names is empty. - */ - DoseAccessorPointer generateDoseAccessor() ; - - }; - } - } -} - -#endif diff --git a/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.cpp b/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.cpp deleted file mode 100644 index 9aab674..0000000 --- a/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -#include -#include -#include - -#include -#include - -#include "rttbNullPointerException.h" -#include "rttbInvalidParameterException.h" -#include "rttbStructure.h" -#include "rttbVirtuosFileStructureSetGenerator.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - VirtuosFileStructureSetGenerator::VirtuosFileStructureSetGenerator(FileNameType aVirtuosVDXFileName, - FileNameType aVirtuosCTXFileName) - : _pPointerOnVirtuosCube(new Cubeinfo*), _patient(NULL) - { - _VDXFileName = aVirtuosVDXFileName; - _CTXFileName = aVirtuosCTXFileName; - - //check if file names are valid - if (!boost::filesystem::exists(_VDXFileName)) - { - throw core::InvalidParameterException("invalid vdx file name"); - } - - if (!boost::filesystem::exists(_CTXFileName)) - { - throw core::InvalidParameterException("invalid ctx file name"); - } - - *_pPointerOnVirtuosCube = create_cubeinfo(0); - - this->initializeVirtuosCube(_CTXFileName); - - } - - - VirtuosFileStructureSetGenerator::~VirtuosFileStructureSetGenerator() - { - if (this->_patient != NULL) - { - delete this->_patient; - } - - closecube((*(this->_pPointerOnVirtuosCube))); - nc_free_cubeinfo((*(this->_pPointerOnVirtuosCube))); - delete this->_pPointerOnVirtuosCube; - } - - void VirtuosFileStructureSetGenerator::importStructureSet(FileNameType aVirtuosVDXFileName, - FileNameType aVirtuosCTXFileName) - { - //check file name - if (aVirtuosCTXFileName.empty() || aVirtuosVDXFileName.empty()) - { - throw core::InvalidParameterException("Virtuos VDX/CTX file name must not be empty!"); - } - - size_t vdxPosition = aVirtuosVDXFileName.find(".vdx"); - - if (vdxPosition == std::string::npos) - { - throw core::InvalidParameterException("Virtuos VDX file name must be *.vdx!"); - } - - //get patientFileName, patientDataPath for Virtuos function - std::string patientFileName, patientName, patientDataPath; - patientFileName.assign(aVirtuosVDXFileName, aVirtuosVDXFileName.find_last_of("/") + 1, - aVirtuosVDXFileName.length()); - patientName.assign(patientFileName, 0, patientFileName.find_first_of(".")); - patientDataPath.assign(aVirtuosVDXFileName, 0, aVirtuosVDXFileName.find_last_of("/") + 1); - - //Virtuos: voi create voi model - int errorcode = voi_create_voi_model_dirolab(patientName.c_str(), patientDataPath.c_str(), 0, - this->_patient); - - if (errorcode != 0) - { - //throw std::string ("Virtuos Routines unable to create VOI Model! "); - std::cerr << "voi_create_voi_model_dirolab error: error code " << errorcode << std::endl; - } - - //Virtuos: voi read vdx - errorcode = voi_read_vdx_version_2_for_DIROlab(patientFileName.c_str(), patientDataPath.c_str(), - this->_patient); - - if (errorcode != 0) - { - //throw std::string ("voi_read_vdx_version_2_for_DIROlab failed! "); - std::cerr << "voi_read_vdx_version_2_for_DIROlab error: error code " << errorcode << std::endl; - } - - int numberOfVois = this->_patient->getNumberOfVois(); - - float firstSliceInFrame = (*_pPointerOnVirtuosCube)->pos_list[0].position; - - float sliceThickness = (*_pPointerOnVirtuosCube)->slicedist; - - float lastSliceInFrame = static_cast(((*_pPointerOnVirtuosCube)->dimz - 1) * sliceThickness + firstSliceInFrame); - - for (int currentVoiNumber = 0; currentVoiNumber < numberOfVois; currentVoiNumber++) - { - std::string voiName = ""; - char tmpVoiName[1024]; - voi_get_voi_name_by_index_dirolab(currentVoiNumber, 1024, tmpVoiName, this->_patient); - voiName.assign(tmpVoiName); - - /* prepare contour extraction */ - D3PointList* contours = NULL; - contours = d3_list_create(1000000); - D3Point origin = {0, 0, 0}, y_axis_point = {0, 0, 0}, x_axis_point = {0, 0, 0}; - int maxNumberOfContours = 100000; - int* pNoOFContours = &maxNumberOfContours; - - PolygonSequenceType polygonSequence; - - for (float z = firstSliceInFrame; z <= lastSliceInFrame; z += sliceThickness) - { - - origin.x = 0.0; - origin.y = 0.0; - origin.z = z ; - - x_axis_point.x = 1.0; - x_axis_point.y = 0.0; - x_axis_point.z = z ; - - y_axis_point.x = 0.0; - y_axis_point.y = 1.0; - y_axis_point.z = z; - *pNoOFContours = 100000; //<-- reason is the next function call - - voi_get_CT_contours_dirolab(voiName.c_str(), origin, x_axis_point, y_axis_point, pNoOFContours, - &contours, 1, - this->_patient); - - for (int i = 0; i < *pNoOFContours; i++) - { - PolygonType polygon; - - for (int j = 0; j < contours[i].used - 1; - j++) //Virtuos polygon the last point is the same as the first point - { - WorldCoordinate3D point; - point(0) = contours[i].points[j].x; - point(1) = contours[i].points[j].y; - point(2) = contours[i].points[j].z; - polygon.push_back(point); - - }//end for j - - polygonSequence.push_back(polygon); - - }//end for i - - }//end for z - - boost::shared_ptr spStruct = boost::make_shared(polygonSequence); - spStruct->setLabel(voiName); - _strVector.push_back(spStruct); - }//end for currentVoiNumber - - } - - void VirtuosFileStructureSetGenerator::initializeVirtuosCube(FileNameType aVirtuosCTXFileName) - { - if (aVirtuosCTXFileName.empty()) - { - throw core::InvalidParameterException("Empty File Name"); - } - - size_t gzPosition = aVirtuosCTXFileName.find(".gz"); - - if (gzPosition != std::string::npos) - { - aVirtuosCTXFileName.erase(gzPosition, aVirtuosCTXFileName.length()); - } - - nc_init_cubeinfo(*_pPointerOnVirtuosCube); - - int opencubeErrorCode = opencube(aVirtuosCTXFileName.c_str() , *_pPointerOnVirtuosCube); - - if (opencubeErrorCode != 0) - { - std::stringstream opencubeErrorCodeAsStringStream; - - opencubeErrorCodeAsStringStream << opencubeErrorCode; - - throw core::InvalidParameterException(std::string( - std::string("VirtuosIO::openCube returned error Code: ") + - opencubeErrorCodeAsStringStream.str())); - } - - if ((*_pPointerOnVirtuosCube)->dimx == 0 || (*_pPointerOnVirtuosCube)->dimy == 0 - || (*_pPointerOnVirtuosCube)->dimz == 0) - { - throw core::InvalidParameterException("Invalid Cube dimension: dimX/dimY/dimZ must not be zero! "); - } - } - - VirtuosFileStructureSetGenerator::StructureSetPointer - VirtuosFileStructureSetGenerator::generateStructureSet() - { - - this->importStructureSet(_VDXFileName, _CTXFileName); - - return boost::make_shared(_strVector); - } - - }//end namespace virtuos - }//end namespace io -}//end namespace rttb diff --git a/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.h b/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.h deleted file mode 100644 index 9a7618e..0000000 --- a/code/io/virtuos/rttbVirtuosFileStructureSetGenerator.h +++ /dev/null @@ -1,109 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -/* Changes in Architecture: -The DICOM specific classes will be removed and transfered to the corresponding IO classes. -This class should only provide general structure functionality. -*/ - -#ifndef __VIRTUOS_FILE_STRUCTURE_SET_GENERATOR_H -#define __VIRTUOS_FILE_STRUCTURE_SET_GENERATOR_H - -#include - -#include -#include - -// Virtuos includes -#include "ncfile.h" -#include "voi_man.hxx" - -#include "rttbBaseType.h" -#include "rttbStrVectorStructureSetGenerator.h" -#include "rttbStructure.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - /*! @class VirtuosFileStructureSetGenerator - @brief Genereate a structure set from a corresponding Virtuos data. - */ - class VirtuosFileStructureSetGenerator: public core::StrVectorStructureSetGenerator - { - public: - typedef core::StructureSet::StructTypePointer StructTypePointer; - typedef StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - - private: - // Pointer to Virtuos image data cube - Cubeinfo** _pPointerOnVirtuosCube; - - //Virtuos Patient Pointer - VoiModel* _patient; - - IDType _UID; - FileNameType _VDXFileName; - FileNameType _CTXFileName; - - - /*! open virtuos ctx cube - @throw InvalidParameterException if ctx cube could not be opened or dose dimensions are invalid - */ - void initializeVirtuosCube(FileNameType aVirtuosCTXFileName); - - /*! import virtuos vdx contours from file - @throw InvalidParameterException if one of the file names is empty. - @throw InvalidParameterException if aVirtuosVDXFileName, does not end with '.vdx'. - */ - void importStructureSet(FileNameType aVirtuosVDXFileName, FileNameType aVirtuosCTXFileName); - - - public: - /*! @brief Constructor - @param aVirtuosVDXFileName a Virtuos structure set .vdx file name - @param aVirtuosCTXFileName a Virtuos CT .ctx file name - - */ - VirtuosFileStructureSetGenerator(FileNameType aVirtuosVDXFileName, - FileNameType aVirtuosCTXFileName); - - /*! @brief Destructor - Free Virtuos Cubeinfo. - */ - ~VirtuosFileStructureSetGenerator(); - - /*! @brief generate structure set - @return return shared pointer of StructureSet - @exception InvalidParameterException Thrown if loadFile and read failed - @exception InvalidParameterException throw if structure data invalid. - */ - StructureSetPointer generateStructureSet(); - }; - } - } -} - -#endif diff --git a/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.cpp b/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.cpp deleted file mode 100644 index 5dd0aad..0000000 --- a/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#include -#include -#include - -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - -//VIRTUOS -#include "pln1file.h" -#include "plt_type.h" -#include "rtp_type.h" - - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - VirtuosPlanFileDoseAccessorGenerator::~VirtuosPlanFileDoseAccessorGenerator() - { - } - - VirtuosPlanFileDoseAccessorGenerator::VirtuosPlanFileDoseAccessorGenerator( - const FileNameType aVirtuosDoseFileName, const FileNameType aVirtuosPlanFileName): - _pPointerOnVirtuosCube(new Cubeinfo*) - { - _doseFileName = aVirtuosDoseFileName; - _planFileName = aVirtuosPlanFileName; - - } - - - - void VirtuosPlanFileDoseAccessorGenerator::initializeVirtuosCube(FileNameType aVirtuosDoseFileName) - { - if (aVirtuosDoseFileName.empty()) - { - throw core::InvalidParameterException("empty File Name"); - } - - size_t gzPosition = aVirtuosDoseFileName.find(".gz"); - - if (gzPosition != std::string::npos) - { - aVirtuosDoseFileName.erase(gzPosition, aVirtuosDoseFileName.length()); - } - - nc_init_cubeinfo(*_pPointerOnVirtuosCube); - - int opencubeErrorCode = opencube(aVirtuosDoseFileName.c_str() , *_pPointerOnVirtuosCube); - - if (opencubeErrorCode != 0) - { - std::stringstream opencubeErrorCodeAsStringStream; - opencubeErrorCodeAsStringStream << opencubeErrorCode; - throw core::InvalidParameterException(std::string("VirtuosIO::openCube returned error Code: ") + - opencubeErrorCodeAsStringStream.str()); - } - - - if ((*_pPointerOnVirtuosCube)->dimx == 0 || (*_pPointerOnVirtuosCube)->dimy == 0 - || (*_pPointerOnVirtuosCube)->dimz == 0) - { - throw core::InvalidParameterException("invalid Cube dimension"); - } - - } - - VirtuosPlanFileDoseAccessorGenerator::DoseAccessorPointer - VirtuosPlanFileDoseAccessorGenerator::generateDoseAccessor() - { - //initialize cube pointer - *_pPointerOnVirtuosCube = create_cubeinfo(0); - - //check if file names are valid - if (!boost::filesystem::exists(_doseFileName)) - { - throw core::InvalidParameterException("invalid dose file name"); - } - - if (!boost::filesystem::exists(_planFileName)) - { - throw core::InvalidParameterException("invalid plan file name"); - } - - if (!(_doseFileName.empty())) - { - //import relevant plan data - if (_planFileName.empty()) - { - throw core::InvalidParameterException("empty plan file name"); - } - - size_t plnPosition = _planFileName.find(".pln"); - - if (plnPosition == std::string::npos) - { - throw core::InvalidParameterException("plan file name invalid!"); - } - - RTPType virtuosPlan; - rtp_plan_init(&virtuosPlan, RTP_S_DEVICE_COORD_IEC); - rtp_plan_clear(&virtuosPlan, FALSE, RTP_S_DEVICE_COORD_IEC); - int error = rtp_plan_read(const_cast(_planFileName.c_str()), &virtuosPlan); - - if (error) - { - std::stringstream expSStr; - expSStr << "Read virtuos plan: rtp_plan_read returned error code "; - expSStr << error; - throw core::InvalidParameterException(expSStr.str()); - } - - DoseTypeGy prescribedDose = virtuosPlan.dose_info.prescr_dose; - DoseTypeGy normalizationDose = virtuosPlan.dose_info.norm_dose; - - if (prescribedDose == 0) - { - prescribedDose = 1; - } - - if (normalizationDose == 0) - { - normalizationDose = 1; - } - - - this->initializeVirtuosCube(_doseFileName); - - _doseAccessor = boost::make_shared(*_pPointerOnVirtuosCube, true, - normalizationDose, prescribedDose); - - } - else - { - throw core::InvalidParameterException("empty dose file name"); - } - - return _doseAccessor; - } - - - } - } -} - diff --git a/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.h b/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.h deleted file mode 100644 index 7160ad9..0000000 --- a/code/io/virtuos/rttbVirtuosPlanFileDoseAccessorGenerator.h +++ /dev/null @@ -1,87 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ -#ifndef __VIRTUOS_PLAN_FILE_DOSE_ACCESSOR_GENERATOR_H -#define __VIRTUOS_PLAN_FILE_DOSE_ACCESSOR_GENERATOR_H - -#include -#include -#include - -#include "rttbDoseAccessorGeneratorBase.h" -#include "rttbGeometricInfo.h" -#include "rttbBaseType.h" - -#include "ncfile.h" - -namespace rttb -{ - namespace io - { - namespace virtuos - { - - /*! @class VirtuosPlanFileDoseAccessorGenerator - @brief Load dose data from a Virtuos dose file and a Virtuos plan file, generate DoseAccessor. - @detail Through the use of the plan file, the dose file can be normalized, i.e. the DoseAccessor returns values in Gy. - */ - class VirtuosPlanFileDoseAccessorGenerator: public core::DoseAccessorGeneratorBase - { - private: - FileNameType _doseFileName; - FileNameType _planFileName; - - Cubeinfo** _pPointerOnVirtuosCube; - - /*! prepare virtuos dose cube for data import. Actual data import is performed in importPixelData() - and assembleGeometricInfo(). - @pre filename needs to point to an existing file. - @throw InvalidParameterException Thrown if aVirtuosDoseFileName is invalid or if virtuos cube can not be read - */ - void initializeVirtuosCube(FileNameType aVirtuosDoseFileName); - - VirtuosPlanFileDoseAccessorGenerator(); - - protected: - - - - public: - ~VirtuosPlanFileDoseAccessorGenerator(); - /*! @brief Constructor. Initialisation with a Virtuos dose file and a Virtuos plan file. Information for dose scaling, - etc. is taken from the corresponding plan file aVirtuosPlanFileName. - - */ - VirtuosPlanFileDoseAccessorGenerator(const FileNameType aVirtuosDoseFileName, - const FileNameType aVirtuosPlanFileName); - - /*@brief Generate DoseAccessor - @return Return shared pointer of DoseAccessor. - @throw InvalidParameterException Thrown if one of the file names is empty. - @throw InvalidParameterException Thrown if plan file or virtuos cube could not be read. - */ - DoseAccessorPointer generateDoseAccessor() override; - - }; - } - } -} - -#endif diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 48cdeb2..4e48b98 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -1,94 +1,91 @@ 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_Tester_Interpolation AND BUILD_InterpolationMatchPointTransformation) OR (BUILD_Tester_IO AND BUILD_IO_ITK) OR (BUILD_Tester_Apps 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) OPTION(BUILD_Tester_All "All testing modules will be built" OFF) MESSAGE(STATUS "Process All Tests...") #----------------------------------------------------------------------------- # Include sub directories #----------------------------------------------------------------------------- OPTION(BUILD_Tester_Core "build project on/off" OFF) OPTION(BUILD_Tester_Examples "build project on/off" OFF) OPTION(BUILD_Tester_Algorithms "build project on/off" OFF) OPTION(BUILD_Tester_Models "build project on/off" OFF) OPTION(BUILD_Tester_IO "build project on/off" OFF) OPTION(BUILD_Tester_Masks "build project on/off" OFF) OPTION(BUILD_Tester_Interpolation "build project on/off" OFF) OPTION(BUILD_Tester_Apps "build project on/off" OFF) OPTION(BUILD_Tester_Validation "build project on/off" OFF) IF(BUILD_Tester_All OR BUILD_Tester_Core) ADD_SUBDIRECTORY(core) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Examples) ADD_SUBDIRECTORY(examples) - IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(examples_virtuos) - ENDIF() ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Algorithms) ADD_SUBDIRECTORY(algorithms) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Models) ADD_SUBDIRECTORY(models) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_IO) ADD_SUBDIRECTORY(io) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Masks) ADD_SUBDIRECTORY(masks) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Interpolation) ADD_SUBDIRECTORY(interpolation) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Validation) ADD_SUBDIRECTORY(validation) ENDIF() IF(BUILD_Tester_All OR BUILD_Tester_Apps) ADD_SUBDIRECTORY(apps) ENDIF() diff --git a/testing/apps/CMakeLists.txt b/testing/apps/CMakeLists.txt index bd27832..086b553 100644 --- a/testing/apps/CMakeLists.txt +++ b/testing/apps/CMakeLists.txt @@ -1,27 +1,24 @@ MESSAGE (STATUS "Process All apps Tests...") #----------------------------------------------------------------------------- # Include sub directories #----------------------------------------------------------------------------- IF(BUILD_App_DoseTool) ADD_SUBDIRECTORY (DoseTool) - IF(RTTB_VIRTUOS_SUPPORT AND BUILD_IO_Virtuos) - ADD_SUBDIRECTORY (DoseTool4V) - ENDIF() ENDIF() IF(BUILD_App_VoxelizerTool) ADD_SUBDIRECTORY (VoxelizerTool) ENDIF() IF(BUILD_App_DoseMap AND BUILD_IO_Virtuos) ADD_SUBDIRECTORY (DoseMap) ENDIF() IF(BUILD_App_BioModelCalc) ADD_SUBDIRECTORY (BioModelCalc) ENDIF() IF(BUILD_App_DoseAcc) ADD_SUBDIRECTORY (DoseAcc) ENDIF() \ No newline at end of file diff --git a/testing/apps/DoseTool4V/CMakeLists.txt b/testing/apps/DoseTool4V/CMakeLists.txt deleted file mode 100644 index 68602a3..0000000 --- a/testing/apps/DoseTool4V/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -#----------------------------------------------------------------------------- -# Setup the system information test. Write out some basic failsafe -# information in case the test doesn't run. -#----------------------------------------------------------------------------- - -SET(DOSETOOL4V_TEST ${EXECUTABLE_OUTPUT_PATH}/rttbDoseTool4VTests) - -SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) - -SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) - - -#----------------------------------------------------------------------------- - -IF(MSVC) - ADD_DEFINITIONS(/bigobj) -ENDIF() - -IF (WIN32) - SET(DOSETOOL4VEXE "DoseTool4V.exe") -ELSE (WIN32) - SET(DOSETOOL4VEXE "./DoseTool4V") -ENDIF (WIN32) - -ADD_TEST(DoseTool4VVirtuosDoseVirtuosStructTest ${DOSETOOL4V_TEST} DoseTool4VVirtuosDoseTest ${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/XML/virtuos.xml" "${TEST_DATA_ROOT}/DoseStatistics/XML/virtuosComplex.xml") -ADD_TEST(DoseTool4VITKDoseVirtuosStructTest ${DOSETOOL4V_TEST} DoseTool4VITKDoseTest ${DOSETOOL4VEXE} "${TEST_DATA_ROOT}/Dose/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/XML/itkVirtuosStruct.xml" "${TEST_DATA_ROOT}/DoseStatistics/XML/itkVirtuosStructComplex.xml") - -RTTB_CREATE_APPLICATION_TESTS(DoseTool4V DEPENDS RTTBOtherIO PACKAGE_DEPENDS Litmus BoostBinaries) diff --git a/testing/apps/DoseTool4V/DoseTool4VITKDoseTest.cpp b/testing/apps/DoseTool4V/DoseTool4VITKDoseTest.cpp deleted file mode 100644 index 6399033..0000000 --- a/testing/apps/DoseTool4V/DoseTool4VITKDoseTest.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// ----------------------------------------------------------------------- -// 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 "rttbDoseStatisticsXMLReader.h" -#include "../../io/other/CompareDoseStatistic.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 DoseTool4VITKDoseTest(int argc, char* argv[]) - { - PREPARE_DEFAULT_TEST_REPORTING; - - std::string doseToolExecutable; - std::string doseFilename; - std::string structFilename; - std::string structName; - std::string ctxFilename; - std::string referenceXMLFilename; - std::string referenceXMLComplexFilename; - - boost::filesystem::path callingPath(_callingAppPath); - - if (argc > 7) - { - doseToolExecutable = argv[1]; - doseFilename = argv[2]; - structFilename = argv[3]; - ctxFilename = argv[4]; - structName = argv[5]; - referenceXMLFilename = argv[6]; - referenceXMLComplexFilename = argv[7]; - } - - std::string doseToolExeWithPath = callingPath.parent_path().string() + "/" + doseToolExecutable; - - std::string defaultOutputFilename = "itkOutput.xml"; - std::string complexOutputFilename = "itkOutputComplex.xml"; - - std::string baseCommand = doseToolExeWithPath; - baseCommand += " -d \"" + doseFilename + "\""; - baseCommand += " -s \"" + structFilename + "\""; - baseCommand += " -t itk "; - - if (structName != "") - { - baseCommand += " -n " + structName; - - if (ctxFilename != "") - { - baseCommand += " -u virtuos " + ctxFilename; - } - } - else - { - baseCommand += " -u itk "; - } - - std::string defaultDoseStatisticsCommand = baseCommand + " -y " + defaultOutputFilename; - std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; - CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); - - std::string complexDoseStatisticsCommand = baseCommand + " -y " + complexOutputFilename; - //prescribed dose is 14 Gy - complexDoseStatisticsCommand += " -f -p 14"; - - std::cout << "Command line call: " + complexDoseStatisticsCommand << std::endl; - CHECK_EQUAL(system(complexDoseStatisticsCommand.c_str()), 0); - - //check if file exists - CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); - CHECK_EQUAL(boost::filesystem::exists(complexOutputFilename), 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(defaultOutputFilename); - auto doseStatisticsDefaultActual = readerDefaultActual.generateDoseStatistic(); - - CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected, doseStatisticsDefaultActual)); - - io::other::DoseStatisticsXMLReader readerComplexExpected(referenceXMLComplexFilename); - auto doseStatisticsComplexExpected = readerComplexExpected.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerComplexActual(complexOutputFilename); - auto doseStatisticsComplexActual = readerComplexActual.generateDoseStatistic(); - - CHECK(checkEqualDoseStatistic(doseStatisticsComplexExpected, doseStatisticsComplexActual)); - - //delete file again - CHECK_EQUAL(std::remove(defaultOutputFilename.c_str()), 0); - CHECK_EQUAL(std::remove(complexOutputFilename.c_str()), 0); - - RETURN_AND_REPORT_TEST_SUCCESS; - } - } //namespace testing -} //namespace rttb diff --git a/testing/apps/DoseTool4V/DoseTool4VTests.cpp b/testing/apps/DoseTool4V/DoseTool4VTests.cpp deleted file mode 100644 index 95cfb45..0000000 --- a/testing/apps/DoseTool4V/DoseTool4VTests.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// ----------------------------------------------------------------------- -// 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(DoseTool4VVirtuosDoseTest); - LIT_REGISTER_TEST(DoseTool4VITKDoseTest); - } - - } //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/DoseTool4V/DoseTool4VVirtuosDoseTest.cpp b/testing/apps/DoseTool4V/DoseTool4VVirtuosDoseTest.cpp deleted file mode 100644 index d8c80d8..0000000 --- a/testing/apps/DoseTool4V/DoseTool4VVirtuosDoseTest.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// ----------------------------------------------------------------------- -// 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 "rttbDoseStatisticsXMLReader.h" -#include "../../io/other/CompareDoseStatistic.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 DoseTool4VVirtuosDoseTest(int argc, char* argv[]) - { - PREPARE_DEFAULT_TEST_REPORTING; - - std::string doseToolExecutable; - std::string doseFilename; - std::string planFilename; - std::string structFilename; - std::string ctxFilename; - std::string structName; - std::string referenceXMLFilename; - std::string referenceXMLComplexFilename; - - boost::filesystem::path callingPath(_callingAppPath); - - - if (argc > 8) - { - doseToolExecutable = argv[1]; - doseFilename = argv[2]; - planFilename = argv[3]; - structFilename = argv[4]; - ctxFilename = argv[5]; - structName = argv[6]; - referenceXMLFilename = argv[7]; - referenceXMLComplexFilename = argv[8]; - } - - std::string doseToolExeWithPath = callingPath.parent_path().string() + "/" + doseToolExecutable; - - std::string defaultOutputFilename = "virtuosOutput.xml"; - std::string complexOutputFilename = "virtuosOutputComplex.xml"; - - std::string baseCommand = doseToolExeWithPath; - baseCommand += " -d \"" + doseFilename + "\""; - baseCommand += " -t virtuos \"" + planFilename + "\""; - baseCommand += " -s \"" + structFilename + "\""; - baseCommand += " -u virtuos \"" + ctxFilename + "\""; - baseCommand += " -n " + structName; - std::string defaultDoseStatisticsCommand = baseCommand + " -y " + defaultOutputFilename; - std::cout << "Command line call: " + defaultDoseStatisticsCommand << std::endl; - CHECK_EQUAL(system(defaultDoseStatisticsCommand.c_str()), 0); - - std::string complexDoseStatisticsCommand = baseCommand + " -y " + complexOutputFilename; - //prescribed dose is 50 Gy - complexDoseStatisticsCommand += " -f -p 50"; - - std::cout << "Command line call: " + complexDoseStatisticsCommand << std::endl; - CHECK_EQUAL(system(complexDoseStatisticsCommand.c_str()), 0); - - //check if file exists - CHECK_EQUAL(boost::filesystem::exists(defaultOutputFilename), true); - CHECK_EQUAL(boost::filesystem::exists(complexOutputFilename), true); - - io::other::DoseStatisticsXMLReader readerDefaultExpected(referenceXMLFilename); - auto doseStatisticsDefaultExpected = readerDefaultExpected.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerDefaultActual(defaultOutputFilename); - auto doseStatisticsDefaultActual = readerDefaultActual.generateDoseStatistic(); - - CHECK(checkEqualDoseStatistic(doseStatisticsDefaultExpected, doseStatisticsDefaultActual)); - - io::other::DoseStatisticsXMLReader readerComplexExpected(referenceXMLComplexFilename); - auto doseStatisticsComplexExpected = readerComplexExpected.generateDoseStatistic(); - io::other::DoseStatisticsXMLReader readerComplexActual(complexOutputFilename); - auto doseStatisticsComplexActual = readerComplexActual.generateDoseStatistic(); - - CHECK(checkEqualDoseStatistic(doseStatisticsComplexExpected, doseStatisticsComplexActual)); - - //delete file again - CHECK_EQUAL(std::remove(defaultOutputFilename.c_str()), 0); - CHECK_EQUAL(std::remove(complexOutputFilename.c_str()), 0); - - RETURN_AND_REPORT_TEST_SUCCESS; - } - } //namespace testing -} //namespace rttb diff --git a/testing/apps/DoseTool4V/files.cmake b/testing/apps/DoseTool4V/files.cmake deleted file mode 100644 index be2c22a..0000000 --- a/testing/apps/DoseTool4V/files.cmake +++ /dev/null @@ -1,10 +0,0 @@ -SET(CPP_FILES - ../../io/other/CompareDoseStatistic.cpp - DoseTool4VITKDoseTest.cpp - DoseTool4VVirtuosDoseTest.cpp - DoseTool4VTests.cpp - ) - -SET(H_FILES - ../../io/other/CompareDoseStatistic.h - ) diff --git a/testing/examples_virtuos/CMakeLists.txt b/testing/examples_virtuos/CMakeLists.txt deleted file mode 100644 index 28992c3..0000000 --- a/testing/examples_virtuos/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -#----------------------------------------------------------------------------- -# Setup the system information test. Write out some basic failsafe -# information in case the test doesn't run. -#----------------------------------------------------------------------------- - - -SET(VIRTUOS_TEST_EXAMPLES ${EXECUTABLE_OUTPUT_PATH}/rttbExamplesVirtuosTests) - -SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) - -SET(TEMP ${RTTBTesting_BINARY_DIR}/Temporary) - - -#----------------------------------------------------------------------------- - -ADD_TEST(RTDoseStatisticsVirtuosTest ${VIRTUOS_TEST_EXAMPLES} RTDoseStatisticsVirtuosTest -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.pln") - -RTTB_CREATE_TEST_MODULE(rttbExamplesVirtuos DEPENDS RTTBCore RTTBAlgorithms RTTBMasks RTTBBoostMask RTTBIndices RTTBDicomIO RTTBVirtuosIO RTTBITKIO RTTBOtherIO RTTBModels PACKAGE_DEPENDS Litmus) - diff --git a/testing/examples_virtuos/RTDoseStatisticsVirtuosTest.cpp b/testing/examples_virtuos/RTDoseStatisticsVirtuosTest.cpp deleted file mode 100644 index 55263df..0000000 --- a/testing/examples_virtuos/RTDoseStatisticsVirtuosTest.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// ----------------------------------------------------------------------- -// 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) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbDoseStatistics.h" -#include "rttbDoseStatisticsCalculator.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosFileStructureSetGenerator.h" -#include "rttbBoostMaskAccessor.h" -#include "rttbGenericMaskedDoseIterator.h" -#include "rttbGenericDoseIterator.h" -#include "rttbBaseType.h" - -namespace rttb -{ - namespace testing - { - - - /*! @brief RTDoseStatisticsTest. Max, min, mean, standard deviation, variance, Vx, Dx, MOHx, MOCx, MaxOHx, - MinOCx are tested. Test if calculation in new architecture returns similar results to the original implementation. - - WARNING: The values for comparison need to be adjusted if the input files are changed!*/ - - - int RTDoseStatisticsVirtuosTest(int argc, char* argv[]) - { - PREPARE_DEFAULT_TEST_REPORTING; - std::string RTDOSE_FILENAME; - std::string RTSTRUCT_FILENAME; - std::string RTPLAN_FILENAME; - - if (argc > 3) - { - RTDOSE_FILENAME = argv[1]; - RTSTRUCT_FILENAME = argv[2]; - RTPLAN_FILENAME = argv[3]; - } - else - { - std::cout << "at least three arguments required for RTDoseStatisticsVirtuosTest" << std::endl; - return -1; - } - - //Structure 2 is RUECKENMARK - typedef core::GenericDoseIterator::DoseIteratorPointer DoseIteratorPointer; - typedef core::GenericMaskedDoseIterator::MaskAccessorPointer MaskAccessorPointer; - typedef rttb::algorithms::DoseStatistics::DoseStatisticsPointer DoseStatisticsPointer; - typedef core::DoseIteratorInterface::DoseAccessorPointer DoseAccessorPointer; - typedef core::StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - typedef algorithms::DoseStatisticsCalculator::ResultListPointer ResultListPointer; - - DoseAccessorPointer virtuosDoseAccessor = io::virtuos::VirtuosPlanFileDoseAccessorGenerator( - RTDOSE_FILENAME.c_str(), - RTPLAN_FILENAME.c_str()).generateDoseAccessor(); - StructureSetPointer virtuosStructureSet = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), RTDOSE_FILENAME.c_str()).generateStructureSet(); - - boost::shared_ptr spMaskAccessorVirtuos = - boost::make_shared(virtuosStructureSet->getStructure(2), - virtuosDoseAccessor->getGeometricInfo()); - - spMaskAccessorVirtuos->updateMask(); - - MaskAccessorPointer spMaskAccessor(spMaskAccessorVirtuos); - - //create corresponding MaskedDoseIterator - - boost::shared_ptr spMaskedDoseIteratorTmp = - boost::make_shared(spMaskAccessor, virtuosDoseAccessor); - - DoseIteratorPointer spMaskedDoseIterator(spMaskedDoseIteratorTmp); - - rttb::algorithms::DoseStatisticsCalculator doseStatisticsCalculatorVirtuos(spMaskedDoseIterator); - - - DoseStatisticsPointer doseStatisticsVirtuos = - doseStatisticsCalculatorVirtuos.calculateDoseStatistics(true); - - //comparison values computed with "old" DoseStatistics implementation - CHECK_CLOSE(doseStatisticsVirtuos->getMinimum(), 6.4089, reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMaximum(), 39.0734, reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMean(), 22.5763, reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getStdDeviation(), 6.28916, reducedErrorConstant); - - ResultListPointer maxPositions = doseStatisticsVirtuos->getMaximumVoxelPositions(); - ResultListPointer minPositions = doseStatisticsVirtuos->getMinimumVoxelPositions(); - CHECK_EQUAL(maxPositions->size(), 1); - CHECK_EQUAL(minPositions->size(), 1); - CHECK_EQUAL(maxPositions->begin()->first, doseStatisticsVirtuos->getMaximum()); - CHECK_EQUAL(maxPositions->begin()->second, 3570772); - CHECK_EQUAL(minPositions->begin()->first, doseStatisticsVirtuos->getMinimum()); - CHECK_EQUAL(minPositions->begin()->second, 3571264); - - CHECK_CLOSE(doseStatisticsVirtuos->getDx(0.02 * doseStatisticsVirtuos->getVolume()), 31.8358, - reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getVx(0.9 * doseStatisticsVirtuos->getMaximum()), 0.471747, - reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMOHx(0.1 * doseStatisticsVirtuos->getVolume()), 31.3207, - reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMOCx(0.05 * doseStatisticsVirtuos->getVolume()), 9.01655, - reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMaxOHx(0.95 * doseStatisticsVirtuos->getVolume()), 10.3764, - reducedErrorConstant); - CHECK_CLOSE(doseStatisticsVirtuos->getMinOCx(0.98 * doseStatisticsVirtuos->getVolume()), 31.8373, - reducedErrorConstant); - - RETURN_AND_REPORT_TEST_SUCCESS; - - } - - }//testing -}//rttb diff --git a/testing/examples_virtuos/files.cmake b/testing/examples_virtuos/files.cmake deleted file mode 100644 index 7ee8b7a..0000000 --- a/testing/examples_virtuos/files.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -SET(CPP_FILES - RTDoseStatisticsVirtuosTest.cpp - rttbTestVirtuosExamples.cpp - ) - -SET(H_FILES - -) diff --git a/testing/examples_virtuos/rttbTestVirtuosExamples.cpp b/testing/examples_virtuos/rttbTestVirtuosExamples.cpp deleted file mode 100644 index 414ef44..0000000 --- a/testing/examples_virtuos/rttbTestVirtuosExamples.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// ----------------------------------------------------------------------- -// 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: 1512 $ (last changed revision) -// @date $Date: 2016-10-12 09:51:30 +0200 (Mi, 12 Okt 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 - { - void registerTests() - { - - LIT_REGISTER_TEST(RTDoseStatisticsVirtuosTest); - } - } -} - -int main(int argc, char* argv[]) -{ - int result = 0; - - rttb::testing::registerTests(); - - try - { - result = lit::multiTestsMain(argc, argv); - } - catch (const std::exception& /*e*/) - { - result = -1; - } - catch (...) - { - result = -1; - } - - return result; -} diff --git a/testing/io/CMakeLists.txt b/testing/io/CMakeLists.txt index 037709d..5b45928 100644 --- a/testing/io/CMakeLists.txt +++ b/testing/io/CMakeLists.txt @@ -1,27 +1,23 @@ MESSAGE (STATUS "Process All IO Tests...") #----------------------------------------------------------------------------- # Include sub directories #----------------------------------------------------------------------------- ADD_SUBDIRECTORY (other) IF(BUILD_IO_Dicom) ADD_SUBDIRECTORY(dicom) IF(BUILD_IO_HELAX) ADD_SUBDIRECTORY(helax) ENDIF(BUILD_IO_HELAX) ENDIF(BUILD_IO_Dicom) IF(BUILD_IO_ITK) ADD_SUBDIRECTORY(itk) ENDIF(BUILD_IO_ITK) IF(BUILD_All_Modules OR BUILD_Models) ADD_SUBDIRECTORY(models) ENDIF() - -IF(BUILD_IO_Virtuos) - ADD_SUBDIRECTORY(virtuos) -ENDIF(BUILD_IO_Virtuos) \ No newline at end of file diff --git a/testing/io/virtuos/CMakeLists.txt b/testing/io/virtuos/CMakeLists.txt deleted file mode 100644 index 3f79bd7..0000000 --- a/testing/io/virtuos/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -#----------------------------------------------------------------------------- -# Setup the system information test. Write out some basic failsafe -# information in case the test doesn't run. -#----------------------------------------------------------------------------- - - -SET(VIRTUOSIO_TEST ${EXECUTABLE_OUTPUT_PATH}/rttbVirtuosIOTests) - -SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) - -SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) - - -#----------------------------------------------------------------------------- -ADD_TEST(VirtuosDoseAccessorGeneratorTest ${VIRTUOSIO_TEST} VirtuosDoseAccessorGeneratorTest -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.pln" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz") - -ADD_TEST(VirtuosDoseIOTest ${VIRTUOSIO_TEST} VirtuosDoseIOTest -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.pln" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz") - -ADD_TEST(VirtuosStructureIOTest ${VIRTUOSIO_TEST} VirtuosStructureIOTest -"${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.vdx" "${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.ctx.gz" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.ctx.gz" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz") - -ADD_TEST(VirtuosStructureSetGeneratorTest ${VIRTUOSIO_TEST} VirtuosStructureSetGeneratorTest -"${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.vdx" "${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.ctx.gz" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" "${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.ctx.gz" -) - -#trip data -ADD_TEST(TripStructureIOTest ${VIRTUOSIO_TEST} TripStructureIOTest -"${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.vdx" "${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.ctx.gz" "${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030000.ctx" -"${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030101.dos.gz" "${TEST_DATA_ROOT}/Virtuos/NHHTrip/NHH030101.dos") - -ADD_TEST(TripDoseIOTest ${VIRTUOSIO_TEST} TripDoseIOTest -"${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030101.pln" "${TEST_DATA_ROOT}/Virtuos/NHH030/NHH030101.dos.gz" "${TEST_DATA_ROOT}/Virtuos/NHHTrip/NHH030101.dos") - -ADD_TEST(VirtuosDVHCalculatorExampleTest ${VIRTUOSIO_TEST} VirtuosDVHCalculatorExampleTest -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.dos.gz" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.vdx" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac101.pln" -"${TEST_DATA_ROOT}/Virtuos/prostate_ac/prostate_ac000.ctx.gz" ) - -RTTB_CREATE_TEST_MODULE(rttbVirtuosIO DEPENDS RTTBVirtuosIO RTTBMasks RTTBBoostMask PACKAGE_DEPENDS Boost Litmus VirtuosIO) - - diff --git a/testing/io/virtuos/TripDoseIOTest.cpp b/testing/io/virtuos/TripDoseIOTest.cpp deleted file mode 100644 index 23a981b..0000000 --- a/testing/io/virtuos/TripDoseIOTest.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbGeometricInfo.h" -#include "rttbDoseIteratorInterface.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbVirtuosFileStructureSetGenerator.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" -#include "../rttbDoseAccessorTester.h" - - -namespace rttb -{ - - namespace testing - { - - /*! @brief TripDoseIOTest - test the IO for virtuos data - 2) test virtuos dose import if geometric info was set correctly - 3) test trip dose import accessing dose data and converting - - Since the same class is used for the import of VIRTUOS structures, the constructors are - tested more thoroughly in VirtuosDoseIOTest. - - WARNING: The values for comparison need to be adjusted if the input files are changed! - - @see VirtuosDoseIOTest - - */ - - int TripDoseIOTest(int argc, char* argv[]) - { - typedef core::DoseIteratorInterface::DoseAccessorPointer DoseAccessorPointer; - - PREPARE_DEFAULT_TEST_REPORTING; - // 1: plan file name (virtuos) .../testing/data/Virtuos/NHH030101.pln - // 2: dose1 file name (virtuos) .../testing/data/Virtuos/NHH030101.dos.gz - // 3: dose2 file name (trip): .../testing/data/Virtuos/trip/NHH030101.dos - // WARNING: Test will fail if dose2 does not contain the same dose as dose1! - - std::string RTPLAN_FILENAME; - std::string RTDOSE_FILENAME; - std::string RTDOSE2_FILENAME; - - if (argc > 1) - { - RTPLAN_FILENAME = argv[1]; - } - - if (argc > 2) - { - RTDOSE_FILENAME = argv[2]; - } - - if (argc > 3) - { - RTDOSE2_FILENAME = argv[3]; - } - - - /* import VIRTUOS dose */ - io::virtuos::VirtuosPlanFileDoseAccessorGenerator doseAccessorGenerator1(RTDOSE_FILENAME.c_str(), - RTPLAN_FILENAME.c_str()); - boost::shared_ptr doseAccessor1 = - boost::static_pointer_cast - (doseAccessorGenerator1.generateDoseAccessor()); - - - //CHECK_EQUAL(76.0,spDoseAccessor1->getPrescribedDose()); - //CHECK_EQUAL(885.0,spDoseAccessor1->getNormalizationDose()); - - //2) test dose import if geometric info was set correctly - core::GeometricInfo geoInfo = doseAccessor1->getGeometricInfo(); - CHECK_EQUAL(256, geoInfo.getNumRows()); - CHECK_EQUAL(256, geoInfo.getNumColumns()); - CHECK_EQUAL(165, geoInfo.getNumSlices()); - CHECK_EQUAL(256 * 256 * 165, doseAccessor1->getGridSize()); - CHECK_EQUAL(OrientationMatrix(), geoInfo.getOrientationMatrix()); - - const VoxelGridID start = 0; - const VoxelGridIndex3D start3D(0); - - VoxelGridID end, inbetween; - VoxelGridIndex3D end3D, inbetween3D; - - //3) test dose import accessing dose data and converting - - CHECK_EQUAL(0, doseAccessor1->getValueAt(start)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(start3D)); - CHECK_EQUAL(doseAccessor1->getValueAt(start), doseAccessor1-> getValueAt(start3D)); - - inbetween = int(std::floor(doseAccessor1->getGridSize() / 2.0)); - doseAccessor1->getGeometricInfo().convert(inbetween, inbetween3D); - - CHECK_EQUAL(0, doseAccessor1->getValueAt(inbetween)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(inbetween3D)); - CHECK_EQUAL(doseAccessor1->getValueAt(inbetween), doseAccessor1-> getValueAt(inbetween3D)); - - end = doseAccessor1->getGridSize() - 1; - doseAccessor1->getGeometricInfo().convert(end, end3D); - - CHECK_EQUAL(0, doseAccessor1->getValueAt(end)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(end3D)); - CHECK_EQUAL(doseAccessor1->getValueAt(end), doseAccessor1-> getValueAt(end3D)); - - /* Dose without plan */ - io::virtuos::VirtuosDoseFileDoseAccessorGenerator doseAccessorGenerator2(RTDOSE2_FILENAME.c_str(), - doseAccessor1->getNormalizationDose(), - doseAccessor1->getPrescribedDose()); - boost::shared_ptr doseAccessor2 = - boost::static_pointer_cast - (doseAccessorGenerator2.generateDoseAccessor()); - - - CHECK_EQUAL(doseAccessor1->getPrescribedDose(), doseAccessor2->getPrescribedDose()); - CHECK_EQUAL(doseAccessor1->getNormalizationDose(), doseAccessor2->getNormalizationDose()); - - - //2) test dose import if geometric info was set correctly - core::GeometricInfo geoInfo2 = doseAccessor2->getGeometricInfo(); - CHECK_EQUAL(geoInfo.getNumRows(), geoInfo2.getNumRows()); - CHECK_EQUAL(geoInfo.getNumColumns(), geoInfo2.getNumColumns()); - CHECK_EQUAL(geoInfo.getNumSlices(), geoInfo2.getNumSlices()); - CHECK_EQUAL(doseAccessor1->getGridSize(), doseAccessor2->getGridSize()); - CHECK_EQUAL(geoInfo.getOrientationMatrix(), geoInfo2.getOrientationMatrix()); - - //3) test dose import accessing dose data and converting - - CHECK_EQUAL(doseAccessor1->getValueAt(start), doseAccessor2->getValueAt(start)); - CHECK_EQUAL(doseAccessor1-> getValueAt(start3D), doseAccessor2-> getValueAt(start3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(start), doseAccessor2-> getValueAt(start3D)); - - inbetween = int(std::floor(doseAccessor2->getGridSize() / 2.0)); - doseAccessor2->getGeometricInfo().convert(inbetween, inbetween3D); - - CHECK_EQUAL(doseAccessor1->getValueAt(inbetween), doseAccessor2->getValueAt(inbetween)); - CHECK_EQUAL(doseAccessor1-> getValueAt(inbetween3D), doseAccessor2-> getValueAt(inbetween3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(inbetween), doseAccessor2-> getValueAt(inbetween3D)); - - end = doseAccessor2->getGridSize() - 1; - doseAccessor2->getGeometricInfo().convert(end, end3D); - - CHECK_EQUAL(doseAccessor1->getValueAt(end), doseAccessor2->getValueAt(end)); - CHECK_EQUAL(doseAccessor1-> getValueAt(end3D), doseAccessor2-> getValueAt(end3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(end), doseAccessor2-> getValueAt(end3D)); - - /* Import Trip dose */ - io::virtuos::VirtuosDoseFileDoseAccessorGenerator doseAccessorGenerator3(RTDOSE2_FILENAME.c_str(), - doseAccessor1->getNormalizationDose(), - doseAccessor1->getPrescribedDose()); - boost::shared_ptr doseAccessor3 = - boost::static_pointer_cast - (doseAccessorGenerator3.generateDoseAccessor()); - - CHECK_EQUAL(doseAccessor1->getPrescribedDose(), doseAccessor3->getPrescribedDose()); - CHECK_EQUAL(doseAccessor1->getNormalizationDose(), doseAccessor3->getNormalizationDose()); - - - //2) test dose import if geometric info was set correctly - core::GeometricInfo geoInfo3 = doseAccessor3->getGeometricInfo(); - CHECK_EQUAL(geoInfo.getNumRows(), geoInfo3.getNumRows()); - CHECK_EQUAL(geoInfo.getNumColumns(), geoInfo3.getNumColumns()); - CHECK_EQUAL(geoInfo.getNumSlices(), geoInfo3.getNumSlices()); - CHECK_EQUAL(doseAccessor1->getGridSize(), doseAccessor3->getGridSize()); - CHECK_EQUAL(geoInfo.getOrientationMatrix(), geoInfo3.getOrientationMatrix()); - - //3) test dose import accessing dose data and converting - - CHECK_EQUAL(doseAccessor1->getValueAt(start), doseAccessor3->getValueAt(start)); - CHECK_EQUAL(doseAccessor1-> getValueAt(start3D), doseAccessor3-> getValueAt(start3D)); - CHECK_EQUAL(doseAccessor3->getValueAt(start), doseAccessor3-> getValueAt(start3D)); - - inbetween = int(std::floor(doseAccessor3->getGridSize() / 2.0)); - doseAccessor3->getGeometricInfo().convert(inbetween, inbetween3D); - - CHECK_EQUAL(doseAccessor1->getValueAt(inbetween), doseAccessor3->getValueAt(inbetween)); - CHECK_EQUAL(doseAccessor1-> getValueAt(inbetween3D), doseAccessor3-> getValueAt(inbetween3D)); - CHECK_EQUAL(doseAccessor3->getValueAt(inbetween), doseAccessor3-> getValueAt(inbetween3D)); - - io::virtuos::VirtuosPlanFileDoseAccessorGenerator doseAccessorGenerator4(RTDOSE2_FILENAME.c_str(), - RTPLAN_FILENAME.c_str()); - boost::shared_ptr spDoseAccessor4 = - boost::static_pointer_cast - (doseAccessorGenerator4.generateDoseAccessor()); - DoseAccessorPointer doseAccessor4(spDoseAccessor4); - - DoseAccessorTester doseCompare(doseAccessor1, doseAccessor2); - CHECK_TESTER(doseCompare); - - DoseAccessorTester doseCompare2(doseAccessor3, doseAccessor4); - CHECK_TESTER(doseCompare2); - - DoseAccessorTester doseCompare3(doseAccessor1, doseAccessor3); - CHECK_TESTER(doseCompare3); - - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/TripStructureIOTest.cpp b/testing/io/virtuos/TripStructureIOTest.cpp deleted file mode 100644 index 8a8cb45..0000000 --- a/testing/io/virtuos/TripStructureIOTest.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbGeometricInfo.h" -#include "rttbDoseIteratorInterface.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbVirtuosFileStructureSetGenerator.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - - -namespace rttb -{ - - namespace testing - { - - /*! @brief TripStructureIOTest - test the IO for virtuos data - 1) test virtuos structure import - - Since the same class is used for the import of VIRTUOS structures, the constructors are - tested more thoroughly in VirtuosStructureIOTest. - - WARNING: The values for comparison need to be adjusted if the input files are changed! - - @see VirtuosStructureIOTest - - @todo Test is sucessful for import in any CT (ctx) and on virtuos doses. - import on trip dose file will be handled by a new issue. Preliminary code can be found - at the end of this file. - */ - - int TripStructureIOTest(int argc, char* argv[]) - { - typedef core::StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - typedef core::StructureSet::StructTypePointer StructTypePointer; - - PREPARE_DEFAULT_TEST_REPORTING; - //ARGUMENTS: 1: structure file name ".../testing/data/Virtuos/NHH030000.vdx" - // 2: ctx file name (virtuos) ".../testing/data/Virtuos/NHH030000.ctx.gz" - // 3: ctx file name (trip) ".../testing/data/Virtuos/NHH030000.ctx" - // 4: dose file name (virtuos) ".../testing/data/Virtuos/NHH030101.dos.gz" - // 5: dose file name (trip) ".../testing/data/Virtuos/NHH030101.dos" - - /*! @todo provide an adequate number of test data. Does not work with other test data currently provided. */ - - std::string RTSTRUCT_FILENAME; - std::string CT_FILENAME; - std::string CT_FILENAME_TRIP; - std::string DOSE_FILENAME; - std::string DOSE_FILENAME_TRIP; - - if (argc > 1) - { - RTSTRUCT_FILENAME = argv[1]; - } - - if (argc > 2) - { - CT_FILENAME = argv[2]; - } - - if (argc > 3) - { - CT_FILENAME_TRIP = argv[3]; - } - - if (argc > 4) - { - DOSE_FILENAME = argv[4]; - } - - if (argc > 5) - { - DOSE_FILENAME_TRIP = argv[5]; - } - - /* structure set */ - StructureSetPointer rtStructureSet = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), CT_FILENAME.c_str()).generateStructureSet(); - //1) test structure import - CHECK_EQUAL(1, rtStructureSet->getNumberOfStructures()); - - CHECK_EQUAL("TARGET_1", (rtStructureSet->getStructure(0))->getLabel()); - - core::Structure myStructure = *(rtStructureSet->getStructure(0)); - CHECK_EQUAL(320, myStructure.getNumberOfEndpoints()); - - PolygonSequenceType myPolygonSeq = myStructure.getStructureVector(); - CHECK_EQUAL(8, myPolygonSeq.size()); - - PolygonType myPolygon = myPolygonSeq.at(0); - - CHECK_CLOSE(125.975, myPolygon.at(0).x(), errorConstant); - CHECK_CLOSE(118.120, myPolygon.at(0).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(0).z(), errorConstant); - - CHECK_CLOSE(124.487, myPolygon.at(1).x(), errorConstant); - CHECK_CLOSE(118.477, myPolygon.at(1).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(1).z(), errorConstant); - - CHECK_CLOSE(117.870, myPolygon.at(10).x(), errorConstant); - CHECK_CLOSE(129.275, myPolygon.at(10).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(10).z(), errorConstant); - - CHECK_CLOSE(129.025, myPolygon.at(20).x(), errorConstant); - CHECK_CLOSE(137.380, myPolygon.at(20).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(20).z(), errorConstant); - - CHECK_CLOSE(127.5, myPolygon.at(myPolygon.size() - 1).x(), errorConstant); - CHECK_CLOSE(118, myPolygon.at(myPolygon.size() - 1).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(myPolygon.size() - 1).z(), errorConstant); - - //The original Virtuos contours are closed (last point = 1st point), but the ones used here do not have this double point. - - - /* structure set on trip */ - StructureSetPointer rtStructureSet2 = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), CT_FILENAME_TRIP.c_str()).generateStructureSet(); - //1) test structure import - CHECK_EQUAL(1, rtStructureSet2->getNumberOfStructures()); - CHECK_EQUAL(rtStructureSet2->getNumberOfStructures(), rtStructureSet2->getNumberOfStructures()); - - CHECK_EQUAL("TARGET_1", (rtStructureSet2->getStructure(0))->getLabel()); - - for (int s = 0; s < rtStructureSet2->getNumberOfStructures(); s++) - { - CHECK_EQUAL((rtStructureSet->getStructure(s))->getLabel(), - (rtStructureSet2->getStructure(s))->getLabel()); - - core::Structure myStructure2 = *(rtStructureSet2->getStructure(s)); - core::Structure myStructure1c = *(rtStructureSet->getStructure(s)); - CHECK_EQUAL(myStructure1c.getNumberOfEndpoints(), myStructure2.getNumberOfEndpoints()); - PolygonSequenceType myPolygonSeq2 = myStructure2.getStructureVector(); - PolygonSequenceType myPolygonSeq1c = myStructure2.getStructureVector(); - CHECK_EQUAL(myPolygonSeq1c.size(), myPolygonSeq2.size()); - - for (int ps = 0; ps < myPolygonSeq2.size(); ps++) - { - PolygonType myPolygon1c = myPolygonSeq1c.at(ps); - PolygonType myPolygon2 = myPolygonSeq2.at(ps); - CHECK_CLOSE(myPolygon1c.at(0).x(), myPolygon2.at(0).x(), errorConstant); - CHECK_CLOSE(myPolygon1c.at(0).y(), myPolygon2.at(0).y(), errorConstant); - CHECK_CLOSE(myPolygon1c.at(0).z(), myPolygon2.at(0).z(), errorConstant); - } - } - - /* structure set on dose */ - StructureSetPointer rtStructureSet3 = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), DOSE_FILENAME.c_str()).generateStructureSet(); - //1) test structure import, should be equal to structure imported on CT-image - CHECK_EQUAL(1, rtStructureSet3->getNumberOfStructures()); - CHECK_EQUAL(rtStructureSet2->getNumberOfStructures(), rtStructureSet3->getNumberOfStructures()); - - CHECK_EQUAL("TARGET_1", (rtStructureSet3->getStructure(0))->getLabel()); - - for (int s = 0; s < rtStructureSet3->getNumberOfStructures(); s++) - { - CHECK_EQUAL((rtStructureSet3->getStructure(s))->getLabel(), - (rtStructureSet3->getStructure(s))->getLabel()); - - core::Structure myStructure3 = *(rtStructureSet3->getStructure(s)); - core::Structure myStructure2c = *(rtStructureSet2->getStructure(s)); - CHECK_EQUAL(myStructure2c.getNumberOfEndpoints(), myStructure3.getNumberOfEndpoints()); - PolygonSequenceType myPolygonSeq3 = myStructure3.getStructureVector(); - PolygonSequenceType myPolygonSeq2c = myStructure3.getStructureVector(); - CHECK_EQUAL(myPolygonSeq2c.size(), myPolygonSeq3.size()); - - for (int ps = 0; ps < myPolygonSeq3.size(); ps++) - { - PolygonType myPolygon2c = myPolygonSeq2c.at(ps); - PolygonType myPolygon3 = myPolygonSeq3.at(ps); - CHECK_CLOSE(myPolygon2c.at(0).x(), myPolygon3.at(0).x(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).y(), myPolygon3.at(0).y(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).z(), myPolygon3.at(0).z(), errorConstant); - } - } - - /* structure set on trip dose*/ - /* @todo loading structure fails currently keep code and fix in seperate issue*/ - StructureSetPointer rtStructureSet4 = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), DOSE_FILENAME_TRIP.c_str()).generateStructureSet(); - //1) test structure import, should be equal to structure imported on CT-image - CHECK_EQUAL(1, rtStructureSet4->getNumberOfStructures()); - CHECK_EQUAL(rtStructureSet2->getNumberOfStructures(), rtStructureSet4->getNumberOfStructures()); - - CHECK_EQUAL("TARGET_1", (rtStructureSet4->getStructure(0))->getLabel()); - - int s = 0; - - core::Structure myStructure4 = *(rtStructureSet4->getStructure(s)); - core::Structure myStructure2c = *(rtStructureSet2->getStructure(s)); - CHECK_EQUAL(myStructure2c.getNumberOfEndpoints(), myStructure4.getNumberOfEndpoints()); - PolygonSequenceType myPolygonSeq4 = myStructure4.getStructureVector(); - PolygonSequenceType myPolygonSeq2c = myStructure2c.getStructureVector(); - CHECK_EQUAL(myPolygonSeq2c.size(), myPolygonSeq4.size()); - - for (int ps = 0; ps < myPolygonSeq4.size(); ps++) - { - PolygonType myPolygon2c = myPolygonSeq2c.at(ps); - PolygonType myPolygon4 = myPolygonSeq4.at(ps); - CHECK_CLOSE(myPolygon2c.at(0).x(), myPolygon4.at(0).x(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).y(), myPolygon4.at(0).y(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).z(), myPolygon4.at(0).z(), errorConstant); - } - - /**/ - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/VirtuosDVHCalculatorExampleTest.cpp b/testing/io/virtuos/VirtuosDVHCalculatorExampleTest.cpp deleted file mode 100644 index 0e69a59..0000000 --- a/testing/io/virtuos/VirtuosDVHCalculatorExampleTest.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbDVHCalculator.h" -#include "rttbGenericMaskedDoseIterator.h" -#include "rttbGenericDoseIterator.h" -#include "rttbBoostMaskAccessor.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbVirtuosFileStructureSetGenerator.h" - - -namespace rttb -{ - - namespace testing - { - - /*! @brief VirtuosDVHCalculatorExampleTest. - Test if calculation in new architecture returns similar results to the - original implementation. - - WARNING: The values for comparison need to be adjusted if the input files are changed! - */ - - int VirtuosDVHCalculatorExampleTest(int argc, char* argv[]) - { - typedef core::GenericDoseIterator::DoseAccessorPointer DoseAccessorPointer; - typedef core::GenericMaskedDoseIterator::MaskAccessorPointer MaskAccessorPointer; - typedef core::DVHCalculator::DoseIteratorPointer DoseIteratorPointer; - typedef masks::boost::BoostMaskAccessor::StructTypePointer StructTypePointer; - typedef core::DVH::DVHPointer DVHPointer; - typedef core::StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - - PREPARE_DEFAULT_TEST_REPORTING; - //ARGUMENTS: 1: virtuos dose file name - // 2: virtuos structure file name - // 3: virtuos plan file name - // 4: virtuos CT file name - - std::string Virtuos_Dose_File; - std::string Virtuos_Structure_File; - std::string Virtuos_Plan_File; - std::string Virtuos_CT_File; - - if (argc > 4) - { - Virtuos_Dose_File = argv[1]; - Virtuos_Structure_File = argv[2]; - Virtuos_Plan_File = argv[3]; - Virtuos_CT_File = argv[4]; - } - - - //Virtuos DVH Test - - io::virtuos::VirtuosPlanFileDoseAccessorGenerator doseAccessorGeneratorVirtuos(Virtuos_Dose_File, - Virtuos_Plan_File); - DoseAccessorPointer doseAccessorVirtuos(doseAccessorGeneratorVirtuos.generateDoseAccessor()); - - StructureSetPointer rtStructureSetVirtuos = io::virtuos::VirtuosFileStructureSetGenerator( - Virtuos_Structure_File, Virtuos_CT_File).generateStructureSet(); - - - //create MaskAccessor for structure DARM - boost::shared_ptr spMaskAccessorVirtuos = - boost::make_shared(rtStructureSetVirtuos->getStructure(4), - doseAccessorVirtuos->getGeometricInfo()); - - spMaskAccessorVirtuos->updateMask(); - - MaskAccessorPointer spMaskAccessor(spMaskAccessorVirtuos); - - //create corresponding MaskedDoseIterator - - boost::shared_ptr spMaskedDoseIteratorTmp = - boost::make_shared(spMaskAccessor, doseAccessorVirtuos); - - DoseIteratorPointer spMaskedDoseIterator(spMaskedDoseIteratorTmp); - - rttb::core::DVHCalculator* calc; - CHECK_NO_THROW(calc = new rttb::core::DVHCalculator(spMaskedDoseIterator, - (rtStructureSetVirtuos->getStructure(4))->getUID(), doseAccessorVirtuos->getUID())); - - DVHPointer dvhPtr; - CHECK_NO_THROW(dvhPtr = calc->generateDVH()); - - CHECK_CLOSE(4.08178, dvhPtr->getMaximum(), errorConstant); - CHECK_CLOSE(0.0151739, dvhPtr->getMinimum(), errorConstant); - CHECK_CLOSE(0.755357, dvhPtr->getMean(), errorConstant); - CHECK_CLOSE(0.440044, dvhPtr->getMedian(), errorConstant); - CHECK_CLOSE(0.0151739, dvhPtr->getModal(), errorConstant); - CHECK_CLOSE(0.835792, dvhPtr->getStdDeviation(), errorConstant); - CHECK_CLOSE(0.698549, dvhPtr->getVariance(), errorConstant); - //reduced error constant because values differ with boost versions - CHECK_CLOSE(46572.03509, dvhPtr->getNumberOfVoxels(), 0.01); - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/VirtuosDoseAccessorGeneratorTest.cpp b/testing/io/virtuos/VirtuosDoseAccessorGeneratorTest.cpp deleted file mode 100644 index e96185c..0000000 --- a/testing/io/virtuos/VirtuosDoseAccessorGeneratorTest.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbVirtuosCubeinfoDoseAccessorGenerator.h" -#include "rttbVirtuosDoseFileDoseAccessorGenerator.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "../rttbDoseAccessorTester.h" - - -namespace rttb -{ - - namespace testing - { - - /*! @brief VirtuosDoseAccessorGeneratorTest - test the accessor generator generateDoseAccessor() of virtuos data - 1) test virtuos accessor generator with only dose file - 2) test virtuos accessor generator with dose and plan file - 3) test virtuos accessor generator with cubeinfo - */ - - int VirtuosDoseAccessorGeneratorTest(int argc, char* argv[]) - { - - PREPARE_DEFAULT_TEST_REPORTING; - // 1: plan file name (virtuos) .../testing/data/Virtuos/prostate_ac/prostate_ac101.pln - // 2: dose1 file name (virtuos) .../testing/data/Virtuos/prostate_ac/prostate_ac101.dos.gz - - std::string RTPLAN_FILENAME; - std::string RTDOSE_FILENAME; - - if (argc > 2) - { - RTPLAN_FILENAME = argv[1]; - RTDOSE_FILENAME = argv[2]; - } - - //1) test virtuos accessor generator with only dose file - CHECK_NO_THROW(io::virtuos::VirtuosDoseFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), 0, - 0).generateDoseAccessor()); - CHECK_THROW_EXPLICIT( - io::virtuos::VirtuosDoseFileDoseAccessorGenerator("test.dos.gz", 0, 0).generateDoseAccessor(), - core::InvalidParameterException); - - - - //2) test virtuos accessor generator with dose and plan file - CHECK_NO_THROW(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), "")); - CHECK_NO_THROW(io::virtuos::VirtuosPlanFileDoseAccessorGenerator("myDose.dos.gz", - RTPLAN_FILENAME.c_str())); - - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), - "").generateDoseAccessor(), core::InvalidParameterException); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator("", - RTPLAN_FILENAME.c_str()).generateDoseAccessor(), core::InvalidParameterException); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), - "myPlanfile.pln").generateDoseAccessor(), core::InvalidParameterException); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator("myDose.dos.gz", - RTPLAN_FILENAME.c_str()).generateDoseAccessor(), core::InvalidParameterException); - - CHECK_NO_THROW(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), - RTPLAN_FILENAME.c_str()).generateDoseAccessor()); - - - std::string testFileName = RTPLAN_FILENAME; - size_t gzPosition = testFileName.find(".pln"); - - if (gzPosition != std::string::npos) - { - testFileName.erase(gzPosition, testFileName.length()); - } - - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(RTDOSE_FILENAME.c_str(), - testFileName).generateDoseAccessor(), core::InvalidParameterException); - - testFileName = RTDOSE_FILENAME; - gzPosition = testFileName.find(".dos"); - - if (gzPosition != std::string::npos) - { - testFileName.erase(gzPosition, testFileName.length()); - } - - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosPlanFileDoseAccessorGenerator(testFileName, - RTPLAN_FILENAME.c_str()).generateDoseAccessor(), core::InvalidParameterException); - - //3) test virtuos accessor generator with cubeinfo - Cubeinfo** pPointerOnVirtuosCube = new Cubeinfo*; - *pPointerOnVirtuosCube = create_cubeinfo(0); - CHECK_NO_THROW(io::virtuos::VirtuosCubeinfoDoseAccessorGenerator(*pPointerOnVirtuosCube)); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosCubeinfoDoseAccessorGenerator( - *pPointerOnVirtuosCube).generateDoseAccessor(), core::InvalidDoseException); - - nc_init_cubeinfo(*pPointerOnVirtuosCube); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosCubeinfoDoseAccessorGenerator( - *pPointerOnVirtuosCube).generateDoseAccessor(), core::InvalidDoseException); - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/VirtuosDoseIOTest.cpp b/testing/io/virtuos/VirtuosDoseIOTest.cpp deleted file mode 100644 index 8e0be12..0000000 --- a/testing/io/virtuos/VirtuosDoseIOTest.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbGeometricInfo.h" -#include "rttbDoseIteratorInterface.h" -#include "rttbVirtuosCubeinfoDoseAccessorGenerator.h" -#include "rttbVirtuosDoseFileDoseAccessorGenerator.h" -#include "rttbVirtuosPlanFileDoseAccessorGenerator.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" -#include "../rttbDoseAccessorTester.h" - - -namespace rttb -{ - - namespace testing - { - - /*! @brief VirtuosDoseIOTest - test the IO for virtuos data - 1) test getPrescribedDose() and getNormalizationDose() - 2) test virtuos dose import if geometric info was set correctly - 3) test virtuos dose import accessing dose data and converting - - WARNING: The values for comparison need to be adjusted if the input files are changed! - */ - - int VirtuosDoseIOTest(int argc, char* argv[]) - { - typedef core::DoseIteratorInterface::DoseAccessorPointer DoseAccessorPointer; - - PREPARE_DEFAULT_TEST_REPORTING; - // 1: plan file name (virtuos) .../testing/data/Virtuos/prostate_ac/prostate_ac101.pln - // 2: dose1 file name (virtuos) .../testing/data/Virtuos/prostate_ac/prostate_ac101.dos.gz - - std::string RTPLAN_FILENAME; - std::string RTDOSE_FILENAME; - - if (argc > 2) - { - RTPLAN_FILENAME = argv[1]; - RTDOSE_FILENAME = argv[2]; - } - - //1) test getPrescribedDose() and getNormalizationDose() - - io::virtuos::VirtuosDoseFileDoseAccessorGenerator doseAccessorGeneratorTest3( - RTDOSE_FILENAME.c_str(), 885.0, 76.0); - boost::shared_ptr virtuosTest3 = - boost::static_pointer_cast - (doseAccessorGeneratorTest3.generateDoseAccessor()); - CHECK_EQUAL(76.0, virtuosTest3->getPrescribedDose()); - CHECK_EQUAL(885.0, virtuosTest3->getNormalizationDose()); - - io::virtuos::VirtuosDoseFileDoseAccessorGenerator doseAccessorGeneratorTest4( - RTDOSE_FILENAME.c_str(), 0, 0); - boost::shared_ptr virtuosTest4 = - boost::static_pointer_cast - (doseAccessorGeneratorTest4.generateDoseAccessor()); - CHECK_EQUAL(1, virtuosTest4->getPrescribedDose()); - CHECK_EQUAL(1, virtuosTest4->getNormalizationDose()); - - io::virtuos::VirtuosPlanFileDoseAccessorGenerator doseAccessorGenerator1(RTDOSE_FILENAME.c_str(), - RTPLAN_FILENAME.c_str()); - boost::shared_ptr doseAccessor1 = - boost::static_pointer_cast - (doseAccessorGenerator1.generateDoseAccessor()); - - CHECK_EQUAL(76.0, doseAccessor1->getPrescribedDose()); - CHECK_EQUAL(885.0, doseAccessor1->getNormalizationDose()); - - //2) test dose import if geometric info was set correctly - core::GeometricInfo geoInfo = doseAccessor1->getGeometricInfo(); - CHECK_EQUAL(256, geoInfo.getNumRows()); - CHECK_EQUAL(256, geoInfo.getNumColumns()); - CHECK_EQUAL(144, geoInfo.getNumSlices()); - CHECK_EQUAL(256 * 256 * 144, doseAccessor1->getGridSize()); - CHECK_EQUAL(OrientationMatrix(), geoInfo.getOrientationMatrix()); - - const VoxelGridID start = 0; - const VoxelGridIndex3D start3D(0); - - VoxelGridID end, inbetween; - VoxelGridIndex3D end3D, inbetween3D; - - //3) test dose import accessing dose data and converting - - CHECK_EQUAL(0, doseAccessor1->getValueAt(start)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(start3D)); - - inbetween = int(doseAccessor1->getGridSize() / 2.0); - doseAccessor1->getGeometricInfo().convert(inbetween, inbetween3D); - - CHECK_EQUAL(0, doseAccessor1->getValueAt(inbetween)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(inbetween3D)); - - end = doseAccessor1->getGridSize() - 1; - doseAccessor1->getGeometricInfo().convert(end, end3D); - - CHECK_EQUAL(0, doseAccessor1->getValueAt(end)); - CHECK_EQUAL(0, doseAccessor1-> getValueAt(end3D)); - - /* Dose without plan */ - io::virtuos::VirtuosDoseFileDoseAccessorGenerator doseAccessorGenerator2(RTDOSE_FILENAME.c_str(), - doseAccessor1->getNormalizationDose(), - doseAccessor1->getPrescribedDose()); - boost::shared_ptr doseAccessor2 = - boost::static_pointer_cast - (doseAccessorGenerator2.generateDoseAccessor()); - - CHECK_EQUAL(doseAccessor1->getPrescribedDose(), doseAccessor2->getPrescribedDose()); - CHECK_EQUAL(doseAccessor1->getNormalizationDose(), doseAccessor2->getNormalizationDose()); - - - //2) test dose import if geometric info was set correctly - core::GeometricInfo geoInfo2 = doseAccessor2->getGeometricInfo(); - CHECK_EQUAL(geoInfo.getNumRows(), geoInfo2.getNumRows()); - CHECK_EQUAL(geoInfo.getNumColumns(), geoInfo2.getNumColumns()); - CHECK_EQUAL(geoInfo.getNumSlices(), geoInfo2.getNumSlices()); - CHECK_EQUAL(doseAccessor1->getGridSize(), doseAccessor2->getGridSize()); - CHECK_EQUAL(geoInfo.getOrientationMatrix(), geoInfo2.getOrientationMatrix()); - - //3) test dose import accessing dose data and converting - - CHECK_EQUAL(doseAccessor1->getValueAt(start), doseAccessor2->getValueAt(start)); - CHECK_EQUAL(doseAccessor1-> getValueAt(start3D), doseAccessor2-> getValueAt(start3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(start), doseAccessor2-> getValueAt(start3D)); - - inbetween = int(doseAccessor2->getGridSize() / 2.0); - doseAccessor2->getGeometricInfo().convert(inbetween, inbetween3D); - - CHECK_EQUAL(doseAccessor1->getValueAt(inbetween), doseAccessor2->getValueAt(inbetween)); - CHECK_EQUAL(doseAccessor1-> getValueAt(inbetween3D), doseAccessor2-> getValueAt(inbetween3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(inbetween), doseAccessor2-> getValueAt(inbetween3D)); - - end = doseAccessor2->getGridSize() - 1; - doseAccessor2->getGeometricInfo().convert(end, end3D); - - CHECK_EQUAL(doseAccessor1->getValueAt(end), doseAccessor2->getValueAt(end)); - CHECK_EQUAL(doseAccessor1-> getValueAt(end3D), doseAccessor2-> getValueAt(end3D)); - CHECK_EQUAL(doseAccessor2->getValueAt(end), doseAccessor2-> getValueAt(end3D)); - - - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/VirtuosStructureIOTest.cpp b/testing/io/virtuos/VirtuosStructureIOTest.cpp deleted file mode 100644 index e74c80b..0000000 --- a/testing/io/virtuos/VirtuosStructureIOTest.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbGeometricInfo.h" -#include "rttbDoseIteratorInterface.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbVirtuosFileStructureSetGenerator.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - - -namespace rttb -{ - - namespace testing - { - - /*!@brief VirtuosIOTest - test the IO for virtuos data - 1) test virtuos structure import - - WARNING: The values for comparison need to be adjusted if the input files are changed! - */ - - int VirtuosStructureIOTest(int argc, char* argv[]) - { - typedef core::StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - - PREPARE_DEFAULT_TEST_REPORTING; - //ARGUMENTS: 1: structure file name ".../testing/data/Virtuos/NHH030000.vdx" - // 2: ctx file name (virtuos) ".../testing/data/Virtuos/NHH030000.ctx.gz" - // 3: structure file name ".../testing/data/Virtuos/prostate_ac/prostate_ac000.vdx" - // 4: ctx file name (virtuos) ".../testing/data/Virtuos/prostate_ac/prostate_ac000.ctx.gz" - // 5: dos file name (virtuos) ".../testing/data/ Virtuos/prostate_ac/prostate_ac101.dos.gz" - - /*! @todo provide a adequate number of test data. Does not work with other test data currently provided. Structures are not loaded! */ - - std::string RTSTRUCT_FILENAME; - std::string RTSTRUCT_FILENAME2; - std::string CT_FILENAME; - std::string CT_FILENAME2; - std::string DOSE_FILENAME; - - if (argc > 1) - { - RTSTRUCT_FILENAME = argv[1]; - } - - if (argc > 2) - { - CT_FILENAME = argv[2]; - } - - if (argc > 3) - { - RTSTRUCT_FILENAME2 = argv[3]; - } - - if (argc > 4) - { - CT_FILENAME2 = argv[4]; - } - - if (argc > 5) - { - DOSE_FILENAME = argv[5]; - } - - /* structure set */ - - StructureSetPointer rtStructureSet = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME.c_str(), CT_FILENAME.c_str()).generateStructureSet(); - //2) test structure import - CHECK_EQUAL(1, rtStructureSet->getNumberOfStructures()); - - CHECK_EQUAL("TARGET_1", (rtStructureSet->getStructure(0))->getLabel()); - - core::Structure myStructure = *(rtStructureSet->getStructure(0)); - CHECK_EQUAL(320, myStructure.getNumberOfEndpoints()); - - PolygonSequenceType myPolygonSeq = myStructure.getStructureVector(); - CHECK_EQUAL(8, myPolygonSeq.size()); - - PolygonType myPolygon = myPolygonSeq.at(0); - - CHECK_CLOSE(125.975, myPolygon.at(0).x(), errorConstant); - CHECK_CLOSE(118.120, myPolygon.at(0).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(0).z(), errorConstant); - - CHECK_CLOSE(124.487, myPolygon.at(1).x(), errorConstant); - CHECK_CLOSE(118.477, myPolygon.at(1).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(1).z(), errorConstant); - - CHECK_CLOSE(117.870, myPolygon.at(10).x(), errorConstant); - CHECK_CLOSE(129.275, myPolygon.at(10).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(10).z(), errorConstant); - - CHECK_CLOSE(129.025, myPolygon.at(20).x(), errorConstant); - CHECK_CLOSE(137.380, myPolygon.at(20).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(20).z(), errorConstant); - - CHECK_CLOSE(127.5, myPolygon.at(myPolygon.size() - 1).x(), errorConstant); - CHECK_CLOSE(118, myPolygon.at(myPolygon.size() - 1).y(), errorConstant); - CHECK_CLOSE(121.000, myPolygon.at(myPolygon.size() - 1).z(), errorConstant); - //The original Virtuos contours are closed (last point = 1st point), but the ones used here do not have this double point. - - - /* structure set2 */ - StructureSetPointer rtStructureSet2 = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME2.c_str(), CT_FILENAME2.c_str()).generateStructureSet(); - //2) test structure import - CHECK_EQUAL(9, rtStructureSet2->getNumberOfStructures()); - - CHECK_EQUAL("BLASE", (rtStructureSet2->getStructure(0))->getLabel()); - CHECK_EQUAL("HUEFTK_LINKS", (rtStructureSet2->getStructure(3))->getLabel()); - CHECK_EQUAL("RAND", (rtStructureSet2->getStructure(5))->getLabel()); - CHECK_EQUAL("PTV", (rtStructureSet2->getStructure(8))->getLabel()); - - core::Structure myStructure2 = *(rtStructureSet2->getStructure(8)); - CHECK_EQUAL(1653, myStructure2.getNumberOfEndpoints()); - - PolygonSequenceType myPolygonSeq2 = myStructure2.getStructureVector(); - CHECK_EQUAL(27, myPolygonSeq2.size()); - - PolygonType myPolygon2 = myPolygonSeq2.at(0); - CHECK_CLOSE(244.511, myPolygon2.at(0).x(), errorConstant); - CHECK_CLOSE(215.215, myPolygon2.at(0).y(), errorConstant); - CHECK_CLOSE(149, myPolygon2.at(0).z(), errorConstant); - - CHECK_CLOSE(242.192, myPolygon2.at(1).x(), errorConstant); - CHECK_CLOSE(215.215, myPolygon2.at(1).y(), errorConstant); - CHECK_CLOSE(149, myPolygon2.at(1).z(), errorConstant); - - CHECK_CLOSE(221.318, myPolygon2.at(10).x(), errorConstant); - CHECK_CLOSE(225.347, myPolygon2.at(10).y(), errorConstant); - CHECK_CLOSE(149, myPolygon2.at(10).z(), errorConstant); - - CHECK_CLOSE(220.098, myPolygon2.at(20).x(), errorConstant); - CHECK_CLOSE(239.873, myPolygon2.at(20).y(), errorConstant); - CHECK_CLOSE(149, myPolygon2.at(20).z(), errorConstant); - - CHECK_CLOSE(245.854, myPolygon2.at(myPolygon2.size() - 1).x(), errorConstant); - CHECK_CLOSE(215.581, myPolygon2.at(myPolygon2.size() - 1).y(), errorConstant); - CHECK_CLOSE(149, myPolygon2.at(myPolygon2.size() - 1).z(), errorConstant); - - /* structure set2 on dose */ - StructureSetPointer rtStructureSet3 = io::virtuos::VirtuosFileStructureSetGenerator( - RTSTRUCT_FILENAME2.c_str(), DOSE_FILENAME.c_str()).generateStructureSet(); - //2) test structure import, should be equal to structure imported on CT-image - CHECK_EQUAL(9, rtStructureSet3->getNumberOfStructures()); - - CHECK_EQUAL("BLASE", (rtStructureSet3->getStructure(0))->getLabel()); - CHECK_EQUAL("HUEFTK_LINKS", (rtStructureSet3->getStructure(3))->getLabel()); - CHECK_EQUAL("RAND", (rtStructureSet3->getStructure(5))->getLabel()); - CHECK_EQUAL("PTV", (rtStructureSet3->getStructure(8))->getLabel()); - - for (int s = 0; s < rtStructureSet3->getNumberOfStructures(); s++) - { - CHECK_EQUAL((rtStructureSet2->getStructure(s))->getLabel(), - (rtStructureSet3->getStructure(s))->getLabel()); - - core::Structure myStructure3 = *(rtStructureSet3->getStructure(s)); - core::Structure myStructure2c = *(rtStructureSet2->getStructure(s)); - CHECK_EQUAL(myStructure2c.getNumberOfEndpoints(), myStructure3.getNumberOfEndpoints()); - PolygonSequenceType myPolygonSeq3 = myStructure3.getStructureVector(); - PolygonSequenceType myPolygonSeq2c = myStructure2c.getStructureVector(); - CHECK_EQUAL(myPolygonSeq2c.size(), myPolygonSeq3.size()); - - for (int ps = 0; ps < myPolygonSeq3.size(); ps++) - { - PolygonType myPolygon2c = myPolygonSeq2c.at(ps); - PolygonType myPolygon3 = myPolygonSeq3.at(ps); - CHECK_CLOSE(myPolygon2c.at(0).x(), myPolygon3.at(0).x(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).y(), myPolygon3.at(0).y(), errorConstant); - CHECK_CLOSE(myPolygon2c.at(0).z(), myPolygon3.at(0).z(), errorConstant); - } - } - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/VirtuosStructureSetGeneratorTest.cpp b/testing/io/virtuos/VirtuosStructureSetGeneratorTest.cpp deleted file mode 100644 index b539af4..0000000 --- a/testing/io/virtuos/VirtuosStructureSetGeneratorTest.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -// this file defines the rttbCoreTests for the test driver -// and all it expects is that you have a function called RegisterTests - -#include -#include - -#include "litCheckMacros.h" - -#include "rttbBaseType.h" -#include "rttbGeometricInfo.h" -#include "rttbDoseIteratorInterface.h" -#include "rttbVirtuosDoseAccessor.h" -#include "rttbVirtuosFileStructureSetGenerator.h" -#include "rttbNullPointerException.h" -#include "rttbInvalidDoseException.h" -#include "rttbInvalidParameterException.h" -#include "rttbIndexOutOfBoundsException.h" - - -namespace rttb -{ - - namespace testing - { - - /*!@brief VirtuosStructureSetGeneratorTest - test structure set generator for virtuos data - 1) test constructor - 2) test generateStructureSet - */ - - int VirtuosStructureSetGeneratorTest(int argc, char* argv[]) - { - typedef core::StructureSetGeneratorInterface::StructureSetPointer StructureSetPointer; - - PREPARE_DEFAULT_TEST_REPORTING; - //ARGUMENTS: 1: structure file name ".../testing/data/Virtuos/NHH030000.vdx" - // 2: ctx file name (virtuos) ".../testing/data/Virtuos/NHH030000.ctx.gz" - - - std::string RTSTRUCT_FILENAME; - std::string CT_FILENAME; - - if (argc > 1) - { - RTSTRUCT_FILENAME = argv[1]; - } - - if (argc > 2) - { - CT_FILENAME = argv[2]; - } - - - - /* structure set */ - //1) check constructor - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator("aStructureFileName.vdx", - CT_FILENAME.c_str()), core::InvalidParameterException); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator(RTSTRUCT_FILENAME.c_str(), - "aCTFileName.ctx"), core::InvalidParameterException); - CHECK_NO_THROW(io::virtuos::VirtuosFileStructureSetGenerator(RTSTRUCT_FILENAME.c_str(), - CT_FILENAME.c_str())); - - //2) check generateStructureSet - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator("aStructureFileName.vdx", - CT_FILENAME.c_str()).generateStructureSet(), core::InvalidParameterException); - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator(RTSTRUCT_FILENAME.c_str(), - "aCTFileName.ctx").generateStructureSet(), core::InvalidParameterException); - std::string testFileName = RTSTRUCT_FILENAME; - size_t gzPosition = testFileName.find(".vdx"); - - if (gzPosition != std::string::npos) - { - testFileName.erase(gzPosition, testFileName.length()); - } - - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator(testFileName, - CT_FILENAME.c_str()).generateStructureSet(), core::InvalidParameterException); - testFileName = CT_FILENAME; - gzPosition = testFileName.find(".ctx"); - - if (gzPosition != std::string::npos) - { - testFileName.erase(gzPosition, testFileName.length()); - } - - CHECK_THROW_EXPLICIT(io::virtuos::VirtuosFileStructureSetGenerator(RTSTRUCT_FILENAME.c_str(), - testFileName).generateStructureSet(), core::InvalidParameterException); - CHECK_NO_THROW(io::virtuos::VirtuosFileStructureSetGenerator(RTSTRUCT_FILENAME.c_str(), - CT_FILENAME.c_str()).generateStructureSet()); - - - RETURN_AND_REPORT_TEST_SUCCESS; - } - - }//testing -}//rttb - diff --git a/testing/io/virtuos/files.cmake b/testing/io/virtuos/files.cmake deleted file mode 100644 index 3787683..0000000 --- a/testing/io/virtuos/files.cmake +++ /dev/null @@ -1,14 +0,0 @@ -SET(CPP_FILES rttbVirtuosIOTests.cpp - TripDoseIOTest.cpp - TripStructureIOTest.cpp - VirtuosDoseIOTest.cpp - VirtuosDoseAccessorGeneratorTest.cpp - VirtuosDVHCalculatorExampleTest.cpp - VirtuosStructureIOTest.cpp - VirtuosStructureSetGeneratorTest.cpp - ../rttbDoseAccessorTester.cpp - ) - -SET(H_FILES - ../rttbDoseAccessorTester.h -) diff --git a/testing/io/virtuos/rttbVirtuosIOTests.cpp b/testing/io/virtuos/rttbVirtuosIOTests.cpp deleted file mode 100644 index cc3a500..0000000 --- a/testing/io/virtuos/rttbVirtuosIOTests.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// ----------------------------------------------------------------------- -// 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$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (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" - -namespace rttb -{ - namespace testing - { - - void registerTests() - { - LIT_REGISTER_TEST(VirtuosDoseAccessorGeneratorTest); - LIT_REGISTER_TEST(VirtuosDoseIOTest); - LIT_REGISTER_TEST(VirtuosStructureIOTest); - LIT_REGISTER_TEST(VirtuosStructureSetGeneratorTest); - LIT_REGISTER_TEST(TripStructureIOTest); - LIT_REGISTER_TEST(TripDoseIOTest); - LIT_REGISTER_TEST(VirtuosDVHCalculatorExampleTest); - } - } -} - -int main(int argc, char* argv[]) -{ - int result = 0; - - rttb::testing::registerTests(); - - try - { - result = lit::multiTestsMain(argc, argv); - } - - catch (...) - { - result = -1; - } - - return result; -}