diff --git a/RTToolboxConfigure.h.in b/RTToolboxConfigure.h.in index bc84fe9..cc1608b 100644 --- a/RTToolboxConfigure.h.in +++ b/RTToolboxConfigure.h.in @@ -1,64 +1,64 @@ // ----------------------------------------------------------------------- // 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 -#ifndef __RTT_CONFIGURE_H -#define __RTT_CONFIGURE_H +#ifndef __RTTB_CONFIGURE_H +#define __RTTB_CONFIGURE_H -/*! @def RTT_ENFORCE_MATURE_CODE +/*! @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 - * RTT_ENFORCE_MATURE_CODE can be used to ensure that strictness when prebuilding + * 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 RTT_ENFORCE_MATURE_CODE -#ifdef RTT_ENFORCE_MATURE_CODE +#cmakedefine RTTB_ENFORCE_MATURE_CODE +#ifdef RTTB_ENFORCE_MATURE_CODE #define SIDT_ENFORCE_MATURE_CODE #endif -#define RTT_VERSION_MAJOR @RTToolbox_VERSION_MAJOR@ -#define RTT_VERSION_MINOR @RTToolbox_VERSION_MINOR@ -#define RTT_VERSION_PATCH @RTToolbox_VERSION_PATCH@ -#define RTT_VERSION_STRING "@RTToolbox_VERSION_STRING@" -#define RTT_FULL_VERSION_STRING "@RTToolbox_FULL_VERSION_STRING@" +#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@" #endif diff --git a/cmake/PackageDepends/RTTB_DCMTK_Config.cmake b/cmake/PackageDepends/RTTB_DCMTK_Config.cmake index 3c3fa87..50d13d2 100644 --- a/cmake/PackageDepends/RTTB_DCMTK_Config.cmake +++ b/cmake/PackageDepends/RTTB_DCMTK_Config.cmake @@ -1,216 +1,218 @@ #----------------------------------------------------------------------------- # Find DCMTK #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # This part is based on the findDCMTK of CMake 2.8.8 # it was patched because: # 1. the find_library statement had an incomplete set # of search paths. If building DCMTK with Visual # Studio the libs are to be found in /lib/release # or /lib/debug # 2. the module DCMRT was not included (but needed by RTToolbox) # IF(DEFINED DCMTK_DIR) IF(NOT IS_ABSOLUTE ${DCMTK_DIR}) SET(DCMTK_DIR "${RTToolbox_BINARY_DIR}/${DCMTK_DIR}") ENDIF(NOT IS_ABSOLUTE ${DCMTK_DIR}) ENDIF(DEFINED DCMTK_DIR) if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) - set(DCMTK_DIR "/usr/include/dcmtk/") + IF (NOT WIN32) + set(DCMTK_DIR "/usr/include/dcmtk/") + ENDIF(NOT WIN32) endif() #ensure that we always have the variable as cache, independent from #setting it via gui or command line set(DCMTK_DIR ${DCMTK_DIR} CACHE PATH "Root of DCMTK tree.") IF(DEFINED DCMTK_SOURCE_DIR) IF(NOT IS_ABSOLUTE ${DCMTK_SOURCE_DIR}) SET(DCMTK_SOURCE_DIR "${RTToolbox_BINARY_DIR}/${DCMTK_SOURCE_DIR}") ENDIF(NOT IS_ABSOLUTE ${DCMTK_SOURCE_DIR}) ENDIF(DEFINED DCMTK_SOURCE_DIR) if(NOT DCMTK_FOUND AND NOT DCMTK_SOURCE_DIR) set(DCMTK_SOURCE_DIR ${DCMTK_DIR}) endif() #ensure that we always have the variable as cache, independent from #setting it via gui or command line set(DCMTK_SOURCE_DIR ${DCMTK_SOURCE_DIR} CACHE PATH "Root of DCMTK tree.") OPTION(RTTB_USE_ML_DCMTK "RTTB should use a DCMTK which is available in the MeVisLab package structure." OFF) MARK_AS_ADVANCED(RTTB_USE_ML_DCMTK) if(NOT DCMTK_FOUND) set(DCMTK_FOUND True) set(DCMTK_DEBUG_LIB_SEARCH_PATH ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Debug ${DCMTK_DIR}/lib/Debug ) set(DCMTK_LIB_SEARCH_PATH ${DCMTK_DIR}/${lib}/libsrc ${DCMTK_DIR}/${lib}/libsrc/Release ${DCMTK_DIR}/${lib}/Release ${DCMTK_DIR}/lib/Release ${DCMTK_DIR}/lib ) set(DCMTK_LIB_SEARCH_NAMES dcmdata dcmimage dcmimgle dcmjpeg dcmnet dcmpstat dcmqrdb dcmdsig dcmsr dcmtls dcmrt ijg12 ijg16 ijg8 ofstd oflog ) if(${RTTB_USE_ML_DCMTK}) set(DCMTK_DEBUG_LIB_SEARCH_PATH ${DCMTK_DIR}/lib ) set(DCMTK_LIB_SEARCH_PATH ${DCMTK_DIR}/lib ) set(DCMTK_LIB_SEARCH_NAMES ${DCMTK_LIB_SEARCH_NAMES} zlib) endif(${RTTB_USE_ML_DCMTK}) foreach(lib ${DCMTK_LIB_SEARCH_NAMES}) if(${RTTB_USE_ML_DCMTK}) find_library(DCMTK_${lib}_DEBUG_LIBRARY ${lib}_d PATHS ${DCMTK_DEBUG_LIB_SEARCH_PATH}) else(${RTTB_USE_ML_DCMTK}) find_library(DCMTK_${lib}_DEBUG_LIBRARY ${lib} PATHS ${DCMTK_DEBUG_LIB_SEARCH_PATH}) endif(${RTTB_USE_ML_DCMTK}) find_library(DCMTK_${lib}_LIBRARY ${lib} PATHS ${DCMTK_LIB_SEARCH_PATH}) if((${UNIX}) AND (NOT DCMTK_${lib}_DEBUG_LIBRARY)) set(DCMTK_${lib}_DEBUG_LIBRARY ${DCMTK_${lib}_LIBRARY} CACHE PATH "Path to a library" FORCE) endif((${UNIX}) AND (NOT DCMTK_${lib}_DEBUG_LIBRARY)) mark_as_advanced(DCMTK_${lib}_LIBRARY) mark_as_advanced(DCMTK_${lib}_DEBUG_LIBRARY) add_library(${lib} STATIC IMPORTED) set_target_properties(${lib} PROPERTIES IMPORTED_LOCATION ${DCMTK_${lib}_LIBRARY} IMPORTED_LOCATION_DEBUG ${DCMTK_${lib}_DEBUG_LIBRARY}) if(DCMTK_${lib}_LIBRARY) list(APPEND DCMTK_LIBRARIES ${lib}) endif() if(NOT DCMTK_${lib}_LIBRARY) message(WARNING "Cannot find library DCMTK_${lib}_LIBRARY") endif() if(NOT DCMTK_${lib}_DEBUG_LIBRARY) message(WARNING "Cannot find library DCMTK_${lib}_DEBUG_LIBRARY") endif() endforeach() set(DCMTK_config_TEST_HEADER osconfig.h) set(DCMTK_dcmdata_TEST_HEADER dctypes.h) set(DCMTK_dcmimage_TEST_HEADER dicoimg.h) set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h) set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h) set(DCMTK_dcmnet_TEST_HEADER assoc.h) set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h) set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h) set(DCMTK_dcmrt_TEST_HEADER drmdose.h) set(DCMTK_dcmsign_TEST_HEADER sicert.h) set(DCMTK_dcmsr_TEST_HEADER dsrtree.h) set(DCMTK_dcmtls_TEST_HEADER tlslayer.h) set(DCMTK_ofstd_TEST_HEADER ofstdinc.h) set(DCMTK_oflog_TEST_HEADER oflog.h) foreach(dir config dcmdata dcmimage dcmimgle dcmjpeg dcmnet dcmpstat dcmqrdb dcmrt dcmsign dcmsr dcmtls ofstd oflog) find_path(DCMTK_${dir}_INCLUDE_DIR ${DCMTK_${dir}_TEST_HEADER} PATHS ${DCMTK_DIR}/${dir}/include ${DCMTK_DIR}/${dir} ${DCMTK_DIR}/include/${dir} ${DCMTK_DIR}/include/dcmtk/${dir} ${DCMTK_DIR}/${dir}/include/dcmtk/${dir} ${DCMTK_SOURCE_DIR}/${dir}/include ${DCMTK_SOURCE_DIR}/${dir} ${DCMTK_SOURCE_DIR}/include/${dir} ${DCMTK_SOURCE_DIR}/include/dcmtk/${dir} ${DCMTK_SOURCE_DIR}/${dir}/include/dcmtk/${dir} ) mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) if(DCMTK_${dir}_INCLUDE_DIR) list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_${dir}_INCLUDE_DIR} ${DCMTK_SOURCE_DIR}/${dir}/include ${DCMTK_DIR}/${dir}/include) endif() endforeach() if(WIN32) list(APPEND DCMTK_LIBRARIES netapi32 wsock32 ws2_32) endif() if(UNIX) list(APPEND DCMTK_LIBRARIES pthread) endif() if(DCMTK_ofstd_INCLUDE_DIR) get_filename_component(DCMTK_dcmtk_INCLUDE_DIR ${DCMTK_ofstd_INCLUDE_DIR} PATH CACHE) list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR}) mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) endif() endif() #----------------------------------------------------------------------------- # RTTB part to use the found DCMTK # IF(NOT DCMTK_FOUND) MESSAGE(SEND_ERROR "DCMTK development files not found.\n Please check variables (e.g. DCMTK_DIR) for include directories and libraries.\nYou may set environment variable DCMTK_DIR before pressing 'configure'") ENDIF(NOT DCMTK_FOUND) IF( NOT WIN32 ) SET(MISSING_LIBS_REQUIRED_BY_DCMTK wrap tiff) ENDIF( NOT WIN32 ) LIST(APPEND ALL_INCLUDE_DIRECTORIES ${DCMTK_INCLUDE_DIRS} ${DCMTK_DIR}/include) LIST(APPEND ALL_LIBRARIES ${DCMTK_LIBRARIES} ${MISSING_LIBS_REQUIRED_BY_DCMTK}) diff --git a/cmake/PackageDepends/RTTB_ITK_Config.cmake b/cmake/PackageDepends/RTTB_ITK_Config.cmake index 03ceb49..527ce0e 100644 --- a/cmake/PackageDepends/RTTB_ITK_Config.cmake +++ b/cmake/PackageDepends/RTTB_ITK_Config.cmake @@ -1,25 +1,18 @@ #----------------------------------------------------------------------------- # Find ITK. #----------------------------------------------------------------------------- - - -FIND_PACKAGE(ITK) +FIND_PACKAGE(ITK 4.4 REQUIRED) IF(ITK_FOUND) INCLUDE(${ITK_USE_FILE}) ELSE(ITK_FOUND) MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.") ENDIF(ITK_FOUND) -IF(${ITK_VERSION_MAJOR} LESS 4 OR (${ITK_VERSION_MAJOR} EQUAL 4 AND ${ITK_VERSION_MINOR} LESS 4)) - MESSAGE(FATAL_ERROR - "Outdated ITK version. Cannot build RTToolbox without sufficient ITK version. ITK 4.4 or above is needed.") -ENDIF(${ITK_VERSION_MAJOR} LESS 4 OR (${ITK_VERSION_MAJOR} EQUAL 4 AND ${ITK_VERSION_MINOR} LESS 4)) - -#LIST(APPEND ALL_INCLUDE_DIRECTORIES ${ITK_INCLUDE_DIRS}) -#LIST(APPEND ALL_LIBRARIES ${ITK_LIBRARIES}) +LIST(APPEND ALL_INCLUDE_DIRECTORIES ${ITK_INCLUDE_DIRS}) +LIST(APPEND ALL_LIBRARIES ${ITK_LIBRARIES}) -#LINK_DIRECTORIES(${ITK_LIBRARY_DIRS}) +LINK_DIRECTORIES(${ITK_LIBRARY_DIRS}) CONFIGURE_FILE(${RTToolbox_SOURCE_DIR}/cmake/ITKConfig.cmake.in ${RTTB_MODULES_CONF_DIR}/ITKConfig.cmake @ONLY) diff --git a/code/algorithms/rttbBinaryFunctorAccessor.h b/code/algorithms/rttbBinaryFunctorAccessor.h index 149fe1e..134c145 100644 --- a/code/algorithms/rttbBinaryFunctorAccessor.h +++ b/code/algorithms/rttbBinaryFunctorAccessor.h @@ -1,104 +1,102 @@ // ----------------------------------------------------------------------- // 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: 747 $ (last changed revision) // @date $Date: 2014-09-17 12:01:00 +0200 (Mi, 17 Sep 2014) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #ifndef __BINARY_FUNCTOR_ACCESSOR_H #define __BINARY_FUNCTOR_ACCESSOR_H -#include - #include "rttbAccessorInterface.h" #include "rttbGeometricInfo.h" #include "rttbBaseType.h" namespace rttb { namespace algorithms { /*! @class BinaryFunctorAccessor @brief Class that allows to access the results of a binary operation. @details this Accessor takes two accessors as operants (the operants must have the same geometry) and computes a resulting value by using a given operation functor. The resulting value will be returned from the accessor as its value upon request. @remark this can be seen as a lazy filter pattern, thus the accessor is filtering/operating on dose values upon request. */ template class BinaryFunctorAccessor: public core::AccessorInterface { protected: AccessorPointer _spData1; AccessorPointer _spData2; TDoseOperation _functor; public: /*! @brief Constructor. @param data1 pointer to the 1st data operand @param data2 pointer to the 2nd data operand @param functor Instance of the operation that should be used @pre all input parameters have to be valid @exception core::NullPointerException if one input parameter is NULL or if geometricInfos don't match */ BinaryFunctorAccessor(const AccessorPointer data1, const DoseAccessorPointer data2, const TDoseOperation& functor); /*! @brief Virtual destructor */ virtual ~BinaryFunctorAccessor() {}; /*! @pre: the geometricInfo of both doseAccessors are equal */ inline const core::GeometricInfo& getGeometricInfo() const { return _spData1->getGeometricInfo(); }; /*! @pre: the geometricInfo of both doseAccessors are equal */ inline GridSizeType getGridSize() const { return _spData1->getGeometricInfo().getNumberOfVoxels(); }; /*! @brief Returns the result dose computed by the functor. It uses the dose values of both operand doses specified via the passed ID. @return the dose value if inside, -1 else @pre .calc(dose1,dose2) has to be implemented */ GenericValueType getValueAt(const VoxelGridID aID) const; /*! @brief Returns the result dose computed by the functor. It uses the dose values of both operand doses specified via the passed index. @return the dose value if inside, -1 else @pre .calc(dose1,dose2) has to be implemented */ GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const; //@todo: which UID should be used here? const IDType getUID() const { return IDType(); } }; } } #include "rttbBinaryFunctorAccessor.tpp" #endif diff --git a/code/interpolation/CMakeLists.txt b/code/interpolation/CMakeLists.txt index 1077552..b10c4a9 100644 --- a/code/interpolation/CMakeLists.txt +++ b/code/interpolation/CMakeLists.txt @@ -1,16 +1,12 @@ -OPTION(BUILD_MatchPointBinding - "Determine if the MatchPoint binding for dose interpolation classes will be generated." OFF) -OPTION(BUILD_ITKBinding - "Determine if the ITK binding for dose interpolation classes will be generated." OFF) -IF(BUILD_MatchPointBinding) - ADD_SUBDIRECTORY(MatchPointBinding) -ENDIF(BUILD_MatchPointBinding) -IF(BUILD_ITKBinding) - ADD_SUBDIRECTORY(ITKBinding) -ENDIF(BUILD_ITKBinding) +OPTION(BUILD_InterpolationMatchPointTransformation + "Determine if the MatchPoint transformation for dose interpolation classes will be generated." OFF) +IF(BUILD_InterpolationMatchPointTransformation) + ADD_SUBDIRECTORY(MatchPointTransformation) +ENDIF(BUILD_InterpolationMatchPointTransformation) +ADD_SUBDIRECTORY(ITKTransformation) RTTB_CREATE_MODULE(RTTBInterpolation DEPENDS RTTBCore PACKAGE_DEPENDS Boost) IF (NOT WIN32) - #CMake 3.1 provides target_compile_features(RTTB_Interpolation cxx_auto_type cxx_nullptr cxx_override) to automatically add required compiler flags + #CMake 3.1 provides target_compile_features(RTTB_Interpolation cxx_auto_type cxx_nullptr cxx_override) to automatically add required compiler flags set(CMAKE_CXX_FLAGS "-std=c++11") ENDIF() diff --git a/code/interpolation/ITKBinding/CMakeLists.txt b/code/interpolation/ITKBinding/CMakeLists.txt deleted file mode 100644 index 11c45f1..0000000 --- a/code/interpolation/ITKBinding/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -RTTB_CREATE_MODULE(RTTBITKBinding DEPENDS RTTBCore RTTBInterpolation RTTBITKIO PACKAGE_DEPENDS Boost ITK) \ No newline at end of file diff --git a/code/interpolation/ITKTransformation/CMakeLists.txt b/code/interpolation/ITKTransformation/CMakeLists.txt new file mode 100644 index 0000000..1a2fbb4 --- /dev/null +++ b/code/interpolation/ITKTransformation/CMakeLists.txt @@ -0,0 +1 @@ +RTTB_CREATE_MODULE(RTTBInterpolationITKTransformation DEPENDS RTTBCore RTTBInterpolation RTTBITKIO PACKAGE_DEPENDS Boost ITK) \ No newline at end of file diff --git a/code/interpolation/ITKBinding/files.cmake b/code/interpolation/ITKTransformation/files.cmake similarity index 100% rename from code/interpolation/ITKBinding/files.cmake rename to code/interpolation/ITKTransformation/files.cmake diff --git a/code/interpolation/ITKBinding/rttbITKTransformation.cpp b/code/interpolation/ITKTransformation/rttbITKTransformation.cpp similarity index 100% rename from code/interpolation/ITKBinding/rttbITKTransformation.cpp rename to code/interpolation/ITKTransformation/rttbITKTransformation.cpp diff --git a/code/interpolation/ITKBinding/rttbITKTransformation.h b/code/interpolation/ITKTransformation/rttbITKTransformation.h similarity index 100% rename from code/interpolation/ITKBinding/rttbITKTransformation.h rename to code/interpolation/ITKTransformation/rttbITKTransformation.h diff --git a/code/interpolation/MatchPointBinding/CMakeLists.txt b/code/interpolation/MatchPointBinding/CMakeLists.txt deleted file mode 100644 index da68e95..0000000 --- a/code/interpolation/MatchPointBinding/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -RTTB_CREATE_MODULE(RTTBMatchPointBinding DEPENDS RTTBCore RTTBInterpolation PACKAGE_DEPENDS Boost MatchPoint ITK) diff --git a/code/interpolation/MatchPointTransformation/CMakeLists.txt b/code/interpolation/MatchPointTransformation/CMakeLists.txt new file mode 100644 index 0000000..68feb4f --- /dev/null +++ b/code/interpolation/MatchPointTransformation/CMakeLists.txt @@ -0,0 +1 @@ +RTTB_CREATE_MODULE(RTTBInterpolationMatchPointTransformation DEPENDS RTTBCore RTTBInterpolation PACKAGE_DEPENDS Boost MatchPoint ITK) diff --git a/code/interpolation/MatchPointBinding/files.cmake b/code/interpolation/MatchPointTransformation/files.cmake similarity index 100% rename from code/interpolation/MatchPointBinding/files.cmake rename to code/interpolation/MatchPointTransformation/files.cmake diff --git a/code/interpolation/MatchPointBinding/rttbMatchPointTransformation.cpp b/code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.cpp similarity index 90% rename from code/interpolation/MatchPointBinding/rttbMatchPointTransformation.cpp rename to code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.cpp index 513ca05..0668bd8 100644 --- a/code/interpolation/MatchPointBinding/rttbMatchPointTransformation.cpp +++ b/code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.cpp @@ -1,88 +1,88 @@ // ----------------------------------------------------------------------- // 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) +// @version $Revision: 793 $ (last changed revision) +// @date $Date: 2014-10-10 10:24:45 +0200 (Fr, 10 Okt 2014) $ (last change date) +// @author $Author: hentsch $ (last changed by) */ #include "rttbMatchPointTransformation.h" #include "rttbNullPointerException.h" namespace rttb { namespace interpolation { MatchPointTransformation::MatchPointTransformation( const Registration3D3DType* aRegistration): _pRegistration(aRegistration) { //handle null pointers if (aRegistration == NULL) { throw core::NullPointerException("Pointer to registration is NULL."); } } void MatchPointTransformation::convert(const WorldCoordinate3D& aWorldCoordinate, TargetPointType& aTargetPoint) const { assert(aWorldCoordinate.size() == 3); assert(aTargetPoint.Length == 3); for (unsigned int i = 0; i < aTargetPoint.Length; ++i) { aTargetPoint[i] = aWorldCoordinate[i]; } } void MatchPointTransformation::convert(const MovingPointType& aMovingPoint, WorldCoordinate3D& aWorldCoordinate) const { assert(aWorldCoordinate.size() == 3); assert(aMovingPoint.Length == 3); for (unsigned int i = 0; i < aMovingPoint.Length; ++i) { aWorldCoordinate[i] = aMovingPoint[i]; } } bool MatchPointTransformation::transformInverse(const WorldCoordinate3D& worldCoordinateTarget, WorldCoordinate3D& worldCoordinateMoving) const { TargetPointType aTargetPoint; MovingPointType aMovingPoint; convert(worldCoordinateTarget, aTargetPoint); bool ok = _pRegistration->mapPointInverse(aTargetPoint, aMovingPoint); convert(aMovingPoint, worldCoordinateMoving); return ok; } bool MatchPointTransformation::transform(const WorldCoordinate3D& worldCoordinateMoving, WorldCoordinate3D& worldCoordinateTarget) const { TargetPointType aTargetPoint; MovingPointType aMovingPoint; convert(worldCoordinateMoving, aMovingPoint); bool ok = _pRegistration->mapPoint(aMovingPoint, aTargetPoint); convert(aTargetPoint, worldCoordinateTarget); return ok; } } } diff --git a/code/interpolation/MatchPointBinding/rttbMatchPointTransformation.h b/code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.h similarity index 91% rename from code/interpolation/MatchPointBinding/rttbMatchPointTransformation.h rename to code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.h index e96d10c..4bd67fb 100644 --- a/code/interpolation/MatchPointBinding/rttbMatchPointTransformation.h +++ b/code/interpolation/MatchPointTransformation/rttbMatchPointTransformation.h @@ -1,82 +1,82 @@ // ----------------------------------------------------------------------- // 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) +// @version $Revision: 741 $ (last changed revision) +// @date $Date: 2014-09-16 16:34:22 +0200 (Di, 16 Sep 2014) $ (last change date) +// @author $Author: hentsch $ (last changed by) */ #ifndef __MATCHPOINT_TRANSFORMATION_H #define __MATCHPOINT_TRANSFORMATION_H #include #include "mapRegistration.h" #include "rttbTransformationInterface.h" #include "rttbBaseType.h" namespace rttb { namespace interpolation { /*! @class MatchPointTransformation @brief This class can deal with dose information that has to be transformed into another geometry than the original dose image (transformation specified by MatchPoint registration object). @ingroup interpolation */ class MatchPointTransformation: public TransformationInterface { public: static const unsigned int TargetDimension3D = 3; static const unsigned int MovingDimension3D = 3; typedef map::core::Registration Registration3D3DType; typedef map::core::Registration::MovingPointType MovingPointType; typedef map::core::Registration::TargetPointType TargetPointType; /*! @brief Constructor. @param aRegistration registration given in MatchPoint format (note the use of pointer since itkSmartPointer does not support inheritance) @pre all input parameters have to be valid @exception core::NullPointerException if one input parameter is NULL @exception core::PaddingException if the transformation is undefined and if _acceptPadding==false */ MatchPointTransformation(const Registration3D3DType* aRegistration); ~MatchPointTransformation() {}; /*! @brief performs a transformation targetImage --> movingImage */ bool transformInverse(const WorldCoordinate3D& worldCoordinateTarget, WorldCoordinate3D& worldCoordinateMoving) const override; /*! @brief performs a transformation movingImage --> targetImage */ bool transform(const WorldCoordinate3D& worldCoordinateMoving, WorldCoordinate3D& worldCoordinateTarget) const override; protected: void convert(const WorldCoordinate3D& aWorldCoordinate, TargetPointType& aTargetPoint) const; void convert(const MovingPointType& aMovingPoint, WorldCoordinate3D& aWorldCoordinate) const; private: //! Has to be a Pointer type because of inheritance issues with itkSmartPointer (that doesn't recognize the inheritance) const Registration3D3DType* _pRegistration; }; } } #endif diff --git a/code/io/itk/CMakeLists.txt b/code/io/itk/CMakeLists.txt index 576da0f..21d4acd 100644 --- a/code/io/itk/CMakeLists.txt +++ b/code/io/itk/CMakeLists.txt @@ -1 +1 @@ -RTTB_CREATE_MODULE(RTTBITKIO DEPENDS RTTBCore PACKAGE_DEPENDS Boost MatchPoint ITK) \ No newline at end of file +RTTB_CREATE_MODULE(RTTBITKIO DEPENDS RTTBCore PACKAGE_DEPENDS Boost ITK) \ No newline at end of file diff --git a/demoapps/BioModelCalc/BioModelCalc.cpp b/demoapps/BioModelCalc/BioModelCalc.cpp index 719d68f..46c1995 100644 --- a/demoapps/BioModelCalc/BioModelCalc.cpp +++ b/demoapps/BioModelCalc/BioModelCalc.cpp @@ -1,129 +1,129 @@ // ----------------------------------------------------------------------- // 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: 1066 $ (last changed revision) // @date $Date: 2015-08-19 11:47:07 +0200 (Mi, 19 Aug 2015) $ (last change date) // @author $Author: floca $ (last changed by) */ #include "BioModelCalcApplicationData.h" #include "BioModelCalcHelper.h" #include "BioModelCmdLineParser.h" #include "boost/shared_ptr.hpp" #include "boost/make_shared.hpp" #include "RTToolboxConfigure.h" #include "rttbException.h" rttb::apps::bioModelCalc::ApplicationData appData; int main(int argc, const char** argv) { int result = 0; boost::shared_ptr argParser; try { std::string appName = "BioModelCalc"; - std::string appVersion = RTT_FULL_VERSION_STRING; + std::string appVersion = RTTB_FULL_VERSION_STRING; argParser = boost::make_shared(argc, argv, appName, appVersion); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return -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 (unsigned int i = 0; i < appData._modelParameters.size(); i++) { if (i != 0) { std::cout << ", "; } std::cout << appData._modelParameters.at(i); } std::cout << std::endl; try { appData._dose = rttb::apps::bioModelCalc::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 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; } std::cout << "ENDE" << std::endl; return result; } diff --git a/demoapps/DoseAcc/CMakeLists.txt b/demoapps/DoseAcc/CMakeLists.txt index d1a475d..ef2f174 100644 --- a/demoapps/DoseAcc/CMakeLists.txt +++ b/demoapps/DoseAcc/CMakeLists.txt @@ -1,3 +1,3 @@ MESSAGE (STATUS "generating demo app: DoseAcc - simple dose accumulation tool example") -RTTB_CREATE_APPLICATION(DoseAcc DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBMatchPointBinding RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK) \ No newline at end of file +RTTB_CREATE_APPLICATION(DoseAcc DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK) \ No newline at end of file diff --git a/demoapps/DoseAcc/DoseAccApplicationData.cpp b/demoapps/DoseAcc/DoseAccApplicationData.cpp index 2711ff6..50524fa 100644 --- a/demoapps/DoseAcc/DoseAccApplicationData.cpp +++ b/demoapps/DoseAcc/DoseAccApplicationData.cpp @@ -1,202 +1,202 @@ // ----------------------------------------------------------------------- // 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 "DoseAccApplicationData.h" #include "itksys/SystemTools.hxx" #include "itksys/CommandLineArguments.hxx" #include "RTToolboxConfigure.h" namespace rttb { namespace apps { namespace doseAcc { int unknown_argument(const char* argument, void* call_data) { std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; return 0; } ApplicationData:: ApplicationData() { this->Reset(); } void ApplicationData:: Reset() { _dose1FileName = ""; _dose2FileName = ""; _outputFileName = ""; _regFileName = ""; _interpolatorName = "linear"; _showVersion = false; _showHelp = false; _weightDose1 = 1.0; _weightDose2 = 1.0; _fileCount = 0; _operator = "+"; } unsigned int ParseArgumentsForAppData(int argc, char** argv, ApplicationData& appData) { itksys::CommandLineArguments cmdParser; appData.Reset(); if (argc > 3) { appData._dose1FileName = argv[1]; ++appData._fileCount; --argc; ++argv; appData._dose2FileName = argv[1]; ++appData._fileCount; --argc; ++argv; appData._outputFileName = argv[1]; ++appData._fileCount; --argc; ++argv; } cmdParser.Initialize(argc, argv); cmdParser.SetUnknownArgumentCallback(unknown_argument); cmdParser.AddArgument("--interpolator", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._interpolatorName), "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); cmdParser.AddArgument("-i", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._interpolatorName), "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbor, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); cmdParser.AddArgument("--weight1", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._weightDose1), "Specifies the weight for dose 1. If not specified the weight is 1.0."); cmdParser.AddArgument("-w1", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._weightDose1), "Specifies the weight for dose 1. If not specified the weight is 1.0."); cmdParser.AddArgument("--weight2", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._weightDose2), "Specifies the weight for dose 2. If not specified the weight is 1.0."); cmdParser.AddArgument("-w2", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._weightDose2), "Specifies the weight for dose 2. If not specified the weight is 1.0."); cmdParser.AddArgument("--registration", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._regFileName), "Specifies name and location of the registration file that should be used to map dose 2 before accumulating it with dose 1. Default is no mapping, thus direct accumulation. The registration should be stored as MatchPoint registration."); cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._regFileName), "Specifies name and location of the registration file that should be used to map dose 2 before accumulating it with dose 1. Default is no mapping, thus direct accumulation. The registration should be stored as MatchPoint registration."); cmdParser.AddArgument("--loadStyle1", itksys::CommandLineArguments::MULTI_ARGUMENT, &(appData._dose1LoadStyle), "Indicates the load style that should be used for dose 1. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle1 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); cmdParser.AddArgument("--loadStyle2", itksys::CommandLineArguments::MULTI_ARGUMENT, &(appData._dose2LoadStyle), "Indicates the load style that should be used for dose 2. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle2 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); cmdParser.AddArgument("--operator", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._operator), "Specifies the operator used. Available operators are '+' and '*'. If not specified the operator is '+'."); cmdParser.AddArgument("-o", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._operator), "Specifies the operator used. Available operators are '+' and '*'. If not specified the operator is '+'."); cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showVersion), "Shows the version of the program."); cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), "Shows this help information for the program."); cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), "Shows this help information for the program."); cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), "Shows this help information for the program."); cmdParser.AddArgument("/h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), "Shows this help information for the program."); cmdParser.AddArgument("/?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), "Shows this help information for the program."); if (!cmdParser.Parse()) { std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << "Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 3; }; if (appData._showHelp) { std::cout << std::endl << "Usage: " << std::endl << std::endl; std::cout << " DoseAcc [options]" << std::endl << std::endl; std::cout << " Dose1: File path to the 1st dose." << std::endl; std::cout << " Dose2: File path to the 2nd dose." << std::endl; std::cout << " DoseOutput: File path where the output should be stored." << std::endl << std::endl; std::cout << "Command-Line Options:" << std::endl << std::endl; std::cout << cmdParser.GetHelp() << std::endl << std::endl; std::cout << " Example:" << std::endl << std::endl; std::cout << " DoseAcc dose1.mhd dose2.mhd result.mhd --loadStyle1 itk --loadStyle2 itk -w1 2 -r reg.mapr" << std::endl << std::endl; std::cout << " This will accumulate \"dose1.mhd\" and \"dose2.mhd\" by using \"reg.mapr\" to map dose 2. For the accumulation, dose 1 will be multiplied by 2. The resulting dose will be stored in \"result.mhd\"." << std::endl << std::endl; std::cout << " DoseAcc dose1.dcm dose2.dos.gz result.mhd --loadStyle2 virtuos dose2.pln -r reg.mapr" << std::endl << std::endl; std::cout << " This will accumulate \"dose1.dcm\" (using default dicom io) and \"dose2.dos.gz\" (using virtuos io and plan file dose2.pln) by using \"reg.mapr\" to map dose 2. The resulting dose will be stored in \"result.mhd\"." << std::endl; return 1; } if (appData._showVersion) { - std::cout << std::endl << "Version: " << RTT_FULL_VERSION_STRING; + std::cout << std::endl << "Version: " << RTTB_FULL_VERSION_STRING; return 1; } if (appData._fileCount < 3) { return 2; } return 0; }; } } } diff --git a/demoapps/DoseMap/CMakeLists.txt b/demoapps/DoseMap/CMakeLists.txt index 89153d6..6331182 100644 --- a/demoapps/DoseMap/CMakeLists.txt +++ b/demoapps/DoseMap/CMakeLists.txt @@ -1,3 +1,3 @@ MESSAGE (STATUS "generating demo app: DoseMap - simple dose mapping tool example") -RTTB_CREATE_APPLICATION(DoseMap DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBMatchPointBinding RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK) \ No newline at end of file +RTTB_CREATE_APPLICATION(DoseMap DEPENDS RTTBCore RTTBAlgorithms RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBITKIO RTTBVirtuosIO RTTBDicomIO RTTBHelaxIO PACKAGE_DEPENDS MatchPoint ITK) \ No newline at end of file diff --git a/demoapps/DoseMap/DoseMapApplicationData.cpp b/demoapps/DoseMap/DoseMapApplicationData.cpp index 4e4f189..49d6034 100644 --- a/demoapps/DoseMap/DoseMapApplicationData.cpp +++ b/demoapps/DoseMap/DoseMapApplicationData.cpp @@ -1,175 +1,175 @@ // ----------------------------------------------------------------------- // 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: 741 $ (last changed revision) // @date $Date: 2014-09-16 16:34:22 +0200 (Di, 16 Sep 2014) $ (last change date) // @author $Author: hentsch $ (last changed by) */ #include "DoseMapApplicationData.h" #include "itksys/SystemTools.hxx" #include "itksys/CommandLineArguments.hxx" #include "RTToolboxConfigure.h" namespace rttb { - namespace apps - { - namespace doseMap - { - - int unknown_argument(const char* argument, void* call_data) - { - std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; - return 0; - } - - ApplicationData:: - ApplicationData() - { - this->Reset(); - } - - void - ApplicationData:: - Reset() - { - _inputDoseFileName = ""; - _refDoseFileName = ""; - _outputFileName = ""; - _regFileName = ""; - - _interpolatorName = "linear"; - - _showVersion = false; - _showHelp = false; - - _fileCount = 0; - } - - unsigned int - ParseArgumentsForAppData(int argc, char** argv, ApplicationData& appData) - { - itksys::CommandLineArguments cmdParser; - - appData.Reset(); - - if (argc > 2) - { - appData._inputDoseFileName = argv[1]; - ++appData._fileCount; - --argc; - ++argv; - - appData._outputFileName = argv[1]; - ++appData._fileCount; - --argc; - ++argv; - } - - cmdParser.Initialize(argc, argv); - - cmdParser.SetUnknownArgumentCallback(unknown_argument); - - cmdParser.AddArgument("--interpolator", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._interpolatorName), - "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); - cmdParser.AddArgument("-i", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._interpolatorName), - "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); - - cmdParser.AddArgument("--registration", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._regFileName), - "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); - cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._regFileName), - "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); - - cmdParser.AddArgument("--template", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._refDoseFileName), - "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); - cmdParser.AddArgument("-t", itksys::CommandLineArguments::SPACE_ARGUMENT, - &(appData._refDoseFileName), - "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); - - cmdParser.AddArgument("--loadStyleInput", itksys::CommandLineArguments::MULTI_ARGUMENT, - &(appData._inputDoseLoadStyle), - "Indicates the load style that should be used for the input dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle1 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); - - cmdParser.AddArgument("--loadStyleReference", itksys::CommandLineArguments::MULTI_ARGUMENT, - &(appData._refDoseLoadStyle), - "Indicates the load style that should be used for the reference dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle2 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); - - cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showVersion), - "Shows the version of the program."); - - cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("/h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - cmdParser.AddArgument("/?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), - "Shows this help information for the program."); - - if (!cmdParser.Parse()) - { - std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; - std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << - "Use one of the following flags for more information:" << std::endl; - std::cerr << "-? or --help" << std::endl; - return 3; - }; - - if (appData._showHelp) - { - std::cout << std::endl << "Usage: " << std::endl << std::endl; - std::cout << " DoseMap [options]" << std::endl << std::endl; - std::cout << " Dose1: File path to the input dose." << std::endl; - std::cout << " DoseOutput: File path where the output should be stored." << std::endl << - std::endl; - std::cout << "Command-Line Options:" << std::endl << std::endl; - std::cout << cmdParser.GetHelp() << std::endl << std::endl; - std::cout << " Example:" << std::endl << std::endl; - std::cout << - " DoseMap dose1.mhd result.mhd -r reg.mapr --loadStyleInput itk --loadStyleReference itk" << - std::endl << std::endl; - std::cout << - " This will map \"dose1.mhd\" by using \"reg.mapr\" into the grid geometry of the input dose. The resulting dose will be stored in \"result.mhd\"." - << std::endl; - return 1; - } - - if (appData._showVersion) - { - std::cout << std::endl << "Version: " << RTT_FULL_VERSION_STRING; - return 1; - } - - if (appData._fileCount < 2) - { - return 2; - } - - return 0; - }; - - } - } + namespace apps + { + namespace doseMap + { + + int unknown_argument(const char* argument, void* call_data) + { + std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; + return 0; + } + + ApplicationData:: + ApplicationData() + { + this->Reset(); + } + + void + ApplicationData:: + Reset() + { + _inputDoseFileName = ""; + _refDoseFileName = ""; + _outputFileName = ""; + _regFileName = ""; + + _interpolatorName = "linear"; + + _showVersion = false; + _showHelp = false; + + _fileCount = 0; + } + + unsigned int + ParseArgumentsForAppData(int argc, char** argv, ApplicationData& appData) + { + itksys::CommandLineArguments cmdParser; + + appData.Reset(); + + if (argc > 2) + { + appData._inputDoseFileName = argv[1]; + ++appData._fileCount; + --argc; + ++argv; + + appData._outputFileName = argv[1]; + ++appData._fileCount; + --argc; + ++argv; + } + + cmdParser.Initialize(argc, argv); + + cmdParser.SetUnknownArgumentCallback(unknown_argument); + + cmdParser.AddArgument("--interpolator", itksys::CommandLineArguments::SPACE_ARGUMENT, + &(appData._interpolatorName), + "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); + cmdParser.AddArgument("-i", itksys::CommandLineArguments::SPACE_ARGUMENT, + &(appData._interpolatorName), + "Specifies the interpolator that should be used for mapping. Available options are: \"nn\": nearest neighbour, \"linear\": linear interpolation, \"rosu\" interpolation based on the concept of Rosu et al.. Default interpolator is \"linear\"."); + + cmdParser.AddArgument("--registration", itksys::CommandLineArguments::SPACE_ARGUMENT, + &(appData._regFileName), + "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); + cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &(appData._regFileName), + "Specifies name and location of the registration file that should be used to map the input dose. Default is no mapping, thus an identity transform is used. The registration should be stored as MatchPoint registration."); + + cmdParser.AddArgument("--template", itksys::CommandLineArguments::SPACE_ARGUMENT, + &(appData._refDoseFileName), + "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); + cmdParser.AddArgument("-t", itksys::CommandLineArguments::SPACE_ARGUMENT, + &(appData._refDoseFileName), + "Specifies name and location of the dose file that should be the reference/template for the grid to mapp into. If flag is not specified, the input dose is the reference."); + + cmdParser.AddArgument("--loadStyleInput", itksys::CommandLineArguments::MULTI_ARGUMENT, + &(appData._inputDoseLoadStyle), + "Indicates the load style that should be used for the input dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle1 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); + + cmdParser.AddArgument("--loadStyleReference", itksys::CommandLineArguments::MULTI_ARGUMENT, + &(appData._refDoseLoadStyle), + "Indicates the load style that should be used for the reference dose. Available styles: \"dicom\": normal dicom dose (default); \"virtuos\": load of a virtuos dose (This style is a multi argument. The second argument specifies the virtuos plan file, e.g. : \"--loadStyle2 virtuos myFavorite.pln\"); \"itk\": use itk image loading; \"helax\": load a helax dose (choosing this style, the dose path should only be a directory)."); + + cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showVersion), + "Shows the version of the program."); + + cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), + "Shows this help information for the program."); + cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), + "Shows this help information for the program."); + cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), + "Shows this help information for the program."); + cmdParser.AddArgument("/h", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), + "Shows this help information for the program."); + cmdParser.AddArgument("/?", itksys::CommandLineArguments::NO_ARGUMENT, &(appData._showHelp), + "Shows this help information for the program."); + + if (!cmdParser.Parse()) + { + std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; + std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << + "Use one of the following flags for more information:" << std::endl; + std::cerr << "-? or --help" << std::endl; + return 3; + }; + + if (appData._showHelp) + { + std::cout << std::endl << "Usage: " << std::endl << std::endl; + std::cout << " DoseMap [options]" << std::endl << std::endl; + std::cout << " Dose1: File path to the input dose." << std::endl; + std::cout << " DoseOutput: File path where the output should be stored." << std::endl << + std::endl; + std::cout << "Command-Line Options:" << std::endl << std::endl; + std::cout << cmdParser.GetHelp() << std::endl << std::endl; + std::cout << " Example:" << std::endl << std::endl; + std::cout << + " DoseMap dose1.mhd result.mhd -r reg.mapr --loadStyleInput itk --loadStyleReference itk" << + std::endl << std::endl; + std::cout << + " This will map \"dose1.mhd\" by using \"reg.mapr\" into the grid geometry of the input dose. The resulting dose will be stored in \"result.mhd\"." + << std::endl; + return 1; + } + + if (appData._showVersion) + { + std::cout << std::endl << "Version: " << RTTB_FULL_VERSION_STRING; + return 1; + } + + if (appData._fileCount < 2) + { + return 2; + } + + return 0; + }; + + } + } } diff --git a/demoapps/VoxelizerTool/CMakeLists.txt b/demoapps/VoxelizerTool/CMakeLists.txt index 5e4b54c..95c6539 100644 --- a/demoapps/VoxelizerTool/CMakeLists.txt +++ b/demoapps/VoxelizerTool/CMakeLists.txt @@ -1,3 +1,3 @@ MESSAGE (STATUS "generating demo app: VoxelizerTool - writing files of voxelized structures") -RTTB_CREATE_APPLICATION(VoxelizerTool DEPENDS RTTBITKIO RTTBOTBMask RTTBBoostMask RTTBDicomIO RTTBMasks RTTBCore PACKAGE_DEPENDS MatchPoint ITK BoostBinaries) \ No newline at end of file +RTTB_CREATE_APPLICATION(VoxelizerTool DEPENDS RTTBITKIO RTTBOTBMask RTTBBoostMask RTTBDicomIO RTTBMasks RTTBCore PACKAGE_DEPENDS ITK BoostBinaries) \ No newline at end of file diff --git a/testing/interpolation/CMakeLists.txt b/testing/interpolation/CMakeLists.txt index 9d437b4..44887d7 100644 --- a/testing/interpolation/CMakeLists.txt +++ b/testing/interpolation/CMakeLists.txt @@ -1,30 +1,30 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- SET(INTERPOLATION_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbInterpolationTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) #----------------------------------------------------------------------------- ADD_TEST(SimpleMappableDoseAccessorTest ${INTERPOLATION_TESTS} SimpleMappableDoseAccessorTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") ADD_TEST(RosuMappableDoseAccessorTest ${INTERPOLATION_TESTS} RosuMappableDoseAccessorTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") ADD_TEST(InterpolationTest ${INTERPOLATION_TESTS} InterpolationTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") -IF(BUILD_ITKBinding) - ADD_SUBDIRECTORY(ITKBinding) -ENDIF(BUILD_ITKBinding) -IF(BUILD_MatchPointBinding) - ADD_SUBDIRECTORY(MatchPointBinding) -ENDIF(BUILD_MatchPointBinding) + +ADD_SUBDIRECTORY(InterpolationITKTransformation) + +IF(BUILD_InterpolationMatchPointTransformation) + ADD_SUBDIRECTORY(InterpolationMatchPointTransformation) +ENDIF(BUILD_InterpolationMatchPointTransformation) RTTB_CREATE_TEST_MODULE(rttbInterpolation DEPENDS RTTBInterpolation RTTBDicomIO PACKAGE_DEPENDS Litmus) IF (NOT WIN32) #Minimum CMake Version is 2.8.11. CMake 3.1 provides target_compile_features(RTTB_Interpolation cxx_auto_type cxx_nullptr cxx_override) to automatically add required compiler flags set(CMAKE_CXX_FLAGS "-std=c++11") ENDIF() diff --git a/testing/interpolation/ITKBinding/CMakeLists.txt b/testing/interpolation/InterpolationITKTransformation/CMakeLists.txt similarity index 53% rename from testing/interpolation/ITKBinding/CMakeLists.txt rename to testing/interpolation/InterpolationITKTransformation/CMakeLists.txt index 40d69e0..851cc0a 100644 --- a/testing/interpolation/ITKBinding/CMakeLists.txt +++ b/testing/interpolation/InterpolationITKTransformation/CMakeLists.txt @@ -1,17 +1,17 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- -SET(INTERPOLATION_ITK_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbInterpolationITKTests) +SET(INTERPOLATION_ITK_TRANSFORMATION_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbInterpolationITKTransformationTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) #----------------------------------------------------------------------------- -ADD_TEST(SimpleMappableDoseAccessorWithITKTest ${INTERPOLATION_ITK_TESTS} SimpleMappableDoseAccessorWithITKTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") +ADD_TEST(SimpleMappableDoseAccessorWithITKTest ${INTERPOLATION_ITK_TRANSFORMATION_TESTS} SimpleMappableDoseAccessorWithITKTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") -RTTB_CREATE_TEST_MODULE(rttbInterpolationITK DEPENDS RTTBInterpolation RTTBITKBinding RTTBDicomIO PACKAGE_DEPENDS Litmus ITK) +RTTB_CREATE_TEST_MODULE(rttbInterpolationITKTransformation DEPENDS RTTBInterpolation RTTBInterpolationITKTransformation RTTBDicomIO PACKAGE_DEPENDS Litmus ITK) diff --git a/testing/interpolation/ITKBinding/SimpleMappableDoseAccessorWithITKTest.cpp b/testing/interpolation/InterpolationITKTransformation/SimpleMappableDoseAccessorWithITKTest.cpp similarity index 100% rename from testing/interpolation/ITKBinding/SimpleMappableDoseAccessorWithITKTest.cpp rename to testing/interpolation/InterpolationITKTransformation/SimpleMappableDoseAccessorWithITKTest.cpp diff --git a/testing/interpolation/ITKBinding/files.cmake b/testing/interpolation/InterpolationITKTransformation/files.cmake similarity index 60% rename from testing/interpolation/ITKBinding/files.cmake rename to testing/interpolation/InterpolationITKTransformation/files.cmake index 91a4abc..a815428 100644 --- a/testing/interpolation/ITKBinding/files.cmake +++ b/testing/interpolation/InterpolationITKTransformation/files.cmake @@ -1,7 +1,7 @@ SET(CPP_FILES SimpleMappableDoseAccessorWithITKTest.cpp - rttbITKBindingTests.cpp + rttbInterpolationITKTransformationTests.cpp ) SET(H_FILES ) diff --git a/testing/interpolation/ITKBinding/rttbITKBindingTests.cpp b/testing/interpolation/InterpolationITKTransformation/rttbInterpolationITKTransformationTests.cpp similarity index 100% rename from testing/interpolation/ITKBinding/rttbITKBindingTests.cpp rename to testing/interpolation/InterpolationITKTransformation/rttbInterpolationITKTransformationTests.cpp diff --git a/testing/interpolation/MatchPointBinding/CMakeLists.txt b/testing/interpolation/InterpolationMatchPointTransformation/CMakeLists.txt similarity index 51% rename from testing/interpolation/MatchPointBinding/CMakeLists.txt rename to testing/interpolation/InterpolationMatchPointTransformation/CMakeLists.txt index 6b6ff81..9cfa5c5 100644 --- a/testing/interpolation/MatchPointBinding/CMakeLists.txt +++ b/testing/interpolation/InterpolationMatchPointTransformation/CMakeLists.txt @@ -1,17 +1,17 @@ #----------------------------------------------------------------------------- # Setup the system information test. Write out some basic failsafe # information in case the test doesn't run. #----------------------------------------------------------------------------- -SET(INTERPOLATION_MP_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbInterpolationMPTests) +SET(INTERPOLATION_MP_TRANSFORMATION_TESTS ${EXECUTABLE_OUTPUT_PATH}/rttbInterpolationMPTransformationTests) SET(TEST_DATA_ROOT ${RTTBTesting_SOURCE_DIR}/data) SET(TEMP ${RTTBTesting_BINARY_DIR}/temporary) #----------------------------------------------------------------------------- -ADD_TEST(SimpleMappableDoseAccessorWithMatchPointTest ${INTERPOLATION_MP_TESTS} SimpleMappableDoseAccessorWithMatchPointTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") +ADD_TEST(SimpleMappableDoseAccessorWithMatchPointTest ${INTERPOLATION_MP_TRANSFORMATION_TESTS} SimpleMappableDoseAccessorWithMatchPointTest "${TEST_DATA_ROOT}/DICOM/TestDose/ConstantTwo.dcm" "${TEST_DATA_ROOT}/DICOM/TestDose/LinearIncreaseX.dcm") -RTTB_CREATE_TEST_MODULE(rttbInterpolationMP DEPENDS RTTBInterpolation RTTBMatchPointBinding RTTBDicomIO PACKAGE_DEPENDS Litmus MatchPoint) +RTTB_CREATE_TEST_MODULE(rttbInterpolationMPTransformation DEPENDS RTTBInterpolation RTTBInterpolationMatchPointTransformation RTTBDicomIO PACKAGE_DEPENDS Litmus MatchPoint) diff --git a/testing/interpolation/MatchPointBinding/SimpleMappableDoseAccessorWithMatchPointTest.cpp b/testing/interpolation/InterpolationMatchPointTransformation/SimpleMappableDoseAccessorWithMatchPointTest.cpp similarity index 100% rename from testing/interpolation/MatchPointBinding/SimpleMappableDoseAccessorWithMatchPointTest.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/SimpleMappableDoseAccessorWithMatchPointTest.cpp diff --git a/testing/interpolation/MatchPointBinding/files.cmake b/testing/interpolation/InterpolationMatchPointTransformation/files.cmake similarity index 81% rename from testing/interpolation/MatchPointBinding/files.cmake rename to testing/interpolation/InterpolationMatchPointTransformation/files.cmake index dba2d96..31e7c6d 100644 --- a/testing/interpolation/MatchPointBinding/files.cmake +++ b/testing/interpolation/InterpolationMatchPointTransformation/files.cmake @@ -1,12 +1,12 @@ SET(CPP_FILES SimpleMappableDoseAccessorWithMatchPointTest.cpp - rttbMatchPointBindingTests.cpp + rttbInterpolationMatchPointTests.cpp registrationHelper.cpp simpleRegistrationWorkflow.cpp ) SET(H_FILES simpleRegistrationWorkflow.h registrationTest.h registrationHelper.h ) diff --git a/testing/interpolation/MatchPointBinding/registrationHelper.cpp b/testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.cpp similarity index 100% rename from testing/interpolation/MatchPointBinding/registrationHelper.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.cpp diff --git a/testing/interpolation/MatchPointBinding/registrationHelper.h b/testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.h similarity index 100% rename from testing/interpolation/MatchPointBinding/registrationHelper.h rename to testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.h diff --git a/testing/interpolation/MatchPointBinding/registrationTest.h b/testing/interpolation/InterpolationMatchPointTransformation/registrationTest.h similarity index 100% rename from testing/interpolation/MatchPointBinding/registrationTest.h rename to testing/interpolation/InterpolationMatchPointTransformation/registrationTest.h diff --git a/testing/interpolation/MatchPointBinding/rttbMatchPointBindingTests.cpp b/testing/interpolation/InterpolationMatchPointTransformation/rttbInterpolationMatchPointTests.cpp similarity index 100% rename from testing/interpolation/MatchPointBinding/rttbMatchPointBindingTests.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/rttbInterpolationMatchPointTests.cpp diff --git a/testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.cpp b/testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.cpp similarity index 100% rename from testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.cpp diff --git a/testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.h b/testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.h similarity index 100% rename from testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.h rename to testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.h