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 aceb178..4a6fde3 100644 --- a/code/algorithms/rttbBinaryFunctorAccessor.h +++ b/code/algorithms/rttbBinaryFunctorAccessor.h @@ -1,103 +1,101 @@ // ----------------------------------------------------------------------- // 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 __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; 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 90% rename from code/interpolation/ITKBinding/rttbITKTransformation.cpp rename to code/interpolation/ITKTransformation/rttbITKTransformation.cpp index 23686cd..4691acc 100644 --- a/code/interpolation/ITKBinding/rttbITKTransformation.cpp +++ b/code/interpolation/ITKTransformation/rttbITKTransformation.cpp @@ -1,91 +1,91 @@ // ----------------------------------------------------------------------- // 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: 484 $ (last changed revision) +// @date $Date: 2014-03-26 16:16:16 +0100 (Mi, 26 Mrz 2014) $ (last change date) +// @author $Author: hentsch $ (last changed by) */ #include "rttbITKTransformation.h" #include "rttbNullPointerException.h" namespace rttb { namespace interpolation { ITKTransformation::ITKTransformation(const Transform3D3DType* aTransformation): _pTransformation(aTransformation) { //handle null pointer if (aTransformation == NULL) { throw core::NullPointerException("Pointer to registration is NULL."); } } void ITKTransformation::convert(const WorldCoordinate3D& aWorldCoordinate, InputPointType& aInputPoint) const { assert(aWorldCoordinate.size() == 3); assert(aInputPoint.Length == 3); for (unsigned int i = 0; i < aInputPoint.Length; ++i) { aInputPoint[i] = aWorldCoordinate[i]; } } void ITKTransformation::convert(const OutputPointType& aOutputPoint, WorldCoordinate3D& aWorldCoordinate) const { assert(aWorldCoordinate.size() == 3); assert(aOutputPoint.Length == 3); for (unsigned int i = 0; i < aOutputPoint.Length; ++i) { aWorldCoordinate[i] = aOutputPoint[i]; } } bool ITKTransformation::transformInverse(const WorldCoordinate3D& worldCoordinateTarget, WorldCoordinate3D& worldCoordinateMoving) const { InputPointType aTargetPoint; OutputPointType aMovingPoint; convert(worldCoordinateTarget, aTargetPoint); aMovingPoint = _pTransformation->TransformPoint(aTargetPoint); convert(aMovingPoint, worldCoordinateMoving); //TransformPoint has no return value... return true; } bool ITKTransformation::transform(const WorldCoordinate3D& worldCoordinateMoving, WorldCoordinate3D& worldCoordinateTarget) const { OutputPointType aTargetPoint; InputPointType aMovingPoint; convert(worldCoordinateMoving, aMovingPoint); aTargetPoint = _pTransformation->TransformPoint(aMovingPoint); convert(aTargetPoint, worldCoordinateTarget); //TransformPoint has no return value... return true; } } } diff --git a/code/interpolation/ITKBinding/rttbITKTransformation.h b/code/interpolation/ITKTransformation/rttbITKTransformation.h similarity index 91% rename from code/interpolation/ITKBinding/rttbITKTransformation.h rename to code/interpolation/ITKTransformation/rttbITKTransformation.h index 641b7b2..5d682e5 100644 --- a/code/interpolation/ITKBinding/rttbITKTransformation.h +++ b/code/interpolation/ITKTransformation/rttbITKTransformation.h @@ -1,81 +1,81 @@ // ----------------------------------------------------------------------- // 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: 484 $ (last changed revision) +// @date $Date: 2014-03-26 16:16:16 +0100 (Mi, 26 Mrz 2014) $ (last change date) +// @author $Author: hentsch $ (last changed by) */ #ifndef __ITK_MAPPABLE_DOSE_ACCESSOR_H #define __ITK_MAPPABLE_DOSE_ACCESSOR_H #include #include "itkTransform.h" #include "rttbDoseAccessorInterface.h" #include "rttbTransformationInterface.h" namespace rttb { namespace interpolation { /*! @class ITKMappableDoseAccessor @brief This class can deal with dose information that has to be transformed into another geometry than the original dose image (transformation specified by ITK transformation object). */ class ITKTransformation: public TransformationInterface { public: static const unsigned int InputDimension3D = 3; static const unsigned int OutputDimension3D = 3; typedef double TransformScalarType; typedef itk::Transform Transform3D3DType; typedef Transform3D3DType::InputPointType InputPointType; typedef Transform3D3DType::OutputPointType OutputPointType; typedef boost::shared_ptr Pointer; private: //! Has to be a Pointer type because of inheritance issues with itkSmartPointer (that doesn't recognize the inheritance) const Transform3D3DType* _pTransformation; protected: void convert(const WorldCoordinate3D& aWorldCoordinate, InputPointType& aInputPoint) const; void convert(const OutputPointType& aOutputPoint, WorldCoordinate3D& aWorldCoordinate) const; public: /*! @brief Constructor. @param aRegistration registration given in MatchPoint format (note the pointer format since itkSmartPointer does not support inheritance) @sa MappableDoseAccessorBase @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 */ ITKTransformation(const Transform3D3DType* aTransformation); ~ITKTransformation() {}; /*! @brief performs a transformation targetImage --> movingImage */ bool transformInverse(const WorldCoordinate3D& worldCoordinateTarget, WorldCoordinate3D& worldCoordinateMoving) const; /*! @brief performs a transformation movingImage --> targetImage */ bool transform(const WorldCoordinate3D& worldCoordinateMoving, WorldCoordinate3D& worldCoordinateTarget) const; }; } } #endif 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 53d78aa..b6b08c4 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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (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 a42cb47..b893065 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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (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 95% rename from testing/interpolation/ITKBinding/SimpleMappableDoseAccessorWithITKTest.cpp rename to testing/interpolation/InterpolationITKTransformation/SimpleMappableDoseAccessorWithITKTest.cpp index 1db0910..8e8a406 100644 --- a/testing/interpolation/ITKBinding/SimpleMappableDoseAccessorWithITKTest.cpp +++ b/testing/interpolation/InterpolationITKTransformation/SimpleMappableDoseAccessorWithITKTest.cpp @@ -1,188 +1,188 @@ // ----------------------------------------------------------------------- // 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) */ #include "litCheckMacros.h" #include "rttbBaseType.h" #include "rttbGenericDoseIterator.h" #include "rttbDicomFileDoseAccessorGenerator.h" #include "rttbSimpleMappableDoseAccessor.h" #include "rttbNearestNeighborInterpolation.h" #include "rttbLinearInterpolation.h" #include "rttbTransformationInterface.h" #include "rttbITKTransformation.h" #include "rttbNullPointerException.h" #include "itkTranslationTransform.h" namespace rttb { namespace testing { typedef core::GenericDoseIterator::DoseAccessorPointer DoseAccessorPointer; typedef rttb::interpolation::SimpleMappableDoseAccessor SimpleMappableDoseAccessor; typedef rttb::interpolation::NearestNeighborInterpolation NearestNeighborInterpolation; typedef rttb::interpolation::LinearInterpolation LinearInterpolation; typedef rttb::interpolation::TransformationInterface TransformationInterface; typedef rttb::interpolation::ITKTransformation ITKTransformation; typedef itk::TranslationTransform TranslationTransformType; /*! @brief SimpleMappableDoseAccessorWithITKTest - test the API of SimpleMappableDoseAccessor with ITK transformation 1) Test constructor 2) test getDoseAt() a) with Identity transform b) with translation transform */ int SimpleMappableDoseAccessorWithITKTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string RTDOSE_FILENAME_CONSTANT_TWO; std::string RTDOSE_FILENAME_INCREASE_X; if (argc > 2) { RTDOSE_FILENAME_CONSTANT_TWO = argv[1]; RTDOSE_FILENAME_INCREASE_X = argv[2]; } else { std::cout << "at least two parameters for SimpleMappableDoseAccessorWithITKTest are expected" << std::endl; return -1; } const double doseGridScaling = 2.822386e-005; rttb::io::dicom::DicomFileDoseAccessorGenerator doseAccessorGenerator1( RTDOSE_FILENAME_CONSTANT_TWO.c_str()); DoseAccessorPointer doseAccessor1(doseAccessorGenerator1.generateDoseAccessor()); rttb::io::dicom::DicomFileDoseAccessorGenerator doseAccessorGenerator2( RTDOSE_FILENAME_INCREASE_X.c_str()); DoseAccessorPointer doseAccessor2(doseAccessorGenerator2.generateDoseAccessor()); core::GeometricInfo doseAccessor1GeometricInfo = doseAccessor1->getGeometricInfo(); NearestNeighborInterpolation::Pointer interpolationNN = NearestNeighborInterpolation::Pointer(new NearestNeighborInterpolation()); LinearInterpolation::Pointer interpolationLinear = LinearInterpolation::Pointer (new LinearInterpolation()); //auto transformITKIdentity = TransformationInterface::Pointer(new ITKTransformation( // IdentityTransformType::New())); TranslationTransformType::Pointer transformITKIdentityTemporary = TranslationTransformType::New(); TranslationTransformType::OutputVectorType translationIdentity; translationIdentity[0] = 0.0; translationIdentity[1] = 0.0; translationIdentity[2] = 0.0; transformITKIdentityTemporary->Translate(translationIdentity); TransformationInterface::Pointer transformITKIdentity = TransformationInterface::Pointer(new ITKTransformation( transformITKIdentityTemporary)); TranslationTransformType::Pointer transformITKTranslationTemporary = TranslationTransformType::New(); TranslationTransformType::OutputVectorType translation; translation[0] = 5.0; translation[1] = 5.0; translation[2] = 5.0; transformITKTranslationTemporary->Translate(translation); TransformationInterface::Pointer transformITKTranslation = TransformationInterface::Pointer(new ITKTransformation( transformITKTranslationTemporary)); SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorITKIdentity = SimpleMappableDoseAccessor::Pointer( new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformITKIdentity, interpolationLinear)); SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorITKTranslation = SimpleMappableDoseAccessor::Pointer( new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformITKTranslation, interpolationLinear)); //1) Test constructor CHECK_NO_THROW(SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformITKIdentity, interpolationLinear)); CHECK_NO_THROW(SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformITKTranslation, interpolationLinear)); CHECK_NO_THROW(ITKTransformation(transformITKTranslationTemporary.GetPointer())); CHECK_THROW_EXPLICIT(ITKTransformation(NULL), core::NullPointerException); //2) test getDoseAt() // a) with Identity transform //test valid voxels std::vector voxelsAsIndexToTest; std::vector expectedValues; voxelsAsIndexToTest.push_back(VoxelGridIndex3D(5, 9, 8)); voxelsAsIndexToTest.push_back(VoxelGridIndex3D(22, 15, 10)); voxelsAsIndexToTest.push_back(VoxelGridIndex3D(30, 20, 7)); expectedValues.push_back(5.0 * doseGridScaling); expectedValues.push_back(22.0 * doseGridScaling); expectedValues.push_back(30.0 * doseGridScaling); //convert VoxelGridIndex3D to VoxelGridID for (int i = 0; i < voxelsAsIndexToTest.size(); i++) { VoxelGridID currentId; doseAccessor1GeometricInfo.convert(voxelsAsIndexToTest.at(i), currentId); //test if the expected interpolation values are computed CHECK_EQUAL(aSimpleMappableDoseAccessorITKIdentity->getValueAt(voxelsAsIndexToTest.at(i)), expectedValues.at(i)); //test if getDoseAt(VoxelGridIndex3D) and getDoseAt(VoxelGridD) lead to the same results CHECK_EQUAL(aSimpleMappableDoseAccessorITKIdentity->getValueAt(voxelsAsIndexToTest.at(i)), aSimpleMappableDoseAccessorITKIdentity->getValueAt(currentId)); } //no tests with invalid IDs, this has been done already tested in SimpleMappableDoseAccessorTest //b) with translation transform //translation of one voxel in each direction expectedValues.clear(); expectedValues.push_back(6.0 * doseGridScaling); expectedValues.push_back(23.0 * doseGridScaling); expectedValues.push_back(31.0 * doseGridScaling); for (int i = 0; i < voxelsAsIndexToTest.size(); i++) { VoxelGridID currentId; doseAccessor1GeometricInfo.convert(voxelsAsIndexToTest.at(i), currentId); //test if the expected interpolation values are computed CHECK_EQUAL(aSimpleMappableDoseAccessorITKTranslation->getValueAt(voxelsAsIndexToTest.at(i)), expectedValues.at(i)); //test if getDoseAt(VoxelGridIndex3D) and getDoseAt(VoxelGridD) lead to the same results CHECK_EQUAL(aSimpleMappableDoseAccessorITKTranslation->getValueAt(voxelsAsIndexToTest.at(i)), aSimpleMappableDoseAccessorITKTranslation->getValueAt(currentId)); } RETURN_AND_REPORT_TEST_SUCCESS; } }//end namespace testing }//end namespace rttb 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 96% rename from testing/interpolation/MatchPointBinding/SimpleMappableDoseAccessorWithMatchPointTest.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/SimpleMappableDoseAccessorWithMatchPointTest.cpp index aba9544..446f5ef 100644 --- a/testing/interpolation/MatchPointBinding/SimpleMappableDoseAccessorWithMatchPointTest.cpp +++ b/testing/interpolation/InterpolationMatchPointTransformation/SimpleMappableDoseAccessorWithMatchPointTest.cpp @@ -1,252 +1,252 @@ // ----------------------------------------------------------------------- // 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) */ #include "litCheckMacros.h" #include "rttbBaseType.h" #include "rttbGenericDoseIterator.h" #include "rttbDicomFileDoseAccessorGenerator.h" #include "rttbSimpleMappableDoseAccessor.h" #include "rttbNearestNeighborInterpolation.h" #include "rttbLinearInterpolation.h" #include "rttbGeometricInfo.h" #include "rttbTransformationInterface.h" #include "rttbMatchPointTransformation.h" #include "rttbNullPointerException.h" #include "registrationTest.h" #include "simpleRegistrationWorkflow.h" namespace rttb { namespace testing { static const unsigned int TargetDimension3D = 3; static const unsigned int MovingDimension3D = 3; typedef core::GenericDoseIterator::DoseAccessorPointer DoseAccessorPointer; typedef rttb::interpolation::SimpleMappableDoseAccessor SimpleMappableDoseAccessor; typedef map::core::RegistrationTest Registration3D3DTypeTest; typedef Registration3D3DTypeTest::Pointer Registration3D3DTypeTestPointer; typedef map::core::Registration Registration3D3DType; typedef Registration3D3DType::Pointer Registration3D3DPointer; typedef rttb::interpolation::NearestNeighborInterpolation NearestNeighborInterpolation; typedef rttb::interpolation::LinearInterpolation LinearInterpolation; typedef rttb::interpolation::TransformationInterface TransformationInterface; typedef rttb::interpolation::MatchPointTransformation MatchPointTransformation; /*! @brief SimpleMappableDoseAccessorWithMatchPointTest - test the API of SimpleMappableDoseAccessor with MatchPoint transform 1) Test constructor 2) test getDoseAt() a) with Identity transform b) with translation transform [3) test with rigid registration optional (if filenames are given as argument)] */ int SimpleMappableDoseAccessorWithMatchPointTest(int argc, char* argv[]) { PREPARE_DEFAULT_TEST_REPORTING; std::string RTDOSE_FILENAME_CONSTANT_TWO; std::string RTDOSE_FILENAME_INCREASE_X; std::string RTDOSE_FILENAME_REALISTIC = ""; std::string CT_PLANNING = ""; std::string CT_FRACTION = ""; if (argc > 2) { RTDOSE_FILENAME_CONSTANT_TWO = argv[1]; RTDOSE_FILENAME_INCREASE_X = argv[2]; } else { std::cout << "at least two parameters for SimpleMappableDoseAccessorWithMatchPointTest are expected" << std::endl; return -1; } if (argc > 5) { RTDOSE_FILENAME_REALISTIC = argv[3]; CT_PLANNING = argv[4]; CT_FRACTION = argv[5]; } rttb::io::dicom::DicomFileDoseAccessorGenerator doseAccessorGenerator1( RTDOSE_FILENAME_CONSTANT_TWO.c_str()); DoseAccessorPointer doseAccessor1(doseAccessorGenerator1.generateDoseAccessor()); DoseAccessorPointer doseAccessorNull; rttb::io::dicom::DicomFileDoseAccessorGenerator doseAccessorGenerator2( RTDOSE_FILENAME_INCREASE_X.c_str()); DoseAccessorPointer doseAccessor2(doseAccessorGenerator2.generateDoseAccessor()); core::GeometricInfo doseAccessor1GeometricInfo = doseAccessor1->getGeometricInfo(); Registration3D3DTypeTestPointer registration = Registration3D3DTypeTest::New(); double translation[] = {0.0, 0.0, 0.0}; registration->_translation = translation; registration->_limitedTarget = false; NearestNeighborInterpolation::Pointer interpolationNN = NearestNeighborInterpolation::Pointer(new NearestNeighborInterpolation()); LinearInterpolation::Pointer interpolationLinear = LinearInterpolation::Pointer (new LinearInterpolation()); NearestNeighborInterpolation::Pointer interpolationNull; TransformationInterface::Pointer transformMP = TransformationInterface::Pointer(new MatchPointTransformation( registration.GetPointer())); SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorMPIdentityLinear = SimpleMappableDoseAccessor::Pointer( new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationLinear)); SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorMPIdentityNN = SimpleMappableDoseAccessor::Pointer( new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationNN)); //1) Test constructor CHECK_NO_THROW(SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationLinear)); CHECK_NO_THROW(SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationNN)); CHECK_NO_THROW(MatchPointTransformation(registration.GetPointer())); CHECK_THROW_EXPLICIT(MatchPointTransformation(NULL), core::NullPointerException); //2) test getDoseAt() // a) with Identity transform double vectorDoseAccessorStartEnd = 0.0; while (vectorDoseAccessorStartEnd <= 1.0) { VoxelGridID runningID = (VoxelGridID)(vectorDoseAccessorStartEnd * (double)aSimpleMappableDoseAccessorMPIdentityLinear->getGridSize()); CHECK_EQUAL(aSimpleMappableDoseAccessorMPIdentityLinear->getValueAt(runningID), doseAccessor2->getValueAt(runningID)); CHECK_EQUAL(aSimpleMappableDoseAccessorMPIdentityNN->getValueAt(runningID), doseAccessor2->getValueAt(runningID)); vectorDoseAccessorStartEnd += 0.1; } // b) with translation transform //Second: Translation (5mm/5mm/5mm) --> in voxel: (1/1/1) as pixelspacing = 5 mm translation[0] = translation[1] = translation[2] = 5.0; registration->_translation = translation; SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorMPTranslationLinear = SimpleMappableDoseAccessor::Pointer(new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationLinear)); SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorMPTranslationNN = SimpleMappableDoseAccessor::Pointer( new SimpleMappableDoseAccessor( doseAccessor1GeometricInfo, doseAccessor2, transformMP, interpolationNN)); rttb::VoxelGridIndex3D aIndexBeforeTransformation(0, 0, 0); rttb::VoxelGridIndex3D aIndexAfterTransformation(1, 1, 1); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationLinear->getValueAt(aIndexBeforeTransformation), doseAccessor2->getValueAt(aIndexAfterTransformation)); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationNN->getValueAt(aIndexBeforeTransformation), doseAccessor2->getValueAt(aIndexAfterTransformation)); rttb::VoxelGridIndex3D aIndexBeforeTransformation2(20, 10, 10); rttb::VoxelGridIndex3D aIndexAfterTransformation2(21, 11, 11); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationLinear->getValueAt(aIndexBeforeTransformation2), doseAccessor2->getValueAt(aIndexAfterTransformation2)); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationNN->getValueAt(aIndexBeforeTransformation2), doseAccessor2->getValueAt(aIndexAfterTransformation2)); rttb::VoxelGridIndex3D aIndexBeforeTransformation3( aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumColumns() - 2, aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumRows() - 2, aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumSlices() - 2); rttb::VoxelGridIndex3D aIndexAfterTransformation3( aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumColumns() - 1, aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumRows() - 1, aSimpleMappableDoseAccessorMPTranslationLinear->getGeometricInfo().getNumSlices() - 1); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationLinear->getValueAt(aIndexBeforeTransformation3), doseAccessor2->getValueAt(aIndexAfterTransformation3)); CHECK_EQUAL(aSimpleMappableDoseAccessorMPTranslationNN->getValueAt(aIndexBeforeTransformation3), doseAccessor2->getValueAt(aIndexAfterTransformation3)); if (RTDOSE_FILENAME_REALISTIC != "" && CT_FRACTION != "" && CT_PLANNING != "") { //3) test with rigid registration //realistic background: registration from BP-CT to fraction CT, apply on planning dose that is based on BP-CT (proof of concept) //Target image: fraction CT, Moving image: planning CT simpleRegistrationWorkflow prepareRegistrationRealisticScenario(CT_FRACTION, CT_PLANNING, true); Registration3D3DPointer registrationRealisticScenario = prepareRegistrationRealisticScenario.getRegistration(); TransformationInterface::Pointer transformRealistic = TransformationInterface::Pointer(new MatchPointTransformation( registrationRealisticScenario)); io::dicom::DicomFileDoseAccessorGenerator doseAccessorGenerator3(RTDOSE_FILENAME_REALISTIC.c_str()); DoseAccessorPointer doseAccessor3(doseAccessorGenerator3.generateDoseAccessor()); core::GeometricInfo geoInfoRealistic; geoInfoRealistic.setNumColumns( prepareRegistrationRealisticScenario.getTargetImage()->GetLargestPossibleRegion().GetSize()[0]); geoInfoRealistic.setNumRows( prepareRegistrationRealisticScenario.getTargetImage()->GetLargestPossibleRegion().GetSize()[1]); geoInfoRealistic.setNumSlices( prepareRegistrationRealisticScenario.getTargetImage()->GetLargestPossibleRegion().GetSize()[2]); //Dose is related to BP-CT, map dose to fraction CT geometry SimpleMappableDoseAccessor::Pointer aSimpleMappableDoseAccessorRealisticScenarioLinear = SimpleMappableDoseAccessor::Pointer(new SimpleMappableDoseAccessor(geoInfoRealistic, doseAccessor3, transformRealistic, interpolationLinear)); //combination of 0, size/2 and size to check as coordinates std::vector coordinatesToCheckX, coordinatesToCheckY, coordinatesToCheckZ; coordinatesToCheckX.push_back(0); coordinatesToCheckX.push_back(geoInfoRealistic.getNumColumns() / 2); coordinatesToCheckX.push_back(geoInfoRealistic.getNumColumns() - 1); coordinatesToCheckY.push_back(0); coordinatesToCheckY.push_back(geoInfoRealistic.getNumRows() / 2); coordinatesToCheckY.push_back(geoInfoRealistic.getNumRows() - 1); coordinatesToCheckZ.push_back(0); coordinatesToCheckZ.push_back(geoInfoRealistic.getNumSlices() / 2); coordinatesToCheckZ.push_back(geoInfoRealistic.getNumSlices() - 1); //Pixels are inside the fraction CT image and mapping should work (even if they map outside of doseAccessor3) for (unsigned int i = 0; i < coordinatesToCheckX.size(); ++i) { for (unsigned int j = 0; j < coordinatesToCheckY.size(); ++j) { for (unsigned int k = 0; k < coordinatesToCheckZ.size(); ++k) { CHECK_NO_THROW(aSimpleMappableDoseAccessorRealisticScenarioLinear->getValueAt(VoxelGridIndex3D( coordinatesToCheckX.at(i), coordinatesToCheckY.at(j), coordinatesToCheckZ.at(k)))); } } } } RETURN_AND_REPORT_TEST_SUCCESS; } }//end namespace testing }//end namespace rttb 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 89% rename from testing/interpolation/MatchPointBinding/registrationHelper.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.cpp index 8a21f65..4aa1dd9 100644 --- a/testing/interpolation/MatchPointBinding/registrationHelper.cpp +++ b/testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.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: 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) */ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #include "registrationHelper.h" #include "litTestImageIO.h" #include "litCheckMacros.h" #include "litImageTester.h" #include "litPointSetTester.h" #include int setImageFileNames(std::string targetImage, std::string movingImage, bool isDirectory, AppGlobals& globals) { globals.targetImageFileName = targetImage; globals.movingImageFileName = movingImage; globals.isDirectory = isDirectory; return EXIT_SUCCESS; } int loadData(AppGlobals& globals) { if (!globals.isDirectory) { globals.spTargetImage = lit::TestImageIO::InternalImageType>::readImage( globals.targetImageFileName); } else { globals.spTargetImage = map::io::readImage (globals.targetImageFileName, map::io::ImageSeriesReadStyle::Dicom); } if (globals.spTargetImage.IsNull()) { std::cerr << "Error. Cannot load target image: " << globals.targetImageFileName << std::endl; return EXIT_FAILURE; } if (!globals.isDirectory) { globals.spMovingImage = lit::TestImageIO::InternalImageType>::readImage( globals.movingImageFileName); } else { globals.spMovingImage = map::io::readImage (globals.movingImageFileName, map::io::ImageSeriesReadStyle::Dicom); } if (globals.spMovingImage.IsNull()) { std::cerr << "Error. Cannot load moving image: " << globals.movingImageFileName << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; } AppGlobals::AppGlobals() { }; \ No newline at end of file diff --git a/testing/interpolation/MatchPointBinding/registrationHelper.h b/testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.h similarity index 85% rename from testing/interpolation/MatchPointBinding/registrationHelper.h rename to testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.h index ee79206..dc788b3 100644 --- a/testing/interpolation/MatchPointBinding/registrationHelper.h +++ b/testing/interpolation/InterpolationMatchPointTransformation/registrationHelper.h @@ -1,56 +1,56 @@ // ----------------------------------------------------------------------- // 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) */ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #ifndef __REGISTRATION_HELPER_H #define __REGISTRATION_HELPER_H #include "mapContinuousElements.h" #include "mapDiscreteElements.h" #include "mapImageReader.h" typedef map::core::discrete::Elements<3>::InternalImageType ImageType; typedef map::core::continuous::Elements<3>::InternalPointSetType LandmarksType; struct AppGlobals { std::string targetImageFileName; std::string movingImageFileName; bool isDirectory; ImageType::Pointer spTargetImage; ImageType::Pointer spMovingImage; ImageType::Pointer spResultImage; AppGlobals(); }; int setImageFileNames(std::string targetImage, std::string movingImage, bool isDirectory, AppGlobals& globals); int loadData(AppGlobals& globals); #endif \ No newline at end of file diff --git a/testing/interpolation/MatchPointBinding/registrationTest.h b/testing/interpolation/InterpolationMatchPointTransformation/registrationTest.h similarity index 89% rename from testing/interpolation/MatchPointBinding/registrationTest.h rename to testing/interpolation/InterpolationMatchPointTransformation/registrationTest.h index 3a8663d..131c9ff 100644 --- a/testing/interpolation/MatchPointBinding/registrationTest.h +++ b/testing/interpolation/InterpolationMatchPointTransformation/registrationTest.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 __REGISTRATION_TEST_H #define __REGISTRATION_TEST_H #include "mapRegistration.h" namespace map { namespace core { /*! @class TestRegistration @brief Simple implementation of MatchPoint Registration class with direct access to mapping. */ template class RegistrationTest: public Registration { public: typedef RegistrationTest Self; typedef RegistrationBase Superclass; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef typename Registration::TargetPointType TargetPointType; typedef typename Registration::MovingPointType MovingPointType; itkTypeMacro(RegistrationTest, Registration); itkNewMacro(Self); bool _limitedTarget; double* _translation; RegistrationTest() {}; ~RegistrationTest() { }; virtual bool mapPointInverse(const TargetPointType& inPoint, MovingPointType& outPoint) const { for (unsigned int i = 0; i < VTargetDimensions; i++) { outPoint[i] = inPoint[i] + _translation[i]; } return true; }; virtual bool hasLimitedTargetRepresentation() const { return _limitedTarget; } private: RegistrationTest(const Self& source); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } } #endif 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 91% rename from testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.cpp rename to testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.cpp index e2c0502..b8810f4 100644 --- a/testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.cpp +++ b/testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.cpp @@ -1,113 +1,113 @@ // ----------------------------------------------------------------------- // 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) */ #undef MAP_SEAL_ALGORITHMS #include "simpleRegistrationWorkflow.h" #include "registrationHelper.h" simpleRegistrationWorkflow::simpleRegistrationWorkflow(std::string targetFilename, std::string movingFilename, bool isDirectory) { _targetFilename = targetFilename; _movingFilename = movingFilename; setImageFileNames(_targetFilename, _movingFilename, isDirectory, globals); loadData(globals); _spAlgorithmEuler = NULL; } vnl_vector simpleRegistrationWorkflow::getRegistrationParameters( Registration3D3DPointer reg) { typedef map::core::ModelBasedRegistrationKernel<3, 3> ModelBasedRegistrationKernel3D3D; const ModelBasedRegistrationKernel3D3D* pModelBasedDirectKernel3D3D = dynamic_cast(&(reg->getDirectMapping())); if (pModelBasedDirectKernel3D3D) { ModelBasedRegistrationKernel3D3D::ParametersType params = pModelBasedDirectKernel3D3D->getTransformModel()->GetParameters(); return params; } else { return vnl_vector(); } } void simpleRegistrationWorkflow::initializeAndPerformRegistration() { _spAlgorithmEuler = AlgorithmTypeEuler::New(); _spAlgorithmEuler->setProperty("PreinitTransform", map::core::MetaProperty::New(true)); _spAlgorithmEuler->setMovingImage(globals.spMovingImage); _spAlgorithmEuler->setTargetImage(globals.spTargetImage); AlgorithmTypeEuler::RegistrationType::Pointer spRegistration; try { spRegistration = _spAlgorithmEuler->getRegistration(); } catch (const map::core::ExceptionObject& e) { std::cerr << "caught an MatchPoint exception:\n"; e.Print(std::cerr); std::cerr << "\n"; } catch (const itk::ExceptionObject& e) { std::cerr << "caught an ITK exception:\n"; std::cerr << e.GetFile() << ":" << e.GetLine() << ":\n" << e.GetDescription() << "\n"; } catch (const std::exception& e) { std::cerr << "caught an exception:\n"; std::cerr << e.what() << "\n"; } catch (...) { std::cerr << "caught an unknown exception!!!\n"; } } map::core::Registration<3, 3>::Pointer simpleRegistrationWorkflow::getRegistration() { if (_spAlgorithmEuler.IsNull()) { initializeAndPerformRegistration(); } return _spAlgorithmEuler->getRegistration(); }; const itk::Image* simpleRegistrationWorkflow::getTargetImage() { if (_spAlgorithmEuler.IsNull()) { initializeAndPerformRegistration(); } return _spAlgorithmEuler->getTargetImage(); }; diff --git a/testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.h b/testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.h similarity index 88% rename from testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.h rename to testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.h index 75baffa..71912da 100644 --- a/testing/interpolation/MatchPointBinding/simpleRegistrationWorkflow.h +++ b/testing/interpolation/InterpolationMatchPointTransformation/simpleRegistrationWorkflow.h @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // 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 __SIMPLE_REGISTRATION_WORKFLOW_H #define __SIMPLE_REGISTRATION_WORKFLOW_H #include #include "registrationHelper.h" #include "mapImageMappingTask.h" #include "mapITKEuler3DMattesMIRegistrationAlgorithmTemplate.h" #include "mapExceptionObject.h" /*! @class simpleRegistrationWorkflow @brief implements a concrete registration algorithm of MatchPoint */ class simpleRegistrationWorkflow { public: typedef map::core::Registration<3, 3> Registration3D3DType; typedef Registration3D3DType::Pointer Registration3D3DPointer; typedef map::algorithm::boxed::ITKEuler3DMattesMIRegistrationAlgorithm AlgorithmTypeEuler; private: std::string _targetFilename; std::string _movingFilename; std::string _targetDirectory; std::string _movingDirectory; AppGlobals globals; AlgorithmTypeEuler::Pointer _spAlgorithmEuler; public: /*! @brief Constructor */ simpleRegistrationWorkflow(std::string targetFilename, std::string movingFilename, bool isDirectory = false); map::core::Registration<3, 3>::Pointer getRegistration(); const itk::Image* getTargetImage(); vnl_vector getRegistrationParameters(Registration3D3DPointer reg); protected: void initializeAndPerformRegistration(); }; #endif \ No newline at end of file