diff --git a/code/indices/rttbConformalIndex.cpp b/code/indices/rttbConformalIndex.cpp index d373653..a474ef2 100644 --- a/code/indices/rttbConformalIndex.cpp +++ b/code/indices/rttbConformalIndex.cpp @@ -1,126 +1,120 @@ // ----------------------------------------------------------------------- // 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 { ConformalIndex::ConformalIndex(core::DVHSet::Pointer dvhSet, DoseTypeGy aDoseReference) : DvhBasedDoseIndex(dvhSet, aDoseReference) { init(); } bool ConformalIndex::calcIndex() { VolumeType TV = _dvhSet->getTargetVolume(0); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (TV != 0 && Vref != 0) { _value = (_dvhSet->getTargetVolume(_doseReference) / TV) * (_dvhSet->getTargetVolume(_doseReference) / Vref); std::vector dvhHTSet = this->_dvhSet->getHealthyTissueSet(); 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 " << this->getDoseReference() << " invalid: Volume of reference dose should not be 0!"); } return true; } IndexValueType ConformalIndex::getValueAt(core::DVHSet::IndexType tvIndex) { std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (tvIndex >= dvhTVSet.size()) { rttbExceptionMacro(core::InvalidParameterException, << "tvIndex invalid: it should be <" << dvhTVSet.size() << "!"); } else { core::DVH dvh = dvhTVSet.at(tvIndex); 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 " << this->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 std::vector dvhHTSet = this->_dvhSet->getHealthyTissueSet(); 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; } } }//end namespace indices }//end namespace rttb diff --git a/code/indices/rttbConformalIndex.h b/code/indices/rttbConformalIndex.h index 0a2ec27..9b04300 100644 --- a/code/indices/rttbConformalIndex.h +++ b/code/indices/rttbConformalIndex.h @@ -1,70 +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) -*/ #ifndef __CONFORMAL_INDEX_H #define __CONFORMAL_INDEX_H - #include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class ConformalIndex @brief This class representing a ConformalIndex Object. @details Conformal Index \f$(COIN)= Conformation Number(CN)* (1-Vref,0/Vnt,0)*(1-Vref,1/Vnt,1)... i\f$, i: i-th critiacal organ Conformation Number \f$(CN)= \frac{TVref}{TV} * \frac{TVref}{Vref}\f$ @ingroup indices */ class RTTBIndices_EXPORT ConformalIndex : public DvhBasedDoseIndex { protected: /*! @brief Calculate conformal index @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid */ bool calcIndex() override; public: /*! @brief Constructor */ ConformalIndex(core::DVHSet::Pointer 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 getValueAt(const core::DVHSet::IndexType tvIndex) override; }; } } #endif diff --git a/code/indices/rttbConformationNumber.cpp b/code/indices/rttbConformationNumber.cpp index 5cc6e40..d034a23 100644 --- a/code/indices/rttbConformationNumber.cpp +++ b/code/indices/rttbConformationNumber.cpp @@ -1,97 +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) -*/ #include "rttbConformationNumber.h" #include "rttbNullPointerException.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb { namespace indices { ConformationNumber::ConformationNumber(core::DVHSet::Pointer dvhSet, DoseTypeGy aDoseReference) : DvhBasedDoseIndex(dvhSet, aDoseReference) { init(); } bool ConformationNumber::calcIndex() { VolumeType TV = _dvhSet->getTargetVolume(0); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (TV != 0 && Vref != 0) { _value = (_dvhSet->getTargetVolume(_doseReference) / TV) * (_dvhSet->getTargetVolume(_doseReference) / Vref); } else if (TV == 0) { throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); } else { rttbExceptionMacro(core::InvalidParameterException, << "Reference dose " << this->getDoseReference() << " invalid: Volume of reference dose should not be 0!"); } return true; } IndexValueType ConformationNumber::getValueAt(core::DVHSet::IndexType tvIndex) { std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (tvIndex >= dvhTVSet.size()) { rttbExceptionMacro(core::InvalidParameterException, << "tvIndex invalid: it should be <" << dvhTVSet.size() << "!"); } else { core::DVH dvh = dvhTVSet.at(tvIndex); 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 " << this->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 diff --git a/code/indices/rttbConformationNumber.h b/code/indices/rttbConformationNumber.h index ad6b10e..e9d9fdf 100644 --- a/code/indices/rttbConformationNumber.h +++ b/code/indices/rttbConformationNumber.h @@ -1,70 +1,64 @@ // ----------------------------------------------------------------------- // 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 "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class ConformationNumber @brief This class representing a ConformationNumber Object. @details Conformation Number \f$(CN)= (TVref/TV) * (TVref/Vref)\f$ @ingroup indices */ class RTTBIndices_EXPORT ConformationNumber : public DvhBasedDoseIndex { protected: /*! @brief Calculate conformation number @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid */ bool calcIndex() override; public: /*! @brief Constructor */ ConformationNumber(core::DVHSet::Pointer 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 getValueAt(const core::DVHSet::IndexType tvIndex) override; }; } } #endif diff --git a/code/indices/rttbConformityIndex.cpp b/code/indices/rttbConformityIndex.cpp index 4fd6bf3..5353a18 100644 --- a/code/indices/rttbConformityIndex.cpp +++ b/code/indices/rttbConformityIndex.cpp @@ -1,96 +1,90 @@ // ----------------------------------------------------------------------- // 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::Pointer dvhSet, DoseTypeGy aDoseReference) : DvhBasedDoseIndex(dvhSet, aDoseReference) { init(); } bool ConformityIndex::calcIndex() { VolumeType TV = _dvhSet->getTargetVolume(0); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (TV != 0 && Vref != 0) { _value = (_dvhSet->getTargetVolume(this->_doseReference) / TV) * (1 - _dvhSet->getHealthyTissueVolume(_doseReference) / Vref); } else if (TV == 0) { throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); } else { rttbExceptionMacro(core::InvalidParameterException, << "Reference dose " << this->getDoseReference() << " invalid: Volume of reference dose should not be 0!"); } return true; } IndexValueType ConformityIndex::getValueAt(core::DVHSet::IndexType tvIndex) { std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); VolumeType Vref = _dvhSet->getWholeVolume(_doseReference); if (tvIndex >= dvhTVSet.size()) { rttbExceptionMacro(core::InvalidParameterException, << "tvIndex invalid: it should be <" << dvhTVSet.size() << "!"); } else { core::DVH dvh = dvhTVSet.at(tvIndex); 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 " << this->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->getHealthyTissueVolume(_doseReference) / Vref); return value; } } }//end namespace indices }//end namespace rttb diff --git a/code/indices/rttbConformityIndex.h b/code/indices/rttbConformityIndex.h index 3de3557..83ab5d2 100644 --- a/code/indices/rttbConformityIndex.h +++ b/code/indices/rttbConformityIndex.h @@ -1,69 +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) -*/ + #ifndef __CONFORMITY_INDEX_H #define __CONFORMITY_INDEX_H - #include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class ConformityIndex @brief This class representing a ConformityIndex Object. @details: Conformity Index (CI): \f$CI(D)=IFtv(D)*(1-IFht(D))\f$, 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 RTTBIndices_EXPORT ConformityIndex : public DvhBasedDoseIndex { protected: /*! @brief Calculate Conformity index @exception InvalidParameterException Thrown if dvhSet or aDoseReference invalid */ bool calcIndex() override; public: /*! @brief Constructor */ ConformityIndex(core::DVHSet::Pointer 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 getValueAt(const core::DVHSet::IndexType tvIndex) override; }; } } #endif diff --git a/code/indices/rttbCoverageIndex.cpp b/code/indices/rttbCoverageIndex.cpp index 6b5606d..93bec42 100644 --- a/code/indices/rttbCoverageIndex.cpp +++ b/code/indices/rttbCoverageIndex.cpp @@ -1,79 +1,73 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ -/*! -// @file -// @version $Revision$ (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::Pointer dvhSet, DoseTypeGy aDoseReference) : DvhBasedDoseIndex(dvhSet, aDoseReference) { init(); } bool CoverageIndex::calcIndex() { VolumeType TV = _dvhSet->getTargetVolume(0); if (TV != 0) { _value = _dvhSet->getTargetVolume(this->_doseReference) / TV; } else { throw core::InvalidParameterException("DVH Set invalid: Target volume should not be 0!"); } return true; } IndexValueType CoverageIndex::getValueAt(core::DVHSet::IndexType tvIndex) { std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); if (tvIndex >= dvhTVSet.size()) { rttbExceptionMacro(core::InvalidParameterException, << "tvIndex invalid: it should be <" << dvhTVSet.size() << "!"); } core::DVH dvh = dvhTVSet.at(tvIndex); VolumeType TV = dvh.getVx(0); if (TV == 0) { throw core::InvalidParameterException("DVH invalid: Volume of tvIndex should not be 0!"); } IndexValueType value = dvh.getVx(_doseReference) / TV; //the irradiation factor of i-th treated volume return value; } }//end namespace indices }//end namespace rttb diff --git a/code/indices/rttbCoverageIndex.h b/code/indices/rttbCoverageIndex.h index 7040b39..fc00958 100644 --- a/code/indices/rttbCoverageIndex.h +++ b/code/indices/rttbCoverageIndex.h @@ -1,67 +1,62 @@ // ----------------------------------------------------------------------- // 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 __COVERAGE_INDEX_H #define __COVERAGE_INDEX_H #include "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "rttbDVHSet.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class CoverageIndex @brief This class representing a CoverageIndex Object. @details Coverage Index fraction of the target volume receiving a dose >= the reference dose @ingroup indices */ class RTTBIndices_EXPORT CoverageIndex : public DvhBasedDoseIndex { protected: /*! @brief Calculate conformation number @exception InvalidParameterException Thrown if dvhSet invalid */ bool calcIndex() override; public: /*! @brief Constructor */ CoverageIndex(core::DVHSet::Pointer 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 getValueAt(const core::DVHSet::IndexType tvIndex) override; }; } } #endif diff --git a/code/indices/rttbDoseIndex.cpp b/code/indices/rttbDoseIndex.cpp index 3b512cd..309e8da 100644 --- a/code/indices/rttbDoseIndex.cpp +++ b/code/indices/rttbDoseIndex.cpp @@ -1,81 +1,75 @@ // ----------------------------------------------------------------------- // 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 "rttbDoseIndex.h" #include "rttbException.h" #include "rttbInvalidParameterException.h" namespace rttb { namespace indices { DoseIndex::DoseIndex(DoseTypeGy aDoseReference) : _doseReference(aDoseReference), _initSuccess(false) {} DoseIndex::~DoseIndex()= default; bool DoseIndex::init() { if (!(this->checkInputs())) { throw core::InvalidParameterException("Check inputs failed: invalid parameters! "); } if (this->calcIndex()) { _initSuccess = true; } else { throw core::InvalidParameterException("Index calculation failed! "); } return _initSuccess; } void DoseIndex::setDoseReference(DoseTypeGy aDoseReference) { _doseReference = aDoseReference; _initSuccess = false; init(); } DoseTypeGy DoseIndex::getDoseReference() const { return _doseReference; } IndexValueType DoseIndex::getValue() const { if (_initSuccess) { return _value; } else { throw core::Exception("DoseIndex init error: init() must be called first!"); } } } } diff --git a/code/indices/rttbDoseIndex.h b/code/indices/rttbDoseIndex.h index 6d5aa40..61b4ea6 100644 --- a/code/indices/rttbDoseIndex.h +++ b/code/indices/rttbDoseIndex.h @@ -1,89 +1,83 @@ // ----------------------------------------------------------------------- // 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 "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class DoseIndex @brief This is the interface for dose/plan comparison indices. @ingroup indices */ class RTTBIndices_EXPORT DoseIndex { protected: IndexValueType _value; DoseTypeGy _doseReference; /*! @brief If init() successful*/ bool _initSuccess; /*! @brief Initialize the calculation. It should be called in constructor or if any parameter of the calcualtion is changed. @return Return true if successfully @exception InvalidParameterException thrown if any input is invalid or index calculation failed */ bool init(); /*! @brief Dose index calculation */ virtual bool calcIndex() = 0; /*! @brief Check all inputs for the index calculation*/ virtual bool checkInputs() = 0; public: /*! @brief Constructor with the referece dose*/ DoseIndex(DoseTypeGy aDoseReference); virtual ~DoseIndex(); /*! @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 Get the value of dose/plan comparison index for a treated volume with the index in the DVH treated volume set @param tvIndex index in the DVH in the current set of DVH subset for target volume: use DVHSet.getTargetVolumeSet() */ virtual IndexValueType getValueAt(const core::DVHSet::IndexType tvIndex) = 0; }; } } #endif diff --git a/code/indices/rttbDvhBasedDoseIndex.cpp b/code/indices/rttbDvhBasedDoseIndex.cpp index b89537b..e3919c8 100644 --- a/code/indices/rttbDvhBasedDoseIndex.cpp +++ b/code/indices/rttbDvhBasedDoseIndex.cpp @@ -1,50 +1,43 @@ // ----------------------------------------------------------------------- // 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 "rttbDvhBasedDoseIndex.h" - namespace rttb { namespace indices { DvhBasedDoseIndex::DvhBasedDoseIndex(core::DVHSet::Pointer aDVHSet, DoseTypeGy aDoseReference) : DoseIndex(aDoseReference), _dvhSet(aDVHSet) { } bool DvhBasedDoseIndex::checkInputs() { if (!_dvhSet) { return false; } else { return true; } } } } diff --git a/code/indices/rttbDvhBasedDoseIndex.h b/code/indices/rttbDvhBasedDoseIndex.h index b1f9458..2929e17 100644 --- a/code/indices/rttbDvhBasedDoseIndex.h +++ b/code/indices/rttbDvhBasedDoseIndex.h @@ -1,55 +1,49 @@ // ----------------------------------------------------------------------- // 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_BASED_DOSE_INDEX_H #define __DVH_BASED_DOSE_INDEX_H - #include "rttbBaseType.h" #include "rttbDVHSet.h" #include "rttbDoseIndex.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class DvhBasedDoseIndex @brief This is the interface for dose/plan comparison indices calculated by DVh set of the dose. */ class RTTBIndices_EXPORT DvhBasedDoseIndex : public DoseIndex { protected: core::DVHSet::Pointer _dvhSet; /*! @brief Check inputs*/ bool checkInputs() override; public: /*! @brief Constructor*/ DvhBasedDoseIndex(core::DVHSet::Pointer aDVHSet, DoseTypeGy aDoseReference); }; } } #endif diff --git a/code/indices/rttbHomogeneityIndex.cpp b/code/indices/rttbHomogeneityIndex.cpp index 7897871..408e6c6 100644 --- a/code/indices/rttbHomogeneityIndex.cpp +++ b/code/indices/rttbHomogeneityIndex.cpp @@ -1,103 +1,97 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ -/*! -// @file -// @version $Revision$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ #include #include "rttbHomogeneityIndex.h" #include "rttbInvalidParameterException.h" #include "rttbExceptionMacros.h" namespace rttb { namespace indices { HomogeneityIndex::HomogeneityIndex(core::DVHSet::Pointer dvhSet, DoseTypeGy aDoseReference) : DvhBasedDoseIndex(dvhSet, aDoseReference) { init(); } bool HomogeneityIndex::calcIndex() { double max = 0; double min = std::numeric_limits::max(); std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); 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() < min) { min = dvh.getMinimum(); } } if (this->getDoseReference() != 0) { _value = (max - min) / this->getDoseReference(); } else { rttbExceptionMacro(core::InvalidParameterException, << "Reference dose " << this->getDoseReference() << " invalid: Volume of reference dose should not be 0!"); } return true; } IndexValueType HomogeneityIndex::getValueAt(core::DVHSet::IndexType tvIndex) { std::vector dvhTVSet = this->_dvhSet->getTargetVolumeSet(); if (tvIndex >= dvhTVSet.size()) { rttbExceptionMacro(core::InvalidParameterException, << "tvIndex invalid: it should be <" << dvhTVSet.size() << "!"); } core::DVH dvh = dvhTVSet.at(tvIndex); if (this->getDoseReference() <= 0) { rttbExceptionMacro(core::InvalidParameterException, << "Reference dose " << this->getDoseReference() << " invalid: Volume of reference dose should not be 0!"); } return (dvh.getMaximum() - dvh.getMinimum()) / this->getDoseReference(); } }//end namespace indices }//end namespace rttb diff --git a/code/indices/rttbHomogeneityIndex.h b/code/indices/rttbHomogeneityIndex.h index 568326a..ba0d74b 100644 --- a/code/indices/rttbHomogeneityIndex.h +++ b/code/indices/rttbHomogeneityIndex.h @@ -1,65 +1,60 @@ // ----------------------------------------------------------------------- // 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 "rttbDvhBasedDoseIndex.h" #include "rttbBaseType.h" #include "RTTBIndicesExports.h" namespace rttb { namespace indices { /*! @class HomogeneityIndex @brief This class representing a HomogeneityIndex Object. @details Homogeneity Index \f$(HI) = \frac{D_{max}(PTV)-D_{min}(PTV)}{D_{ref}}\f$ @ingroup indices */ class RTTBIndices_EXPORT HomogeneityIndex : public DvhBasedDoseIndex { protected: /*! @brief Calculate Conformity index @exception InvalidParameterException Thrown if aDoseReference invalid */ bool calcIndex() override; public: /*! @brief Constructor */ HomogeneityIndex(core::DVHSet::Pointer 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 getValueAt(const core::DVHSet::IndexType tvIndex) override; }; } } #endif