diff --git a/code/core/rttbDVHSet.h b/code/core/rttbDVHSet.h index 95a6d58..3901994 100644 --- a/code/core/rttbDVHSet.h +++ b/code/core/rttbDVHSet.h @@ -1,125 +1,126 @@ // ----------------------------------------------------------------------- // 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 __DVH_SET_H #define __DVH_SET_H #include #include #include #include "rttbBaseType.h" #include "rttbDVH.h" namespace rttb{ namespace core{ /*! @class DVHSet - @brief This is a class representing a RT DVHSet including Target Volume and Organ at Risk - A DVHSet consists of three subsets: one for the target volume (_dvhTVSet), one for healthy tissue (_dvhHTSet), - and one for the whole volume (_dvhWVSet). + @brief This is a class representing a RT DVHSet including Target Volume and Organ at Risk + A DVHSet consists of three subsets: one for the target volume (_dvhTVSet), one for healthy tissue (_dvhHTSet), + and one for the whole volume (_dvhWVSet). */ class DVHSet - { - public: - typedef std::vector DVHSetType; + { + public: + typedef std::vector DVHSetType; + typedef DVHSetType::size_type IndexType; - private: - IDType _structureSetID; - IDType _doseID; - DVHSetType _dvhTVSet; - DVHSetType _dvhHTSet; - DVHSetType _dvhWVSet; + private: + IDType _structureSetID; + IDType _doseID; + DVHSetType _dvhTVSet; + DVHSetType _dvhHTSet; + DVHSetType _dvhWVSet; - public: - DVHSet(IDType aStructureSetID="", IDType aDoseID=""); - DVHSet(DVHSetType aDVHTVSet, DVHSetType aDVHHTSet, IDType aStructureSetID="", IDType aDoseID=""); - DVHSet(DVHSetType aDVHTVSet, DVHSetType aDVHHTSet, DVHSetType aDVHWVSet, IDType aStructureSetID="", - IDType aDoseID=""); + public: + DVHSet(IDType aStructureSetID="", IDType aDoseID=""); + DVHSet(DVHSetType aDVHTVSet, DVHSetType aDVHHTSet, IDType aStructureSetID="", IDType aDoseID=""); + DVHSet(DVHSetType aDVHTVSet, DVHSetType aDVHHTSet, DVHSetType aDVHWVSet, IDType aStructureSetID="", + IDType aDoseID=""); - /*! @brief Get the size of the DVHSet, that is the sum of the numbers of DVHs in all sub-sets. - */ - std::size_t size() const; + /*! @brief Get the size of the DVHSet, that is the sum of the numbers of DVHs in all sub-sets. + */ + std::size_t size() const; - void setStrSetID(IDType aStrSetID); - void setDoseID(IDType aDoseID); + void setStrSetID(IDType aStrSetID); + void setDoseID(IDType aDoseID); - IDType getStrSetID() const; - IDType getDoseID() const; + IDType getStrSetID() const; + IDType getDoseID() const; - /*! @brief Get the DVH according to the structure ID - @return Return NULL if not found - */ - DVH* getDVH(IDType aStructureID); + /*! @brief Get the DVH according to the structure ID + @return Return NULL if not found + */ + DVH* getDVH(IDType aStructureID); - /*! @brief Insert a DVH object. - @brief param aDVHType "TV" for target volume or "HT" for healthy tissue or "WV" for whole volume - @exception InvalidParameterException Thrown if no valid DVHRole was given. - */ - void insert(DVH& aDvh, DVHRole aDVHRole); + /*! @brief Insert a DVH object. + @brief param aDVHType "TV" for target volume or "HT" for healthy tissue or "WV" for whole volume + @exception InvalidParameterException Thrown if no valid DVHRole was given. + */ + void insert(DVH& aDvh, DVHRole aDVHRole); - /*! @brief Get DVH subset for target volume - */ - const DVHSetType& getDVHTVSet() const{return _dvhTVSet;}; + /*! @brief Get DVH subset for target volume + */ + const DVHSetType& getDVHTVSet() const{return _dvhTVSet;}; - /*! @brief Get DVH subset for healthy tissue - */ - const DVHSetType& getDVHHTSet() const{return _dvhHTSet;}; + /*! @brief Get DVH subset for healthy tissue + */ + const DVHSetType& getDVHHTSet() const{return _dvhHTSet;}; - /*! @brief Get DVH subset for whole volume - */ - const DVHSetType& getDVHWVSet() const{return _dvhWVSet;}; + /*! @brief Get DVH subset for whole volume + */ + const DVHSetType& getDVHWVSet() const{return _dvhWVSet;}; - /*! @brief Get the whole volume irradiated to >= aDoseAbsolute - */ - VolumeType getWholeVolume(DoseTypeGy aDoseAbsolute) const; + /*! @brief Get the whole volume irradiated to >= aDoseAbsolute + */ + VolumeType getWholeVolume(DoseTypeGy aDoseAbsolute) const; - /*! @brief Get the healthy tissue volume irradiated to >= aDoseAbsolute - @return Return -1 if DVH of _dvhHTSet init() failed - */ - VolumeType getHTVolume(DoseTypeGy aDoseAbsolute) const; + /*! @brief Get the healthy tissue volume irradiated to >= aDoseAbsolute + @return Return -1 if DVH of _dvhHTSet init() failed + */ + VolumeType getHTVolume(DoseTypeGy aDoseAbsolute) const; - /*! @brief Get the target volume irradiated to >= aDoseAbsolute - @return Return -1 if DVH of _dvhTVSet init() failed - */ - VolumeType getTVVolume(DoseTypeGy aDoseAbsolute) const; + /*! @brief Get the target volume irradiated to >= aDoseAbsolute + @return Return -1 if DVH of _dvhTVSet init() failed + */ + VolumeType getTVVolume(DoseTypeGy aDoseAbsolute) const; - /*! DVHSets are considered equal if they have the same structureSet, dose and voxelization ID - and the number of DVHs are equal. - */ - bool friend operator==(const DVHSet &aDVHSet, const DVHSet &otherDVHSet); + /*! DVHSets are considered equal if they have the same structureSet, dose and voxelization ID + and the number of DVHs are equal. + */ + bool friend operator==(const DVHSet &aDVHSet, const DVHSet &otherDVHSet); - friend std::ostream& operator<<(std::ostream& s, const DVHSet &aDVHSet); + friend std::ostream& operator<<(std::ostream& s, const DVHSet &aDVHSet); - friend std::ostream& operator<<(std::ostream& s, const DVHSetType &aDVHSet); - }; + friend std::ostream& operator<<(std::ostream& s, const DVHSetType &aDVHSet); + }; - bool operator==(const DVHSet &aDVHSet, const DVHSet &otherDVHSet); + bool operator==(const DVHSet &aDVHSet, const DVHSet &otherDVHSet); - std::ostream& operator<<(std::ostream& s, const DVHSet &aDVHSet); + std::ostream& operator<<(std::ostream& s, const DVHSet &aDVHSet); - std::ostream& operator<<(std::ostream& s, const DVHSet::DVHSetType &aDVHSet); + std::ostream& operator<<(std::ostream& s, const DVHSet::DVHSetType &aDVHSet); - } } +} #endif diff --git a/code/indices/files.cmake b/code/indices/files.cmake index f08aa12..6f42e98 100644 --- a/code/indices/files.cmake +++ b/code/indices/files.cmake @@ -1,17 +1,19 @@ SET(CPP_FILES rttbConformalIndex.cpp rttbConformationNumber.cpp rttbConformityIndex.cpp rttbCoverageIndex.cpp rttbDoseIndex.cpp + rttbDvhBasedDoseIndex.cpp rttbHomogeneityIndex.cpp ) SET(H_FILES rttbConformalIndex.h rttbConformationNumber.h rttbConformityIndex.h rttbCoverageIndex.h rttbDoseIndex.h + rttbDvhBasedDoseIndex.h rttbHomogeneityIndex.h ) diff --git a/code/indices/rttbConformalIndex.cpp b/code/indices/rttbConformalIndex.cpp index d6794d7..47c1152 100644 --- a/code/indices/rttbConformalIndex.cpp +++ b/code/indices/rttbConformalIndex.cpp @@ -1,115 +1,109 @@ // ----------------------------------------------------------------------- // 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 "rttbConformalIndex.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb{ - namespace indices{ + namespace indices{ - ConformalIndex::ConformalIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) - { - _dvhSet=dvhSet; - _doseReference=aDoseReference; - initSuccess=false; - } + ConformalIndex::ConformalIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) + { + _dvhSet=dvhSet; + _doseReference=aDoseReference; + initSuccess=false; + } - bool ConformalIndex::init() - { - if(!_dvhSet){ - throw core::NullPointerException("DVHSet must not be NULL! "); - } - if(this->calcIndex()){ - initSuccess=true; - return true; - } - else - return false; - } + bool ConformalIndex::checkInputs(){ + if(!_dvhSet) + return false; + else + return true; + } + + bool ConformalIndex::calcIndex() + { + VolumeType TV=_dvhSet->getTVVolume(0); + VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); + if(TV!=0 && Vref!=0){ + _value=(_dvhSet->getTVVolume(_doseReference)/TV)* + (_dvhSet->getTVVolume(_doseReference)/Vref); - bool ConformalIndex::calcIndex() - { - VolumeType TV=_dvhSet->getTVVolume(0); - VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); - if(TV!=0 && Vref!=0){ - _value=(_dvhSet->getTVVolume(_doseReference)/TV)* - (_dvhSet->getTVVolume(_doseReference)/Vref); + std::vector dvhHTSet=this->_dvhSet->getDVHHTSet(); + std::vector::iterator it; - std::vector dvhHTSet=this->_dvhSet->getDVHHTSet(); - std::vector::iterator it; + for(it=dvhHTSet.begin(); it!=dvhHTSet.end();++it) + { + core::DVH dvh=*(it); + VolumeType HT=dvh.getVx(0); + if(HT!=0) + _value*=(1-dvh.getVx(this->_doseReference)/HT); + } + } + else if(TV==0){ + throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); + } + else{ + rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); + } + return true; + } - for(it=dvhHTSet.begin(); it!=dvhHTSet.end();++it) - { - core::DVH dvh=*(it); - VolumeType HT=dvh.getVx(0); - if(HT!=0) - _value*=(1-dvh.getVx(this->_doseReference)/HT); - } - } - else if(TV==0){ - throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); - } - else{ - rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } - return true; - } + IndexValueType ConformalIndex::getDoseIndexAt(core::DVHSet::IndexType tvIndex){ + std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); + VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); + if(tvIndex>=dvhTVSet.size()){ + rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"< dvhTVSet=this->_dvhSet->getDVHTVSet(); - VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); - if(tvIndex>=dvhTVSet.size()){ - rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); + } - VolumeType TV=dvh.getVx(0); - if(TV==0){ - throw core::InvalidParameterException("DVH invalid: Volume of tvIndex should not be 0!"); - } - else if(Vref==0){ - rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } + double value=dvh.getVx(_doseReference)/TV;//the irradiation factor of i-th target volume + value=value*dvh.getVx(_doseReference)/Vref;//conformation number - double value=dvh.getVx(_doseReference)/TV;//the irradiation factor of i-th target volume - value=value*dvh.getVx(_doseReference)/Vref;//conformation number + std::vector dvhHTSet=this->_dvhSet->getDVHHTSet(); + std::vector::iterator it; - std::vector dvhHTSet=this->_dvhSet->getDVHHTSet(); - std::vector::iterator it; + for(it=dvhHTSet.begin(); it!=dvhHTSet.end();++it) + { + dvh=*(it); + VolumeType HT=dvh.getVx(0); + if(HT!=0){ + value*=(1-dvh.getVx(this->_doseReference)/HT); + } + } + return value; + } + } - for(it=dvhHTSet.begin(); it!=dvhHTSet.end();++it) - { - dvh=*(it); - VolumeType HT=dvh.getVx(0); - if(HT!=0){ - value*=(1-dvh.getVx(this->_doseReference)/HT); - } - } - return value; - } - } - - }//end namespace indices + }//end namespace indices }//end namespace rttb diff --git a/code/indices/rttbConformalIndex.h b/code/indices/rttbConformalIndex.h index 0d0d454..7ad4273 100644 --- a/code/indices/rttbConformalIndex.h +++ b/code/indices/rttbConformalIndex.h @@ -1,69 +1,67 @@ // ----------------------------------------------------------------------- // 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 __CONFORMAL_INDEX_H #define __CONFORMAL_INDEX_H -#include "rttbDoseIndex.h" +#include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" namespace rttb{ - namespace indices{ + namespace indices{ - /*! @class ConformalIndex + /*! @class ConformalIndex @brief This class representing a ConformalIndex Object. Conformal Index (COIN)= Conformation Number(CN)* (1-Vref,0/Vnt,0)*(1-Vref,1/Vnt,1)... i: i-th critiacal organ Conformation Number (CN)= (TVref/TV) * (TVref/Vref) @ingroup indices - */ - class ConformalIndex: public DoseIndex - { - protected: - /*! @brief Calculate conformal index - @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid - */ - bool calcIndex(); - + */ + class ConformalIndex: public DvhBasedDoseIndex + { + protected: + /*! @brief Calculate conformal index + @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid + */ + bool calcIndex(); - public: - /*! @brief Constructor - */ - ConformalIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); + bool checkInputs(); - /*! @return Return true if calcIndex() finished - @exception NullPointerException thrown if dvhSet is NULL - */ - bool init(); - /*! @brief Dose index calculation for tvIndex-th treated volume - @param tvIndex index in the DVH in the current set of tv-DVHs - @return Return index value - @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid - */ - IndexValueType getDoseIndexAt(const GridIndexType tvIndex); + public: + /*! @brief Constructor + */ + ConformalIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - }; + /*! @brief Dose index calculation for tvIndex-th treated volume + @param tvIndex index in the DVH in the current set of tv-DVHs + @return Return index value + @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid + */ + IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex); - } + + }; + + } } #endif diff --git a/code/indices/rttbConformationNumber.cpp b/code/indices/rttbConformationNumber.cpp index 21dce8f..0dfba26 100644 --- a/code/indices/rttbConformationNumber.cpp +++ b/code/indices/rttbConformationNumber.cpp @@ -1,90 +1,85 @@ // ----------------------------------------------------------------------- // 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 "rttbConformationNumber.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb{ namespace indices{ ConformationNumber::ConformationNumber(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) - { + { _dvhSet=dvhSet; _doseReference=aDoseReference; initSuccess=false; - } + } - bool ConformationNumber::init() - { - if(!_dvhSet){ - throw core::NullPointerException("DVHSet must not be NULL! "); - } - if( this->calcIndex()){ - initSuccess=true; + bool ConformationNumber::checkInputs(){ + if(!_dvhSet) + return false; + else return true; - } - return false; - } + } bool ConformationNumber::calcIndex() - { + { VolumeType TV=_dvhSet->getTVVolume(0); VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); if(TV!=0 && Vref!=0){ _value=(_dvhSet->getTVVolume(_doseReference)/TV)* (_dvhSet->getTVVolume(_doseReference)/Vref); - } + } else if(TV==0){ throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); - } + } else{ rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } + } return true; - } + } - IndexValueType ConformationNumber::getDoseIndexAt(GridIndexType tvIndex){ + IndexValueType ConformationNumber::getDoseIndexAt(core::DVHSet::IndexType tvIndex){ std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); if(tvIndex>=dvhTVSet.size()){ rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } + } IndexValueType value=dvh.getVx(_doseReference)/TV;//the irradiation factor of i-th target volume value=value*dvh.getVx(_doseReference)/Vref; return value; - } } + } - }//end namespace indices - }//end namespace rttb \ No newline at end of file + }//end namespace indices +}//end namespace rttb \ No newline at end of file diff --git a/code/indices/rttbConformationNumber.h b/code/indices/rttbConformationNumber.h index 3c9e92d..19e0d52 100644 --- a/code/indices/rttbConformationNumber.h +++ b/code/indices/rttbConformationNumber.h @@ -1,69 +1,69 @@ // ----------------------------------------------------------------------- // 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 __CONFORMATION_NUMBER_H #define __CONFORMATION_NUMBER_H -#include "rttbDoseIndex.h" +#include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" namespace rttb{ - namespace indices{ + namespace indices{ - /*! @class ConformationNumber + /*! @class ConformationNumber @brief This class representing a ConformationNumber Object. Conformation Number (CN)= (TVref/TV) * (TVref/Vref) @ingroup indices - */ - class ConformationNumber: public DoseIndex - { - protected: - /*! @brief Calculate conformation number - @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid - */ - bool calcIndex(); - - - public: - - /*! @brief Constructor - */ - ConformationNumber(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - - /*! @return Return true if calcIndex() finished sucessfully - @exception NullPointerException thrown if dvhSet is NULL - */ - bool init(); - - /*! @brief Dose index calculation for tvIndex-th treated volume - @param tvIndex index in the DVH in the current set of tv-DVHs - @return Return index value - @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid - */ - IndexValueType getDoseIndexAt(const GridIndexType tvIndex); - - }; - } + */ + class ConformationNumber: public DvhBasedDoseIndex + { + protected: + /*! @brief Calculate conformation number + @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid + */ + bool calcIndex(); + + bool checkInputs(); + + + public: + + /*! @brief Constructor + */ + ConformationNumber(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); + + + /*! @brief Dose index calculation for tvIndex-th treated volume + @param tvIndex index in the DVH in the current set of tv-DVHs + @return Return index value + @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid + */ + IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex); + + + + }; + } } #endif diff --git a/code/indices/rttbConformityIndex.cpp b/code/indices/rttbConformityIndex.cpp index b4f2c7a..35aa867 100644 --- a/code/indices/rttbConformityIndex.cpp +++ b/code/indices/rttbConformityIndex.cpp @@ -1,90 +1,87 @@ // ----------------------------------------------------------------------- // 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 "rttbConformityIndex.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb{ namespace indices{ ConformityIndex::ConformityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) - { + { _dvhSet=dvhSet; _doseReference=aDoseReference; initSuccess=false; - } + } - bool ConformityIndex::init() - { + bool ConformityIndex::checkInputs() + { if(!_dvhSet){ - throw core::NullPointerException("DVHSet must not be NULL! "); - } - if( this->calcIndex()){ - initSuccess=true; - return true; - } - else return false; } + else{ + return true; + } + } bool ConformityIndex::calcIndex() - { + { VolumeType TV=_dvhSet->getTVVolume(0); VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); if(TV!=0 && Vref!=0){ _value=(_dvhSet->getTVVolume(this->_doseReference)/TV)*(1-_dvhSet->getHTVolume(_doseReference)/Vref); - } + } else if(TV==0){ throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); - } + } else{ rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } - return true; } + return true; + } - IndexValueType ConformityIndex::getDoseIndexAt(GridIndexType tvIndex){ + IndexValueType ConformityIndex::getDoseIndexAt(core::DVHSet::IndexType tvIndex){ std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); if(tvIndex>=dvhTVSet.size()){ rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); - } + } double value=dvh.getVx(_doseReference)/TV;//the irradiation factor of i-th treated volume value=value*(1-_dvhSet->getHTVolume(_doseReference)/Vref); return value; - } } + } - }//end namespace indices - }//end namespace rttb + }//end namespace indices +}//end namespace rttb diff --git a/code/indices/rttbConformityIndex.h b/code/indices/rttbConformityIndex.h index adb18a1..387c440 100644 --- a/code/indices/rttbConformityIndex.h +++ b/code/indices/rttbConformityIndex.h @@ -1,69 +1,66 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __CONFORMITY_INDEX_H #define __CONFORMITY_INDEX_H -#include "rttbDoseIndex.h" +#include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" namespace rttb{ - namespace indices{ + namespace indices{ - /*! @class ConformityIndex + /*! @class ConformityIndex @brief This class representing a ConformityIndex Object. Conformity Index (CI): CI(D)=IFtv(D)*(1-IFht(D)), D:reference dose, IFtv(D): the irradiation factor of the PTV, defined as the fraction of the PTV receiving a dose higher than D IFht(D): the irradiation factor of healthy tissue, defined as the radio of the volume of tissue outside the PTV receiving a dose greater than D to the volume of isodose D @ingroup indices - */ - class ConformityIndex: public DoseIndex - { - protected: - /*! @brief Calculate Conformity index - @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid - */ - bool calcIndex(); + */ + class ConformityIndex: public DvhBasedDoseIndex + { + protected: + /*! @brief Calculate Conformity index + @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid + */ + bool calcIndex(); + bool checkInputs(); - public: - /*! @brief Constructor - */ - ConformityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - /*! @return Return true if calcIndex() finished sucessfully - @exception NullPointerException thrown if dvhSet is NULL - */ - bool init(); + public: + /*! @brief Constructor + */ + ConformityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - /*! @brief Dose index calculation for tvIndex-th treated volume - @param tvIndex index in the DVH in the current set of tv-DVHs - @return Return index value - @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid - */ - IndexValueType getDoseIndexAt(const GridIndexType tvIndex); + /*! @brief Dose index calculation for tvIndex-th treated volume + @param tvIndex index in the DVH in the current set of tv-DVHs + @return Return index value + @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid + */ + IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex); - }; + }; - } + } } #endif diff --git a/code/indices/rttbCoverageIndex.cpp b/code/indices/rttbCoverageIndex.cpp index 546807d..904c3b4 100644 --- a/code/indices/rttbCoverageIndex.cpp +++ b/code/indices/rttbCoverageIndex.cpp @@ -1,78 +1,76 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #include "rttbCoverageIndex.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb{ namespace indices{ CoverageIndex::CoverageIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) - { + { _dvhSet=dvhSet; _doseReference=aDoseReference; initSuccess=false; - } + } - bool CoverageIndex::init() - { + bool CoverageIndex::checkInputs() + { if(!_dvhSet){ - throw core::NullPointerException("DVHSet must not be NULL! "); - } - if( this->calcIndex()){ - initSuccess=true; - return true; - } - else return false; } + else + { + return true; + } + } bool CoverageIndex::calcIndex() - { + { VolumeType TV=_dvhSet->getTVVolume(0); if(TV!=0) _value=_dvhSet->getTVVolume(this->_doseReference)/TV; else{ throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); - } - return true; } + return true; + } - IndexValueType CoverageIndex::getDoseIndexAt(GridIndexType tvIndex){ + IndexValueType CoverageIndex::getDoseIndexAt(core::DVHSet::IndexType tvIndex){ std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); VolumeType Vref=_dvhSet->getWholeVolume(_doseReference); if(tvIndex>=dvhTVSet.size()){ rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"< #include -#include "rttbDoseIndex.h" +#include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "rttbDVHSet.h" namespace rttb{ - namespace indices{ + namespace indices{ - /*! @class CoverageIndex - @brief This class representing a CoverageIndex Object. Coverage Index fraction of the target volume receiving a dose >= the reference dose + /*! @class CoverageIndex + @brief This class representing a CoverageIndex Object. Coverage Index fraction of the target volume receiving a dose >= the reference dose @ingroup indices - */ - class CoverageIndex: public DoseIndex - { + */ + class CoverageIndex: public DvhBasedDoseIndex + { - protected: - /*! @brief Calculate conformation number - @exception InvalidParameterException Thrown if dvhSet invalid - */ - bool calcIndex(); + protected: + /*! @brief Calculate conformation number + @exception InvalidParameterException Thrown if dvhSet invalid + */ + bool calcIndex(); - - public: - /*! @brief Constructor - */ - CoverageIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); + bool checkInputs(); - /*! @return Return true if calcIndex() finished sucessfully - @exception NullPointerException thrown if dvhSet is NULL - @see calcIndex - */ - bool init(); - /*! @brief Dose index calculation for tvIndex-th treated volume - * @param tvIndex: index in the vector of DVH TV - * @return Return index value - @exception InvalidParameterException Thrown if tvIndex invalid - */ - IndexValueType getDoseIndexAt(const GridIndexType tvIndex); + public: + /*! @brief Constructor + */ + CoverageIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); + + /*! @brief Dose index calculation for tvIndex-th treated volume + * @param tvIndex: index in the vector of DVH TV + * @return Return index value + @exception InvalidParameterException Thrown if tvIndex invalid + */ + IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex); - }; - } + }; + + } } #endif diff --git a/code/indices/rttbDoseIndex.h b/code/indices/rttbDoseIndex.h index 6897a36..47152a0 100644 --- a/code/indices/rttbDoseIndex.h +++ b/code/indices/rttbDoseIndex.h @@ -1,85 +1,95 @@ // ----------------------------------------------------------------------- // 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 __DOSE_INDEX_H #define __DOSE_INDEX_H #include "rttbBaseType.h" #include "rttbDVHSet.h" +#include "rttbNullPointerException.h" namespace rttb{ - namespace indices{ - /*! @class DoseIndex + namespace indices{ + /*! @class DoseIndex @brief This is the interface for dose/plan comparison indices. @ingroup indices - */ - class DoseIndex - { - protected: - - /*! @todo Use Shared Pointers for _dvhSet*/ - core::DVHSet* _dvhSet; - - IndexValueType _value; - - DoseTypeGy _doseReference; - - /*! @brief If init() successful*/ - bool initSuccess; - - /*! @brief Dose index calculation */ - virtual bool calcIndex()=0; - - - public: - /*! @brief Initialize the calculation - @return Return true if successfully - */ - virtual bool init()=0; - - /*! @brief Set the reference dose - */ - void setDoseReference(DoseTypeGy aDoseReference); - - /*! @brief Get the reference dose - */ - DoseTypeGy getDoseReference() const; - - /*! @brief Get the value of dose/plan comparison index - @return Return the value of this index - @exception Exception Thrown if the class was not initialized previously. - */ - IndexValueType getValue() const; - - /*! @brief Dose/plan comparison index calculation for tvIndex-th treated volume - (tv = target volume; th = healthy tissue) - @param tvIndex index in the DVH in the current set of tv-DVHs - @todo is this name good? getIndexAt() instead? - */ - virtual IndexValueType getDoseIndexAt(const GridIndexType tvIndex)=0; - }; - } + */ + class DoseIndex + { + protected: + + + IndexValueType _value; + + DoseTypeGy _doseReference; + + /*! @brief If init() successful*/ + bool initSuccess; + + /*! @brief Dose index calculation */ + virtual bool calcIndex()=0; + + virtual bool checkInputs()=0; + + public: + /*! @brief Initialize the calculation + @return Return true if successfully + */ + bool init() + { + initSuccess = false; + if(!(this->checkInputs())){ + throw core::NullPointerException("DVHSet must not be NULL! "); + } + if( this->calcIndex()){ + initSuccess=true; + } + return initSuccess; + }; + + /*! @brief Set the reference dose + */ + void setDoseReference(DoseTypeGy aDoseReference); + + /*! @brief Get the reference dose + */ + DoseTypeGy getDoseReference() const; + + /*! @brief Get the value of dose/plan comparison index + @return Return the value of this index + @exception Exception Thrown if the class was not initialized previously. + */ + IndexValueType getValue() const; + + /*! @brief Dose/plan comparison index calculation for tvIndex-th treated volume + (tv = target volume; th = healthy tissue) + @param tvIndex index in the DVH in the current set of tv-DVHs + @todo is this name good? getIndexAt() instead? + */ + virtual IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex)=0; + }; + } } #endif diff --git a/code/indices/rttbDvhBasedDoseIndex.cpp b/code/indices/rttbDvhBasedDoseIndex.cpp new file mode 100644 index 0000000..525711d --- /dev/null +++ b/code/indices/rttbDvhBasedDoseIndex.cpp @@ -0,0 +1,31 @@ +// ----------------------------------------------------------------------- +// 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: 707 $ (last changed revision) +// @date $Date: 2014-09-04 16:37:24 +0200 (Do, 04 Sep 2014) $ (last change date) +// @author $Author: floca $ (last changed by) +*/ + +#include "rttbDvhBasedDoseIndex.h" +#include "rttbException.h" + +namespace rttb{ + namespace indices{ + + } + } + + diff --git a/code/indices/rttbDvhBasedDoseIndex.h b/code/indices/rttbDvhBasedDoseIndex.h new file mode 100644 index 0000000..f2d6e8d --- /dev/null +++ b/code/indices/rttbDvhBasedDoseIndex.h @@ -0,0 +1,65 @@ +// ----------------------------------------------------------------------- +// RTToolbox - DKFZ radiotherapy quantitative evaluation library +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See rttbCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/rttb/copyright.html +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notices for more information. +// +//------------------------------------------------------------------------ +/*! +// @file +// @version $Revision: 707 $ (last changed revision) +// @date $Date: 2014-09-04 16:37:24 +0200 (Do, 04 Sep 2014) $ (last change date) +// @author $Author: floca $ (last changed by) +*/ +#ifndef __DVH_BASED_DOSE_INDEX_H +#define __DVH_BASED_DOSE_INDEX_H + + +#include "rttbBaseType.h" +#include "rttbDVHSet.h" +#include "rttbDoseIndex.h" + +namespace rttb{ + + + namespace indices{ + /*! @class DoseIndex + @brief This is the interface for dose/plan comparison indices. + @ingroup indices + */ + class DvhBasedDoseIndex: public DoseIndex + { + public: + + protected: + + /*! @todo Use Shared Pointers for _dvhSet*/ + core::DVHSet* _dvhSet; + + /*! @brief Dose index calculation */ + virtual bool calcIndex()=0; + + virtual bool checkInputs()=0; + + public: + + + /*! @brief Dose/plan comparison index calculation for tvIndex-th treated volume + (tv = target volume; th = healthy tissue) + @param tvIndex index in the DVH in the current set of tv-DVHs + @todo is this name good? getIndexAt() instead? + */ + virtual IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex)=0; + }; + } +} + + +#endif diff --git a/code/indices/rttbHomogeneityIndex.cpp b/code/indices/rttbHomogeneityIndex.cpp index 6d74d0a..852d0a8 100644 --- a/code/indices/rttbHomogeneityIndex.cpp +++ b/code/indices/rttbHomogeneityIndex.cpp @@ -1,90 +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) */ #include "rttbHomogeneityIndex.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb{ namespace indices{ HomogeneityIndex::HomogeneityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference) { _dvhSet=dvhSet; _doseReference=aDoseReference; initSuccess=false; } - bool HomogeneityIndex::init() + bool HomogeneityIndex::checkInputs() { if(!_dvhSet){ - throw core::NullPointerException("DVHSet must not be NULL! "); + return false; } - if(this->calcIndex()){ - initSuccess=true; + else{ return true; } - return false; } bool HomogeneityIndex::calcIndex() { double max=0; double min; std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); std::vector::iterator it; - + for(it=dvhTVSet.begin(); it!=dvhTVSet.end();it++) { core::DVH dvh=*(it); if(it==dvhTVSet.begin()) min=dvh.getMinimum(); if(dvh.getMaximum()>max) max=dvh.getMaximum(); if(dvh.getMinimum()getDoseReference()!=0){ _value=(max-min)/this->getDoseReference(); } else{ rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); } return true; - + } - IndexValueType HomogeneityIndex::getDoseIndexAt(GridIndexType tvIndex){ + IndexValueType HomogeneityIndex::getDoseIndexAt(core::DVHSet::IndexType tvIndex){ std::vector dvhTVSet=this->_dvhSet->getDVHTVSet(); if(tvIndex>=dvhTVSet.size()){ rttbExceptionMacro(core::InvalidParameterException, <<"tvIndex invalid: it should be <"<getDoseReference()<=0){ rttbExceptionMacro(core::InvalidParameterException, << "Reference dose "<getDoseReference()<<" invalid: Volume of reference dose should not be 0!"); } return (dvh.getMaximum()-dvh.getMinimum())/this->getDoseReference(); } }//end namespace indices }//end namespace rttb \ No newline at end of file diff --git a/code/indices/rttbHomogeneityIndex.h b/code/indices/rttbHomogeneityIndex.h index 53a8a73..5e7a589 100644 --- a/code/indices/rttbHomogeneityIndex.h +++ b/code/indices/rttbHomogeneityIndex.h @@ -1,69 +1,66 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __HOMOGENEITY_INDEX_H #define __HOMOGENEITY_INDEX_H #include #include -#include "rttbDoseIndex.h" +#include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" namespace rttb{ - namespace indices{ - /*! @class HomogeneityIndex + namespace indices{ + /*! @class HomogeneityIndex @brief This class representing a HomogeneityIndex Object. Homogeneity Index (HI) = (Dmax(PTV)-Dmin(PTV))/Dref @ingroup indices - */ - class HomogeneityIndex: public DoseIndex - { - protected: - /*! @brief Calculate Conformity index - @exception InvalidParameterException Thrown if aDoseReference invalid - */ - bool calcIndex(); + */ + class HomogeneityIndex: public DvhBasedDoseIndex + { + protected: + /*! @brief Calculate Conformity index + @exception InvalidParameterException Thrown if aDoseReference invalid + */ + bool calcIndex(); + bool checkInputs(); - public: - /*! @brief Constructor - */ - HomogeneityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - /*! @return Return true if calcIndex() finished sucessfully - @exception NullPointerException thrown if dvhSet is NULL - */ - bool init(); + public: + /*! @brief Constructor + */ + HomogeneityIndex(core::DVHSet* dvhSet, DoseTypeGy aDoseReference); - /*! @brief Dose index calculation for tvIndex-th treated volume - @param tvIndex index in the DVH in the current set of tv-DVHs - @return Return index value - @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid - */ - IndexValueType getDoseIndexAt(const GridIndexType tvIndex); + /*! @brief Dose index calculation for tvIndex-th treated volume + @param tvIndex index in the DVH in the current set of tv-DVHs + @return Return index value + @exception InvalidParameterException Thrown if tvIndex or aDoseReference invalid + */ + IndexValueType getDoseIndexAt(const core::DVHSet::IndexType tvIndex); - }; + }; - } + } } #endif