diff --git a/code/core/rttbAccessorInterface.h b/code/core/rttbAccessorInterface.h index f3e3779..8783061 100644 --- a/code/core/rttbAccessorInterface.h +++ b/code/core/rttbAccessorInterface.h @@ -1,95 +1,100 @@ // ----------------------------------------------------------------------- // 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 __ACCESSOR_INTERFACE_H #define __ACCESSOR_INTERFACE_H #include #include "rttbBaseType.h" #include "rttbGeometricInfo.h" #include "rttbIndexConversionInterface.h" #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class AccessorInterface @brief Interface for any sort of Accessor */ class RTTBCore_EXPORT AccessorInterface : public IndexConversionInterface { public: using AccessorPointer = boost::shared_ptr; using DoseAccessorPointer = boost::shared_ptr; private: AccessorInterface(const AccessorInterface&) = delete; //not implemented on purpose -> non-copyable AccessorInterface& operator=(const AccessorInterface&) = delete;//not implemented on purpose -> non-copyable public: AccessorInterface() = default; ~AccessorInterface() override = default; /*! @brief test if given ID is inside current dose grid */ bool validID(const VoxelGridID aID) const { return this->getGeometricInfo().validID(aID); }; /*! @brief test if given index is inside current dose grid */ bool validIndex(const VoxelGridIndex3D& aIndex) const { return this->getGeometricInfo().validIndex(aIndex); }; virtual const core::GeometricInfo& getGeometricInfo() const = 0; virtual GridSizeType getGridSize() const { return this->getGeometricInfo().getNumberOfVoxels(); }; virtual GenericValueType getValueAt(const VoxelGridID aID) const = 0; virtual GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const = 0; /*! @brief is true if dose is on a homogeneous grid @remarks Inhomogeneous grids are not supported at the moment, but if they will be supported in the future the interface does not need to change. */ virtual bool isGridHomogeneous() const { return true; } virtual const IDType getUID() const = 0; }; } } #endif diff --git a/code/core/rttbAccessorWithGeoInfoBase.h b/code/core/rttbAccessorWithGeoInfoBase.h index 6c50bab..9eadbc9 100644 --- a/code/core/rttbAccessorWithGeoInfoBase.h +++ b/code/core/rttbAccessorWithGeoInfoBase.h @@ -1,53 +1,58 @@ // ----------------------------------------------------------------------- // 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 __ACCESSOR_WITH_GEO_INFO_BASE_H #define __ACCESSOR_WITH_GEO_INFO_BASE_H #include "rttbAccessorInterface.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class AccessorWithGeoInfoBase @brief Base class for all accessor implementations that have there own geometric info. */ class RTTBCore_EXPORT AccessorWithGeoInfoBase : public core::AccessorInterface { protected: virtual void assembleGeometricInfo()=0; core::GeometricInfo _geoInfo; public: ~AccessorWithGeoInfoBase() override; AccessorWithGeoInfoBase(); const core::GeometricInfo& getGeometricInfo() const override; }; } } #endif diff --git a/code/core/rttbBaseType.h b/code/core/rttbBaseType.h index 4e98c88..bfa9dbe 100644 --- a/code/core/rttbBaseType.h +++ b/code/core/rttbBaseType.h @@ -1,610 +1,615 @@ // ----------------------------------------------------------------------- // 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 __BASE_TYPE_NEW_H #define __BASE_TYPE_NEW_H #include #include #include #include #include #include #include #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { const double errorConstant = 1e-5; const double reducedErrorConstant = 0.0001; using UnsignedIndex1D = unsigned short; /*! @class UnsignedIndex3D @brief 3D index. */ class UnsignedIndex3D: public boost::numeric::ublas::vector { public: UnsignedIndex3D() : boost::numeric::ublas::vector(3,0) {} UnsignedIndex3D(const UnsignedIndex1D value) : boost::numeric::ublas::vector(3, value) {} UnsignedIndex3D(const UnsignedIndex1D xValue, const UnsignedIndex1D yValue, const UnsignedIndex1D zValue) : boost::numeric::ublas::vector(3, xValue) { (*this)(1) = yValue; (*this)(2) = zValue; } const UnsignedIndex1D x() const { return (*this)(0); } const UnsignedIndex1D y() const { return (*this)(1); } const UnsignedIndex1D z() const { return (*this)(2); } friend bool operator==(const UnsignedIndex3D& gi1, const UnsignedIndex3D& gi2) { if (gi1.size() != gi2.size()) { return false; } for (size_t i = 0; i < gi1.size(); i++) { if (gi1(i) != gi2(i)) { return false; } } return true; } friend std::ostream& operator<<(std::ostream& s, const UnsignedIndex3D& aVector) { s << "[ " << aVector(0) << ", " << aVector(1) << ", " << aVector(2) << " ]"; return s; } }; using UnsignedIndexList = std::list; using FileNameString = std::string; using ContourGeometricTypeString = std::string; using WorldCoordinate = double; /*! @class WorldCoordinate3D @brief 3D coordinate in real world coordinates like in DICOM to define ImagePositionPatient. */ class WorldCoordinate3D: public boost::numeric::ublas::vector { public: WorldCoordinate3D() : boost::numeric::ublas::vector(3,0) {} WorldCoordinate3D(const WorldCoordinate value) : boost::numeric::ublas::vector(3, value) {} WorldCoordinate3D(const WorldCoordinate xValue, const WorldCoordinate yValue, const WorldCoordinate zValue) : boost::numeric::ublas::vector(3, xValue) { (*this)(1) = yValue; (*this)(2) = zValue; } WorldCoordinate3D(const WorldCoordinate3D& w): boost::numeric::ublas::vector(3) { (*this)(0) = w.x(); (*this)(1) = w.y(); (*this)(2) = w.z(); } const WorldCoordinate x() const { return (*this)(0); } const WorldCoordinate y() const { return (*this)(1); } const WorldCoordinate z() const { return (*this)(2); } //vector cross product (not included in boost.ublas) WorldCoordinate3D cross(WorldCoordinate3D aVector) const { WorldCoordinate3D result; WorldCoordinate x = (*this)(0); WorldCoordinate y = (*this)(1); WorldCoordinate z = (*this)(2); result(0) = y * aVector(2) - z * aVector(1); result(1) = z * aVector(0) - x * aVector(2); result(2) = x * aVector(1) - y * aVector(0); return result; } const std::string toString() const { std::string s = std::to_string(x()) + " " + std::to_string(y()) + " " + std::to_string(z()); return s; } WorldCoordinate3D& operator=(const WorldCoordinate3D& wc) { (*this)(0) = wc.x(); (*this)(1) = wc.y(); (*this)(2) = wc.z(); return (*this); } WorldCoordinate3D& operator=(const boost::numeric::ublas::vector wc) { (*this)(0) = wc(0); (*this)(1) = wc(1); (*this)(2) = wc(2); return (*this); } WorldCoordinate3D operator-(const boost::numeric::ublas::vector wc) { return WorldCoordinate3D((*this)(0) - wc(0), (*this)(1) - wc(1), (*this)(2) - wc(2)); } WorldCoordinate3D operator+(const boost::numeric::ublas::vector wc) { return WorldCoordinate3D((*this)(0) + wc(0), (*this)(1) + wc(1), (*this)(2) + wc(2)); } friend bool operator==(const WorldCoordinate3D& wc1, const WorldCoordinate3D& wc2) { if (wc1.size() != wc2.size()) { return false; } for (size_t i = 0; i < wc1.size(); i++) { if (wc1(i) != wc2(i)) { return false; } } return true; } bool equalsAlmost(const WorldCoordinate3D& another, double errorConstantWC = 1e-5) const { if (size() != another.size()) { return false; } double dist = norm_2(*this - another); return dist < errorConstantWC; } friend std::ostream& operator<<(std::ostream& s, const WorldCoordinate3D& aVector) { s << "[ " << aVector(0) << ", " << aVector(1) << ", " << aVector(2) << " ]"; return s; } }; /* ! @brief continuous index */ using DoubleVoxelGridIndex3D = rttb::WorldCoordinate3D; using ImageSize = rttb::UnsignedIndex3D; using GridVolumeType = double; /*! @class SpacingVectorType3D @brief 3D spacing vector. @pre values of this vector may not be negative. */ class SpacingVectorType3D: public boost::numeric::ublas::vector { public: SpacingVectorType3D() : boost::numeric::ublas::vector(3,0) {} SpacingVectorType3D(const GridVolumeType value) : boost::numeric::ublas::vector(3, value) { if (value < 0) { throw std::invalid_argument("received negative value"); } } SpacingVectorType3D(const GridVolumeType xValue, const GridVolumeType yValue, const GridVolumeType zValue) : boost::numeric::ublas::vector(3) { if (xValue < 0 || yValue < 0 || zValue < 0) { throw std::invalid_argument("received negative value"); } (*this)(0) = xValue; (*this)(1) = yValue; (*this)(2) = zValue; } SpacingVectorType3D(const SpacingVectorType3D& w) : SpacingVectorType3D(w.x(), w.y(), w.z()) { } const GridVolumeType x() const { return (*this)(0); } const GridVolumeType y() const { return (*this)(1); } const GridVolumeType z() const { return (*this)(2); } const std::string toString() const { std::string s = std::to_string(x()) + " " + std::to_string(y()) + " " + std::to_string(z()); return s; } SpacingVectorType3D& operator=(const SpacingVectorType3D& wc) { (*this)(0) = wc.x(); (*this)(1) = wc.y(); (*this)(2) = wc.z(); return (*this); } SpacingVectorType3D& operator=(const WorldCoordinate3D& wc) { (*this)(0) = GridVolumeType(wc.x()); (*this)(1) = GridVolumeType(wc.y()); (*this)(2) = GridVolumeType(wc.z()); return (*this); } SpacingVectorType3D& operator=(const boost::numeric::ublas::vector wc) { (*this)(0) = wc(0); (*this)(1) = wc(1); (*this)(2) = wc(2); return (*this); } friend bool operator==(const SpacingVectorType3D& wc1, const SpacingVectorType3D& wc2) { if (wc1.size() != wc2.size()) { return false; } for (size_t i = 0; i < wc1.size(); i++) { if (wc1(i) != wc2(i)) { return false; } } return true; } bool equalsAlmost(const SpacingVectorType3D& another, double errorConstantSV = 1e-5) const { if ((*this).size() != another.size()) { return false; } double dist = norm_2(*this - another); return dist < errorConstantSV; } friend std::ostream& operator<<(std::ostream& s, const SpacingVectorType3D& aVector) { s << "[ " << aVector(0) << ", " << aVector(1) << ", " << aVector(2) << " ]"; return s; } }; /*! @class OrientationMatrix @brief Used to store image orientation information */ class OrientationMatrix : public boost::numeric::ublas::matrix { public: /*! The default constructor generates a 3x3 unit matrix */ OrientationMatrix() : boost::numeric::ublas::matrix(3, 3, 0) { for (std::size_t m = 0; m < (*this).size1(); m++) { (*this)(m, m) = 1; } } OrientationMatrix(const WorldCoordinate value) : boost::numeric::ublas::matrix(3, 3, value) {} bool equalsAlmost(const OrientationMatrix& anOrientationMatrix, double errorConstantOM=1e-5) const { if (anOrientationMatrix.size1() == (*this).size1()) { if (anOrientationMatrix.size2() == (*this).size2()) { for (std::size_t m = 0; m < anOrientationMatrix.size1(); m++) { for (std::size_t n = 0; n < anOrientationMatrix.size2(); n++) { if ((std::abs((*this)(m, n) - anOrientationMatrix(m, n)) > errorConstantOM)) { return false; } } }// end element comparison } else { return false; } } else { return false; } return true; } friend bool operator==(const OrientationMatrix& om1, const OrientationMatrix& om2) { return om1.equalsAlmost(om2, 0.0); } friend std::ostream& operator<<(std::ostream& s, const OrientationMatrix& anOrientationMatrix) { s << "[ "; for (std::size_t m = 0; m < anOrientationMatrix.size1(); m++) { s << "[ "; for (std::size_t n = 0; n < anOrientationMatrix.size2(); n++) { if (n == 0) { s << anOrientationMatrix(m, n); } else { s << ", " << anOrientationMatrix(m, n); } } s << " ]"; } s << " ]"; return s; } }; /*! base for 2D and 3D VoxelIndex; Therefore required beside VoxelGridID */ using GridIndexType = unsigned int; /*! @class VoxelGridIndex3D @brief 3D voxel grid index in a discret geometry (matrix/image). @details analogous to DICOM where ImagePositionPatient gives the position of the center of the first coordinate (0/0/0) */ class VoxelGridIndex3D: public boost::numeric::ublas::vector { public: VoxelGridIndex3D() : boost::numeric::ublas::vector(3,0) {} VoxelGridIndex3D(const GridIndexType value) : boost::numeric::ublas::vector(3, value) {} VoxelGridIndex3D(const GridIndexType xValue, const GridIndexType yValue, const GridIndexType zValue) : boost::numeric::ublas::vector(3, xValue) { (*this)(1) = yValue; (*this)(2) = zValue; } const GridIndexType x() const { return (*this)(0); } const GridIndexType y() const { return (*this)(1); } const GridIndexType z() const { return (*this)(2); } const std::string toString() const { std::string s = std::to_string(x()) + " " + std::to_string(y()) + " " + std::to_string(z()); return s; } VoxelGridIndex3D& operator=(const UnsignedIndex3D& ui) { (*this)(0) = ui(0); (*this)(1) = ui(1); (*this)(2) = ui(2); return (*this); } friend bool operator==(const VoxelGridIndex3D& gi1, const VoxelGridIndex3D& gi2) { if (gi1.size() != gi2.size()) { return false; } for (size_t i = 0; i < gi1.size(); i++) { if (gi1(i) != gi2(i)) { return false; } } return true; } friend std::ostream& operator<<(std::ostream& s, const VoxelGridIndex3D& aVector) { s << "[ " << aVector(0) << ", " << aVector(1) << ", " << aVector(2) << " ]"; return s; } }; /*! @class VoxelGridIndex3D @brief 2D voxel grid index. */ class VoxelGridIndex2D: public boost::numeric::ublas::vector { public: VoxelGridIndex2D() : boost::numeric::ublas::vector(2,0) {} VoxelGridIndex2D(const GridIndexType value) : boost::numeric::ublas::vector(2, value) {} VoxelGridIndex2D(const GridIndexType xValue, const GridIndexType yValue) : boost::numeric::ublas::vector(2, xValue) { (*this)(1) = yValue; } const GridIndexType x() const { return (*this)(0); } const GridIndexType y() const { return (*this)(1); } const std::string toString() const { std::string s = std::to_string(x()) + " " + std::to_string(y()); return s; } friend bool operator==(const VoxelGridIndex2D& gi1, const VoxelGridIndex2D& gi2) { if (gi1.size() != gi2.size()) { return false; } for (size_t i = 0; i < gi1.size(); i++) { if (gi1(i) != gi2(i)) { return false; } } return true; } friend std::ostream& operator<<(std::ostream& s, const VoxelGridIndex2D& aVector) { s << "[ " << aVector(0) << ", " << aVector(1) << " ]"; return s; } }; using GridSizeType = long; using VoxelGridID = int; //starts from 0 and is continuously counting all positions on the grid using VoxelGridDimensionType = unsigned int; typedef double FractionType, DVHVoxelNumber; typedef double DoseCalcType, DoseTypeGy, GenericValueType, DoseVoxelVolumeType, VolumeType, GridVolumeType, PercentType, VoxelNumberType, BEDType, LQEDType; using IDType = std::string; using StructureLabel = std::string; struct DVHRole { enum Type { TargetVolume = 1, HealthyTissue = 2, WholeVolume = 4, UserDefined = 128 } Type; }; struct DVHType { enum Type { Differential = 1, Cumulative = 2 } Type; }; using FileNameType = std::string; using PolygonType = std::vector; using PolygonSequenceType = std::vector; using IndexValueType = double; using DoseStatisticType = double; using DICOMRTFileNameString = std::string; using Uint16 = unsigned short; typedef std::string XMLString, StatisticsString; }//end: namespace rttb #endif diff --git a/code/core/rttbDVH.h b/code/core/rttbDVH.h index 0185c1e..f6359b1 100644 --- a/code/core/rttbDVH.h +++ b/code/core/rttbDVH.h @@ -1,207 +1,212 @@ // ----------------------------------------------------------------------- // 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_H #define __DVH_H #include #include #include #include "boost/shared_ptr.hpp" #include "rttbBaseType.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class DVH @brief This is a class representing a dose volume histogram (DVH) */ class RTTBCore_EXPORT DVH { public: using DataDifferentialType = std::deque; using DVHPointer = boost::shared_ptr; private: /*! @brief Differential dvh data index is the dose bin, value is the voxel number (sub voxel accuracy) of the dose bin */ DataDifferentialType _dataDifferential; /*! @brief Differential dvh data relative to the total number of voxels */ DataDifferentialType _dataDifferentialRelative; /*! @brief Absolute dose value of a dose-bin in Gy */ DoseTypeGy _deltaD; /*! @brief Volume of a voxel in cm3 */ DoseVoxelVolumeType _deltaV; IDType _structureID; IDType _doseID; IDType _voxelizationID; StructureLabel _label; DoseStatisticType _maximum; DoseStatisticType _minimum; DoseStatisticType _mean; DoseStatisticType _modal; DVHVoxelNumber _numberOfVoxels; DoseStatisticType _median; DoseStatisticType _stdDeviation; DoseStatisticType _variance; DataDifferentialType _dataCumulative; DataDifferentialType _dataCumulativeRelative; /*! @brief DVH initialization The DVH is initialized and all statistical values are calculated. @throw if _deltaV or _deltaD are zero @throw is _data differential is empty */ void init(); /*! @brief Calculate the cumulative data of dvh */ void calcCumulativeDVH(); public: ~DVH(); /*! @throw if _deltaV or _deltaD are zero @throw is _data differential is empty */ DVH(const DataDifferentialType& aDataDifferential, const DoseTypeGy& aDeltaD, const DoseVoxelVolumeType& aDeltaV, const IDType& aStructureID, const IDType& aDoseID); /*! @throw if _deltaV or _deltaD are zero @throw is _data differential is empty */ DVH(const DataDifferentialType& aDataDifferential, DoseTypeGy aDeltaD, DoseVoxelVolumeType aDeltaV, const IDType& aStructureID, const IDType& aDoseID, const IDType& aVoxelizationID); DVH(const DVH& copy); /*! @throw if _deltaV or _deltaD are zero @throw is _data differential is empty */ DVH& operator=(const DVH& copy); /*! equality operator DVHs are considered equal if the following are equal (let alone double inconsistencies): - structureID - doseID - voxelizationID - number of voxels - Histogram entries. */ bool friend operator==(const DVH& aDVH, const DVH& otherDVH); friend std::ostream& operator<<(std::ostream& s, const DVH& aDVH); void setLabel(StructureLabel aLabel); StructureLabel getLabel() const; /*! @param relativeVolume default false-> Value is the voxel number of the dose bin; if true-> value is the relative volume % between 0 and 1, (the voxel number of this dose bin)/(number of voxels) @return Return differential data of the dvh (relative or absolute depending on the input parameter). */ DataDifferentialType getDataDifferential(bool relativeVolume = false) const; /*! @param relativeVolume default false-> Value is the voxel number of the dose bin; if true-> value is the relative volume % between 0 and 1, (the voxel number of this dose bin)/(number of voxels) @return Return cumulative data of the dvh */ DataDifferentialType getDataCumulative(bool relativeVolume = false) const; DoseVoxelVolumeType getDeltaV() const; DoseTypeGy getDeltaD() const; IDType getStructureID() const; IDType getDoseID() const; IDType getVoxelizationID() const; void setDoseID(IDType aDoseID); void setStructureID(IDType aStrID); /*! @brief Calculate number of the voxels (with sub voxel accuracy) @return Return -1 if not initialized */ DVHVoxelNumber getNumberOfVoxels() const; /*! @brief Get the maximum dose in Gy from dvh @return Return the maximum dose in Gy (i+0.5)*deltaD, i-the maximal dose-bin with volume>0 Return -1 if not initialized */ DoseStatisticType getMaximum() const; /*! @brief Get the minimum dose in Gy from dvh @return Return the minimum dose (i+0.5)*deltaD, i-the minimal dose-bin with volume>0 Return -1 if not initialized */ DoseStatisticType getMinimum() const; DoseStatisticType getMean() const; DoseStatisticType getMedian() const; DoseStatisticType getModal() const; DoseStatisticType getStdDeviation() const; DoseStatisticType getVariance() const; /*! @brief Get Vx the volume irradiated to >= x @return Return absolute Volume in absolute cm3 Return -1 if not initialized */ VolumeType getVx(DoseTypeGy xDoseAbsolute) const; /*! @brief Get Dx the minimal dose delivered to x @return Return absolute dose value in Gy Return -1 if not initialized */ DoseTypeGy getDx(VolumeType xVolumeAbsolute) const; /*! @brief Calculate the absolute volume in cm3 @param relativePercent 0~100, the percent of the whole volume */ VolumeType getAbsoluteVolume(int relativePercent) const; /* @brief Multiplies each values with its Delta value. Values depend on DVHType. @param The DVHType that is being used DVHType::Cumulative or DVHType::Differential */ std::map getNormalizedDVH(DVHType dvhType = { DVHType::Cumulative }) const; }; } } #endif diff --git a/code/core/rttbDVHCalculator.h b/code/core/rttbDVHCalculator.h index fb6e126..9be7e98 100644 --- a/code/core/rttbDVHCalculator.h +++ b/code/core/rttbDVHCalculator.h @@ -1,74 +1,78 @@ // ----------------------------------------------------------------------- // 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_CALCULATOR_H #define __DVH_CALCULATOR_H #include "rttbBaseType.h" #include "rttbDoseIteratorInterface.h" #include "rttbMaskedDoseIteratorInterface.h" #include "rttbDVHGeneratorInterface.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif namespace rttb { namespace core { /*! @class DVHCalculator @brief Calculates a DVH for a given DoseIterator. */ class RTTBCore_EXPORT DVHCalculator : public DVHGeneratorInterface { public: using DoseIteratorPointer = core::DoseIteratorInterface::DoseIteratorPointer; using MaskedDoseIteratorPointer = core::MaskedDoseIteratorInterface::MaskedDoseIteratorPointer; DoseIteratorPointer _doseIteratorPtr; IDType _structureID; IDType _doseID; DoseTypeGy _deltaD; int _numberOfBins; /*! @brief Constructor. @param aDeltaD the absolute dose value in Gy for dose_bin [i,i+1). Optional, if aDeltaD==0, it will be calculated using aDeltaD=max(aDoseIterator)*1.5/aNumberOfBins @exception InvalidParameterException throw if _numberOfBins<=0 or _deltaD<0 */ DVHCalculator(DoseIteratorPointer aDoseIterator, const IDType& aStructureID, const IDType& aDoseID, const DoseTypeGy aDeltaD = 0, const int aNumberOfBins = 201); ~DVHCalculator(); /*! @brief Generate DVH @return Return new shared pointer of DVH. @exception InvalidParameterException throw if _numberOfBins invalid: _numberOfBins must be > max(aDoseIterator)/aDeltaD! */ DVHPointer generateDVH() override; }; } } #endif diff --git a/code/core/rttbDVHGeneratorInterface.h b/code/core/rttbDVHGeneratorInterface.h index ceb095f..f6745fb 100644 --- a/code/core/rttbDVHGeneratorInterface.h +++ b/code/core/rttbDVHGeneratorInterface.h @@ -1,50 +1,55 @@ // ----------------------------------------------------------------------- // 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_GENERATOR_INTERFACE_H #define __DVH_GENERATOR_INTERFACE_H #include #include "rttbDVH.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class DVHGeneratorInterface @brief Interface for all DVH generating classes */ class DVHGeneratorInterface { public: using DVHPointer = core::DVH::DVHPointer; protected: DVHPointer _dvh; public: /*! @brief Generate DVH @return Return new shared pointer of DVH. */ virtual DVHPointer generateDVH() = 0; }; } } #endif diff --git a/code/core/rttbDVHSet.h b/code/core/rttbDVHSet.h index 34b4e21..c13f586 100644 --- a/code/core/rttbDVHSet.h +++ b/code/core/rttbDVHSet.h @@ -1,141 +1,146 @@ // ----------------------------------------------------------------------- // 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" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class DVHSet @brief This is a class representing a RT DVHSet including Target Volume and Organ at Risk. @details 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 RTTBCore_EXPORT DVHSet { public: using DVHSetType = std::vector; using IndexType = DVHSetType::size_type; 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 = ""); /*! @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); IDType getStrSetID() const; IDType getDoseID() const; /*! @brief Get the DVH according to the structure ID @return Return nullptr 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 Get DVH subset for target volume */ const DVHSetType& getTargetVolumeSet() const { return _dvhTVSet; }; /*! @brief Get DVH subset for healthy tissue */ const DVHSetType& getHealthyTissueSet() const { return _dvhHTSet; }; /*! @brief Get DVH subset for whole volume */ const DVHSetType& getWholeVolumeSet() const { return _dvhWVSet; }; /*! @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 getHealthyTissueVolume(DoseTypeGy aDoseAbsolute) const; /*! @brief Get the target volume irradiated to >= aDoseAbsolute @return Return -1 if DVH of _dvhTVSet init() failed */ VolumeType getTargetVolume(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); friend std::ostream& operator<<(std::ostream& s, const DVHSet& aDVHSet); friend std::ostream& operator<<(std::ostream& s, const DVHSetType& aDVHSet); }; 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::DVHSetType& aDVHSet); } } #endif diff --git a/code/core/rttbDoseAccessorGeneratorBase.h b/code/core/rttbDoseAccessorGeneratorBase.h index 8a27f68..a781ac5 100644 --- a/code/core/rttbDoseAccessorGeneratorBase.h +++ b/code/core/rttbDoseAccessorGeneratorBase.h @@ -1,44 +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 __DOSE_ACCESSOR_GENERATOR_BASE_H #define __DOSE_ACCESSOR_GENERATOR_BASE_H #include #include "rttbDoseAccessorGeneratorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class DoseAccessorGeneratorBase @brief Abstract class for all Dose Accessor generating classes */ class DoseAccessorGeneratorBase: public DoseAccessorGeneratorInterface { protected: /*! @brief Dose accessor which should be generated */ DoseAccessorPointer _doseAccessor; }; } } #endif diff --git a/code/core/rttbDoseAccessorGeneratorInterface.h b/code/core/rttbDoseAccessorGeneratorInterface.h index 3bb3799..b2fd5a3 100644 --- a/code/core/rttbDoseAccessorGeneratorInterface.h +++ b/code/core/rttbDoseAccessorGeneratorInterface.h @@ -1,61 +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 __DOSE_ACCESSOR_GENERATOR_INTERFACE_H #define __DOSE_ACCESSOR_GENERATOR_INTERFACE_H #include "rttbDoseAccessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class DoseAccessorGeneratorInterface @brief Interface for all Dose Accessor generating classes */ class DoseAccessorGeneratorInterface { public: using DoseAccessorPointer = core::AccessorInterface::AccessorPointer; private: DoseAccessorGeneratorInterface(const DoseAccessorGeneratorInterface&) = delete; //not implemented on purpose -> non-copyable DoseAccessorGeneratorInterface& operator=(const DoseAccessorGeneratorInterface&) = delete;//not implemented on purpose -> non-copyable protected: DoseAccessorGeneratorInterface() = default; virtual ~DoseAccessorGeneratorInterface() = default; public: /*! @brief Generate DoseAccessor @return Return shared pointer of DoseAccessor. */ virtual DoseAccessorPointer generateDoseAccessor() = 0; }; } } #endif diff --git a/code/core/rttbDoseAccessorInterface.h b/code/core/rttbDoseAccessorInterface.h index 4ae053b..1ee024a 100644 --- a/code/core/rttbDoseAccessorInterface.h +++ b/code/core/rttbDoseAccessorInterface.h @@ -1,34 +1,39 @@ // ----------------------------------------------------------------------- // 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_ACCESSOR_INTERFACE_NEW_H #define __DOSE_ACCESSOR_INTERFACE_NEW_H #include "rttbAccessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { using DoseAccessorInterface = rttb::core::AccessorInterface; } } #endif diff --git a/code/core/rttbDoseIteratorInterface.h b/code/core/rttbDoseIteratorInterface.h index ec4479c..6bd1324 100644 --- a/code/core/rttbDoseIteratorInterface.h +++ b/code/core/rttbDoseIteratorInterface.h @@ -1,97 +1,102 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __DOSE_ITERATOR_INTERFACE_NEW_H #define __DOSE_ITERATOR_INTERFACE_NEW_H #include #include "rttbBaseType.h" #include "rttbDoseAccessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { class GeometricInfo; /*! @class DoseIteratorInterface @brief This class represents the dose iterator interface. */ class DoseIteratorInterface { public: using DoseAccessorPointer = boost::shared_ptr; using DoseIteratorPointer = boost::shared_ptr; private: DoseIteratorInterface(const DoseIteratorInterface&) = delete; //not implemented on purpose -> non-copyable DoseIteratorInterface& operator=(const DoseIteratorInterface&) = delete;//not implemented on purpose -> non-copyable DoseIteratorInterface() = default; protected: /*! @brief DoseAccessor to get access to actual dose data */ DoseAccessorPointer _spDoseAccessor; public: /*! @brief Constructor with a DoseIterator this should be the default for all implementations. */ DoseIteratorInterface(DoseAccessorPointer aDoseAccessor); virtual ~DoseIteratorInterface() = default; /*! @brief Set the iterator to the start of the dose. */ virtual bool reset() = 0; /*! @brief Move to next position. If this position is valid is not necessarily tested. */ virtual void next() = 0; virtual bool isPositionValid() const = 0; /*! @brief Return volume of one voxel (in cm3)*/ //previously getDeltaV() virtual DoseVoxelVolumeType getCurrentVoxelVolume() const = 0; virtual DoseTypeGy getCurrentDoseValue() const = 0; /*! @return If this is a masked dose iterator, return the voxel proportion inside a given structure, value 0~1; Otherwise, 1 */ virtual FractionType getCurrentRelevantVolumeFraction() const = 0; virtual VoxelGridID getCurrentVoxelGridID() const = 0; virtual IDType getVoxelizationID() const { return ""; }; IDType getDoseUID() const { return _spDoseAccessor->getUID(); }; }; //end class }//end: namespace core }//end: namespace rttb #endif diff --git a/code/core/rttbGenericDoseIterator.h b/code/core/rttbGenericDoseIterator.h index 3dfe2c8..de74257 100644 --- a/code/core/rttbGenericDoseIterator.h +++ b/code/core/rttbGenericDoseIterator.h @@ -1,102 +1,107 @@ // ----------------------------------------------------------------------- // 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 __GENERIC_DOSE_ITERATOR_INTERFACE_NEW_H #define __GENERIC_DOSE_ITERATOR_INTERFACE_NEW_H #include #include #include #include "rttbBaseType.h" #include "rttbDoseIteratorInterface.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class GenericDoseIterator @brief Standard implementation of the dose iterator interface. */ class RTTBCore_EXPORT GenericDoseIterator : public DoseIteratorInterface { public: using DoseAccessorPointer = DoseIteratorInterface::DoseAccessorPointer; using DoseIteratorPointer = DoseIteratorInterface::DoseIteratorPointer; private: VoxelGridID _currentDoseVoxelGridID; DoseVoxelVolumeType _currentVoxelVolume; GenericDoseIterator(const GenericDoseIterator&) = delete; //not implemented on purpose -> non-copyable GenericDoseIterator& operator=(const GenericDoseIterator&) = delete;//not implemented on purpose -> non-copyable public: /*! @brief Constructor @param aDoseAccessor contains the corresponding dose data */ GenericDoseIterator(DoseAccessorPointer aDoseAccessor); /*! @brief Set the itterator to the start of the Dose. @exception InvalidParameterException if a inhomogeneous grid is defined in the dose accessors, because these grids are currently not supported. */ bool reset() override; /*! @brief Test if next voxel position is still on the data grid, if so move to next position. */ void next() override; /*! @brief Determine if the current voxel position is valid. */ bool isPositionValid() const override; /*! @brief Return volume of one voxel (in cm3) @exception InvalidParameterException if a inhomogeneous grid is defined in the dose accessors, because these grids are currently not supported. */ DoseVoxelVolumeType getCurrentVoxelVolume() const override; DoseTypeGy getCurrentDoseValue() const override; /*! @brief For DoseIterators this function returns 1, always, because no mask is applied. */ inline FractionType getCurrentRelevantVolumeFraction() const override { return 1; }; inline VoxelGridID getCurrentVoxelGridID() const override { return _currentDoseVoxelGridID; }; }; } } #endif diff --git a/code/core/rttbGenericMaskedDoseIterator.h b/code/core/rttbGenericMaskedDoseIterator.h index 78a9939..291a94e 100644 --- a/code/core/rttbGenericMaskedDoseIterator.h +++ b/code/core/rttbGenericMaskedDoseIterator.h @@ -1,106 +1,110 @@ // ----------------------------------------------------------------------- // 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 __GENERIC_MASKED_DOSE_ITERATOR_NEW_H #define __GENERIC_MASKED_DOSE_ITERATOR_NEW_H #include #include "rttbBaseType.h" #include "rttbMaskedDoseIteratorInterface.h" #include "rttbMaskAccessorInterface.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif namespace rttb { namespace core { /*! @class GenericMaskedDoseIterator @brief This is a templated class representing a generic masked dose iterator for a VoxelizationPolicy. @see testing/GenericMaskedDoseIteratorTest.cpp for more information. */ class RTTBCore_EXPORT GenericMaskedDoseIterator : public MaskedDoseIteratorInterface { public: using MaskVoxelListPointer = MaskAccessorInterface::MaskVoxelListPointer; using MaskVoxelList = MaskAccessorInterface::MaskVoxelList; using MaskAccessorPointer = MaskedDoseIteratorInterface::MaskAccessorPointer; using DoseAccessorPointer = MaskedDoseIteratorInterface::DoseAccessorPointer; private: using MaskVoxelListIterator = MaskVoxelList::const_iterator; /*! The current index position of the vector _maskVoxelVec*/ MaskVoxelListIterator _currentMaskPos; /*! vector of MaskVoxel, as defined in the voxelization*/ MaskVoxelListPointer _maskVoxelVec; /*! the volume in cm^3 of the current dose voxel*/ DoseVoxelVolumeType _currentVoxelVolume; public: GenericMaskedDoseIterator(MaskAccessorPointer aSpMask, DoseAccessorPointer aDoseAccessor) : MaskedDoseIteratorInterface(aSpMask, aDoseAccessor) {}; /*! @brief Set the position on the first index. Use also as initialization. */ bool reset() override; /*! move to next mask position. The validity of the position is not checked here. */ void next() override; /*! @brief Volume of one voxel (in cm3) @exception InvalidParameterException if a inhomogeneous grid is defined in the dose accessors, because these grids are currently not supported. */ DoseVoxelVolumeType getCurrentVoxelVolume() const override; FractionType getCurrentRelevantVolumeFraction() const override; inline MaskVoxelListPointer getMaskVoxelVec() const { return _maskVoxelVec; }; /*! Check first if the position inside the maskedVoxelVector is valid. If so, check if the gridID at the current position in the MaskedVoxelVector is valid in the dose and mask grid. */ bool isPositionValid() const override; /*! @brief get current VoxelGridID (on dose voxel grid)*/ VoxelGridID getCurrentVoxelGridID() const override; /*! @return current dose value multiplied by current volume fraction*/ DoseTypeGy getCurrentMaskedDoseValue() const override; /*! @return current dose value without masking*/ DoseTypeGy getCurrentDoseValue() const override; }; } } #endif diff --git a/code/core/rttbGeometricInfo.h b/code/core/rttbGeometricInfo.h index 0caa40e..c782c75 100644 --- a/code/core/rttbGeometricInfo.h +++ b/code/core/rttbGeometricInfo.h @@ -1,181 +1,186 @@ // ----------------------------------------------------------------------- // 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 __GEOMETRIC_INFO_NEW_H #define __GEOMETRIC_INFO_NEW_H #include #include #include "rttbBaseType.h" #include #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @brief GeometricInfo objects contain all the information required for transformations between voxel grid coordinates and world coordinates. Corresponding converter functions are also available. @note ITK Pixel Indexing used (http://www.itk.org/Doxygen45/html/classitk_1_1Image.html): The Index type reverses the order so that with Index[0] = col, Index[1] = row, Index[2] = slice. */ class RTTBCore_EXPORT GeometricInfo { private: WorldCoordinate3D _imagePositionPatient{ 0 }; OrientationMatrix _orientationMatrix{ 0 }; OrientationMatrix _invertedOrientationMatrix{ 0 }; SpacingVectorType3D _spacing{ 0 }; VoxelGridDimensionType _numberOfColumns{0}; VoxelGridDimensionType _numberOfRows{0}; VoxelGridDimensionType _numberOfFrames{0}; /* @brief Matrix inversion routine. Uses lu_factorize and lu_substitute in uBLAS to invert a matrix http://savingyoutime.wordpress.com/2009/09/21/c-matrix-inversion-boostublas/ */ bool computeInvertOrientation(); public: /*! @brief Constructor, initializes orientation matrix, spacing vector and patient position with zeros. */ GeometricInfo() = default; void setSpacing(const SpacingVectorType3D& aSpacingVector); const SpacingVectorType3D& getSpacing() const; void setImagePositionPatient(const WorldCoordinate3D& aImagePositionPatient); const WorldCoordinate3D& getImagePositionPatient() const; void setOrientationMatrix(const OrientationMatrix& anOrientationMatrix); const OrientationMatrix getOrientationMatrix() const { return _orientationMatrix; }; void setImageSize(const ImageSize& aSize); const ImageSize getImageSize() const; void setNumColumns(const VoxelGridDimensionType aValue); const VoxelGridDimensionType getNumColumns() const; void setNumRows(const VoxelGridDimensionType aValue); const VoxelGridDimensionType getNumRows() const; void setNumSlices(const VoxelGridDimensionType aValue); const VoxelGridDimensionType getNumSlices() const; /*! @brief determines equality of two GeometricInfo objects. */ friend bool RTTBCore_EXPORT operator == (const GeometricInfo& gInfo, const GeometricInfo& gInfo1); bool equalsAlmost(const GeometricInfo& another, double errorConstantGI = 1e-5) const; /*! @brief converts world coordinates to voxel grid index. @details the voxels world coordinates are defined by spacing, orientation and imagePositionPatient. (-0.5/-0.5/-0.5) --> (0/0/0) and (0.4999/0.4999/0.4999) --> (0/0/0) define the outer coordinates of a voxel with spacing=1, orientation= x y z (identity matrix) and imagePositionPatient=(0/0/0). @sa WorldCoordinate3D VoxelGridIndex3D @note The conversion of values is done even if the target index is not inside the given voxel grid. @returns false if aWorldCoordinate is outside the voxel grid, true otherwise. */ bool worldCoordinateToIndex(const WorldCoordinate3D& aWorldCoordinate, VoxelGridIndex3D& aIndex) const; /*! @brief converts world coordinates to double geometry coordinate. @details This is needed because of a double precision voxel coordinate system for voxelization. The world coordinate of the image position patient is the center of the first voxel (0.0/0.0/0.0). (-0.5/-0.5/-0.5) --> (-0.5/-0.5/-0.5) and (0.4999/0.4999/0.4999) --> (0.4999/0.4999/0.4999) with spacing=1, orientation= x y z (identity matrix) and imagePositionPatient=(0/0/0). @sa WorldCoordinate3D, DoubleVoxelGridIndex3D @note The conversion of values is done even if the target index is not inside the given voxel grid. @returns false if aWorldCoordinate is outside the voxel grid, true otherwise. */ bool worldCoordinateToGeometryCoordinate(const WorldCoordinate3D& aWorldCoordinate, DoubleVoxelGridIndex3D& aIndex) const; /*! @brief converts double geometry coordinate to world coordinates. @details This is needed because of a double precision voxel coordinate system for voxelization. The world coordinate of the image position patient is the center of the first voxel (0.0/0.0/0.0). (-0.5/-0.5/-0.5) --> (-0.5/-0.5/-0.5) and (5.5/3.2/1.0) --> (5.5/3.2/1.0) with spacing=1, orientation= x y z (identity matrix) and imagePositionPatient=(0/0/0). @sa DoubleVoxelGridIndex3D, WorldCoordinate3D @note The conversion of values is done even if the target index is not inside the given voxel grid. @returns false if aWorldCoordinate is outside the voxel grid, true otherwise. */ bool geometryCoordinateToWorldCoordinate(const DoubleVoxelGridIndex3D& aIndex, WorldCoordinate3D& aWorldCoordinate) const; /*! @brief convert voxel grid index to world coordinates @details The world coordinate of the image position patient (center of the first voxel) is the center of the first voxel (0.0/0.0/0.0) (0/0/0) --> (0.0/0.0/0.0) and (1/1/2) --> (1.0/1.0/2.0) with spacing=1, orientation= x y z (identity matrix) and imagePositionPatient=(0/0/0). Thus, the center of the voxel is taken and converted. @sa VoxelGridIndex3D, WorldCoordinate3D @note The conversion of values is done even if the target index is not inside the given voxel grid. @returns false if aWorldCoordinate is outside the voxel grid, true otherwise. */ bool indexToWorldCoordinate(const VoxelGridIndex3D& aIndex, WorldCoordinate3D& aWorldCoordinate) const; /*! @brief check if a given voxel grid index is inside the given voxel grid.*/ bool isInside(const VoxelGridIndex3D& aIndex) const; /*! @brief check if a given world coordinate is inside the given voxel grid.*/ bool isInside(const WorldCoordinate3D& aWorldCoordinate) const; const GridSizeType getNumberOfVoxels() const; bool convert(const VoxelGridID& gridID, VoxelGridIndex3D& gridIndex) const; bool convert(const VoxelGridIndex3D& gridIndex, VoxelGridID& gridID) const; /*! @brief test if given ID is inside current dose grid */ bool validID(const VoxelGridID aID) const; /*! @brief test if given index is inside current dose grid */ bool validIndex(const VoxelGridIndex3D& aIndex) const; /*!@ brief generates string stream representation of the GeometricInfo object. */ friend std::ostream& operator << (std::ostream& s, const GeometricInfo& anGeometricInfo); }; } } #endif diff --git a/code/core/rttbIndexConversionInterface.h b/code/core/rttbIndexConversionInterface.h index 78077be..474ba03 100644 --- a/code/core/rttbIndexConversionInterface.h +++ b/code/core/rttbIndexConversionInterface.h @@ -1,49 +1,53 @@ // ----------------------------------------------------------------------- // 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 __INDEX_CONVERSION_INTERFACE_NEW_H #define __INDEX_CONVERSION_INTERFACE_NEW_H +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif namespace rttb { namespace core { /*! @class IndexConversionInterface @brief This class represents the conversion of 3D grid indices to 1D grid IDs. */ class IndexConversionInterface { private: IndexConversionInterface(const IndexConversionInterface&) = delete; //not implemented on purpose -> non-copyable IndexConversionInterface& operator=(const IndexConversionInterface&) = delete;//not implemented on purpose -> non-copyable public: IndexConversionInterface() = default; virtual ~IndexConversionInterface() = default; }; } } #endif diff --git a/code/core/rttbMaskAccessorGeneratorBase.h b/code/core/rttbMaskAccessorGeneratorBase.h index 5a6477f..ad3da9a 100644 --- a/code/core/rttbMaskAccessorGeneratorBase.h +++ b/code/core/rttbMaskAccessorGeneratorBase.h @@ -1,54 +1,58 @@ // ----------------------------------------------------------------------- // 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 __MASK_ACCESSOR_GENERATOR_BASE_H #define __MASK_ACCESSOR_GENERATOR_BASE_H - #include "rttbMaskAccessorGeneratorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MaskAccessorGeneratorBase @brief Abstract class for all DoseAccessor generating classes */ class MaskAccessorGeneratorBase: public MaskAccessorGeneratorInterface { public: using MaskAccessorPointer = core::MaskAccessorInterface::MaskAccessorPointer; private: protected: /*! @brief Mask accessor which should be generated */ MaskAccessorPointer _maskAccessor; public: }; } } #endif diff --git a/code/core/rttbMaskAccessorGeneratorInterface.h b/code/core/rttbMaskAccessorGeneratorInterface.h index e09adb7..8da98e9 100644 --- a/code/core/rttbMaskAccessorGeneratorInterface.h +++ b/code/core/rttbMaskAccessorGeneratorInterface.h @@ -1,62 +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 __MASK_ACCESSOR_GENERATOR_INTERFACE_H #define __MASK_ACCESSOR_GENERATOR_INTERFACE_H - #include "rttbMaskAccessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MaskAccessorGeneratorInterface @brief Interface for all MaskAccessor generating classes */ class MaskAccessorGeneratorInterface { public: using MaskAccessorPointer = core::MaskAccessorInterface::MaskAccessorPointer; private: MaskAccessorGeneratorInterface(const MaskAccessorGeneratorInterface&) = delete; //not implemented on purpose -> non-copyable MaskAccessorGeneratorInterface& operator=(const MaskAccessorGeneratorInterface&) = delete;//not implemented on purpose -> non-copyable protected: MaskAccessorGeneratorInterface() = default; virtual ~MaskAccessorGeneratorInterface() = default; public: /*! @brief Generate MaskAccessor @return Return shared pointer of MaskAccessor. */ virtual MaskAccessorPointer generateMaskAccessor() = 0; }; } } #endif diff --git a/code/core/rttbMaskAccessorInterface.h b/code/core/rttbMaskAccessorInterface.h index e9c2f62..59b821b 100644 --- a/code/core/rttbMaskAccessorInterface.h +++ b/code/core/rttbMaskAccessorInterface.h @@ -1,103 +1,108 @@ // ----------------------------------------------------------------------- // 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 __MASK_ACCESSOR_INTERFACE_NEW_H #define __MASK_ACCESSOR_INTERFACE_NEW_H #include #include "rttbBaseType.h" #include "rttbMaskVoxel.h" #include "rttbIndexConversionInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { class GeometricInfo; /*! @class MaskAccessorInterface @brief This class triggers the voxelization and gives acess to the masked voxels. */ class MaskAccessorInterface: public IndexConversionInterface { public: using MaskVoxelList = std::vector; using MaskVoxelListPointer = boost::shared_ptr; using MaskAccessorPointer = boost::shared_ptr; private: MaskAccessorInterface(const MaskAccessorInterface&) = delete; //not implemented on purpose -> non-copyable MaskAccessorInterface& operator=(const MaskAccessorInterface&) = delete;//not implemented on purpose -> non-copyable public: MaskAccessorInterface() = default; ~MaskAccessorInterface() override = default; /*! @brief Start generation of mask @post mask is valid and acessible */ virtual void updateMask() = 0; virtual const GeometricInfo& getGeometricInfo() const = 0; /*! @brief Get vector containing all relevant voxels that are inside the given structure. */ virtual MaskVoxelListPointer getRelevantVoxelVector() = 0; /*! @brief get vector containing all relevant voxels that have a relevant volume above the given threshold and are inside the given structure @pre updateMask should have been called (at least once, to ensure a valid mask). */ virtual MaskVoxelListPointer getRelevantVoxelVector(float lowerThreshold) = 0; /*! @brief Get masked voxel value corresponding to a given VoxelGridID. @post after a valid call voxel contains the mask information corresponding to aID. If aID is not valid, voxel values are undefined. @return Indicates if a MaskVoxel for the given ID exists and therefore if parameter voxel containes valid values. @pre updateMask should have been called (at least once, to ensure a valid mask). */ virtual bool getMaskAt(const VoxelGridID aID, MaskVoxel& voxel) const = 0; /*! @brief Get masked voxel value corresponding to a given VoxelGridIndex. @post after a valid call voxel contains the mask information corresponding to gridIndex. If gridIndex is not valid, voxel values are undefined. @return Indicates if a MaskVoxel for the given index exists and therefore if parameter voxel containes valid values. @pre updateMask should have been called (at least once, to ensure a valid mask). */ virtual bool getMaskAt(const VoxelGridIndex3D& gridIndex, MaskVoxel& voxel) const = 0; /* @brief Is true if dose is on a homogeneous grid. @note Inhomogeneous grids are not supported at the moment, but if they will be supported in the future the interface does not need to change. */ virtual bool isGridHomogeneous() const { return true; } virtual IDType getMaskUID() const = 0; }; } } #endif diff --git a/code/core/rttbMaskAccessorProcessorBase.h b/code/core/rttbMaskAccessorProcessorBase.h index f1f7923..13679fc 100644 --- a/code/core/rttbMaskAccessorProcessorBase.h +++ b/code/core/rttbMaskAccessorProcessorBase.h @@ -1,59 +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 __MASK_ACCESSOR_PROCESSOR_BASE_H #define __MASK_ACCESSOR_PROCESSOR_BASE_H #include "rttbMaskAccessorProcessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MaskAccessorProcessorBase @brief Abstract class for all MaskAccessor converter classes */ class MaskAccessorProcessorBase: public MaskAccessorProcessorInterface { public: using MaskAccessorPointer = core::MaskAccessorInterface::MaskAccessorPointer; void setMaskAccessor(MaskAccessorPointer accessor) override { _maskAccessor = accessor; }; private: MaskAccessorProcessorBase(const MaskAccessorProcessorBase&) = delete; //not implemented on purpose -> non-copyable MaskAccessorProcessorBase& operator=(const MaskAccessorProcessorBase&) = delete;//not implemented on purpose -> non-copyable protected: MaskAccessorProcessorBase() = default; ~MaskAccessorProcessorBase() override = default; /*! @brief Mask accessor which should be generated */ MaskAccessorPointer _maskAccessor; }; } } #endif diff --git a/code/core/rttbMaskAccessorProcessorInterface.h b/code/core/rttbMaskAccessorProcessorInterface.h index 7bda48e..85de32a 100644 --- a/code/core/rttbMaskAccessorProcessorInterface.h +++ b/code/core/rttbMaskAccessorProcessorInterface.h @@ -1,65 +1,70 @@ // ----------------------------------------------------------------------- // 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 __MASK_ACCESSOR_PROCESSOR_INTERFACE_H #define __MASK_ACCESSOR_PROCESSOR_INTERFACE_H #include "rttbMaskAccessorInterface.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MaskAccessorProcessorInterface @brief Interface for all MaskAccessor converter classes */ class MaskAccessorProcessorInterface { public: using MaskAccessorPointer = core::MaskAccessorInterface::MaskAccessorPointer; private: MaskAccessorProcessorInterface(const MaskAccessorProcessorInterface&) = delete; //not implemented on purpose -> non-copyable MaskAccessorProcessorInterface& operator=(const MaskAccessorProcessorInterface&) = delete;//not implemented on purpose -> non-copyable protected: MaskAccessorProcessorInterface() = default; virtual ~MaskAccessorProcessorInterface() = default; public: /*! @brief Sets the MaskAccessor that should be processed @pre passed accessor must point to a valid instance. */ virtual void setMaskAccessor(MaskAccessorPointer accessor) = 0; /*! @brief Process the passed MaskAccessor @return if the processing was successful. */ virtual bool process() = 0; }; } } #endif diff --git a/code/core/rttbMaskVoxel.h b/code/core/rttbMaskVoxel.h index 30f2181..08b7462 100644 --- a/code/core/rttbMaskVoxel.h +++ b/code/core/rttbMaskVoxel.h @@ -1,84 +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) */ #ifndef __MASK_VOXEL_NEW_H #define __MASK_VOXEL_NEW_H - #include "rttbBaseType.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MaskVoxel * @brief AMaskVoxel stores the VoxelGridID of the corresponding dose voxel and the corresponding volume fraction as defined by the given mask. */ class RTTBCore_EXPORT MaskVoxel { private: /*! @brief A 1D voxel grid index on dose grid */ VoxelGridID _voxelGridID; /*! @brief The relevant volume fraction that is masked by the given structure: 0~1 */ FractionType _volumeFraction; public: /*! @brief Constructor @pre aVoxelGridID needs to point to a valid grid position. */ MaskVoxel(const VoxelGridID& aVoxelGridID); /*! @brief Constructor @pre aVoxelGridID needs to point to a valid grid position. */ MaskVoxel(const VoxelGridID& aVoxelGridID, FractionType aVolumeFraction); /*! @brief Operator == @return Return true if the id and volumeFraction are equal to these of the maskVoxel */ bool operator==(const MaskVoxel& maskVoxel) const; /*! @brief Operator < @return Return true if the id < the id of the maskVoxel */ bool operator<(const MaskVoxel& maskVoxel) const; const VoxelGridID& getVoxelGridID() const; void setRelevantVolumeFraction(const FractionType aVolumeFraction); FractionType getRelevantVolumeFraction() const; friend std::ostream& operator<<(std::ostream& s, const MaskVoxel& maskVoxel) { s << "( " << maskVoxel.getVoxelGridID() << ": " << maskVoxel.getRelevantVolumeFraction() << " )"; return s; }; }; } } #endif diff --git a/code/core/rttbMaskedDoseIteratorInterface.h b/code/core/rttbMaskedDoseIteratorInterface.h index bf3a020..b2c7f11 100644 --- a/code/core/rttbMaskedDoseIteratorInterface.h +++ b/code/core/rttbMaskedDoseIteratorInterface.h @@ -1,76 +1,80 @@ // ----------------------------------------------------------------------- // 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 __MASKED_DOSE_ITERATOR_INTERFACE_NEW_H #define __MASKED_DOSE_ITERATOR_INTERFACE_NEW_H - #include #include "rttbDoseIteratorInterface.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { class MaskAccessorInterface; /*! @class MaskedDoseIteratorInterface @brief Give access to masked dose data. */ class RTTBCore_EXPORT MaskedDoseIteratorInterface : public DoseIteratorInterface { public: using MaskAccessorPointer = boost::shared_ptr; using DoseAccessorPointer = DoseIteratorInterface::DoseAccessorPointer; using DoseIteratorPointer = DoseIteratorInterface::DoseIteratorPointer; using MaskedDoseIteratorPointer = boost::shared_ptr; private: MaskedDoseIteratorInterface(const MaskedDoseIteratorInterface&) = delete; MaskedDoseIteratorInterface& operator=(const MaskedDoseIteratorInterface&) = delete; protected: /*! @brief Mask that is to be applied to currently loaded dose*/ MaskAccessorPointer _spMask; public: /* Constructor @pre core::GeometricInfo represents the same geometric space for both mask and dose, i.e. both live on the same data grid. Both accessors need to be valid. */ MaskedDoseIteratorInterface(MaskAccessorPointer aMaskAccessor, DoseAccessorPointer aDoseAccessor); ~MaskedDoseIteratorInterface() override = default; inline MaskAccessorPointer getMaskAccessor() const { return _spMask; }; /* Return doseValue*voxelFraction for the current position */ virtual DoseTypeGy getCurrentMaskedDoseValue() const = 0; }; } } #endif \ No newline at end of file diff --git a/code/core/rttbMutableDoseAccessorInterface.h b/code/core/rttbMutableDoseAccessorInterface.h index 71c75ae..9d32763 100644 --- a/code/core/rttbMutableDoseAccessorInterface.h +++ b/code/core/rttbMutableDoseAccessorInterface.h @@ -1,49 +1,54 @@ // ----------------------------------------------------------------------- // 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 __MUTABLE_DOSE_ACCESSOR_INTERFACE_NEW_H #define __MUTABLE_DOSE_ACCESSOR_INTERFACE_NEW_H #include "rttbDoseAccessorInterface.h" #include "rttbBaseType.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class MutableDoseAccessorInterface @brief Extends the DoseAccessorInterface to provide writing access to the data. */ class MutableDoseAccessorInterface: public DoseAccessorInterface { public: using MutableDoseAccessorPointer = boost::shared_ptr; virtual void setDoseAt(const VoxelGridID aID, DoseTypeGy value) = 0; virtual void setDoseAt(const VoxelGridIndex3D& aIndex, DoseTypeGy value) = 0; }; } } #endif diff --git a/code/core/rttbMutableMaskAccessorInterface.h b/code/core/rttbMutableMaskAccessorInterface.h index ec17e37..08b1d9d 100644 --- a/code/core/rttbMutableMaskAccessorInterface.h +++ b/code/core/rttbMutableMaskAccessorInterface.h @@ -1,56 +1,61 @@ // ----------------------------------------------------------------------- // 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 __MUTABLE_MASK_ACCESSOR_INTERFACE_H #define __MUTABLE_MASK_ACCESSOR_INTERFACE_H #include #include "rttbMaskAccessorInterface.h" #include "rttbBaseType.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { class MaskVoxel; /*! @class MutableMaskAccessorInterface @brief Extends the MaskAccessorInterface to provide writing access to the data. @details This interface is created for external manipulation of generated masks. For example to store the results of arithmetic operations on other masks. */ class MutableMaskAccessorInterface: public MaskAccessorInterface { public: using MutableMaskAccessorPointer = boost::shared_ptr; using MaskVoxelList = core::MaskAccessorInterface::MaskVoxelList; using MaskVoxelListPointer = core::MaskAccessorInterface::MaskVoxelListPointer; virtual void setRelevantVoxelVector(MaskVoxelListPointer aVoxelListPointer) = 0; virtual void setMaskAt(VoxelGridID aID, const MaskVoxel& voxel) = 0; virtual void setMaskAt(const VoxelGridIndex3D& gridIndex, const MaskVoxel& voxel) = 0; }; } } #endif diff --git a/code/core/rttbStrVectorStructureSetGenerator.h b/code/core/rttbStrVectorStructureSetGenerator.h index 1319c47..b030d9a 100644 --- a/code/core/rttbStrVectorStructureSetGenerator.h +++ b/code/core/rttbStrVectorStructureSetGenerator.h @@ -1,74 +1,79 @@ // ----------------------------------------------------------------------- // 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 __STR_VECTOR_STRUCTURE_SET_GENERATOR_H #define __STR_VECTOR_STRUCTURE_SET_GENERATOR_H #include #include #include "rttbStructureSetGeneratorInterface.h" #include "rttbStructureSet.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class StrVectorStructureSetGenerator @brief Generate a structure set with a vector of Structures. */ class RTTBCore_EXPORT StrVectorStructureSetGenerator : public core::StructureSetGeneratorInterface { public: using StructTypePointer = core::StructureSet::StructTypePointer; using StructureSetPointer = StructureSetGeneratorInterface::StructureSetPointer; protected: IDType _patientUID; std::vector _strVector; StrVectorStructureSetGenerator() = default; public: /*! @brief Constructor @param aStructureVector the vector of structure shared pointer @param aPatientUID the patient UID. */ StrVectorStructureSetGenerator(std::vector& aStructureVector, IDType aPatientUID = ""); /*! @brief Generate StructureSet @return Return shared pointer of StructureSet. */ StructureSetPointer generateStructureSet() override; }; } } #endif diff --git a/code/core/rttbStructure.h b/code/core/rttbStructure.h index dbb78b4..924fcd3 100644 --- a/code/core/rttbStructure.h +++ b/code/core/rttbStructure.h @@ -1,109 +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) */ /* Changes in Architecture: This class should be universally used independent of the origin of the Structures. All UID references are omitted. */ #ifndef __STRUCTURE_H #define __STRUCTURE_H #include #include #include #include "rttbBaseType.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif namespace rttb { namespace core { /*! @class Structure @brief This is a class representing a RT Structure */ class RTTBCore_EXPORT Structure { public: using StructTypePointer = boost::shared_ptr; private: /*! @brief WorldCoordinate3D in mm */ PolygonSequenceType _structureVector; /*! @brief Contour Geometric Type using DICOM-RT definition (3006,0042). * POINT: indicates that the contour is a single point, defining a specific location of significance. * OPEN_PLANAR: indicates that the last vertex shall not be connected to the first point, and that all points * in Contour Data (3006,0050) shall be coplanar. * OPEN_NONPLANAR: indicates that the last vertex shall not be connected to the first point, and that the points * in Contour Data(3006,0050) may be non-coplanar. * CLOSED_PLANAR: indicates that the last point shall be connected to the first point, where the first point is * not repeated in the Contour Data. All points in Contour Data (3006,0050) shall be coplanar. */ std::vector _contourGeometricTypeVector; /*! @brief Structure UID*/ IDType _strUID; /*! @brief Structure Label*/ StructureLabel _label; public: /*! @brief Structure Standard Constructor uid will be randomly generated using boost::uuid library at first. To change the uid using setUID(). */ Structure(); /*! @brief Structure Constructor uid will be randomly generated using boost::uuid library at first. To change the uid using setUID(). */ Structure(PolygonSequenceType strVector); Structure(const Structure& copy); ~Structure(); const PolygonSequenceType& getStructureVector() const; /*! @brief Get the number of end points (points that define the polygon) of all contours of the structure. */ int getNumberOfEndpoints() const; IDType getUID() const; void setUID(const IDType& aUID); void setLabel(const StructureLabel& aLabel); StructureLabel getLabel() const; }; }//end namespace core }//end namespace rttb #endif diff --git a/code/core/rttbStructureSet.h b/code/core/rttbStructureSet.h index 4e60e7b..dad4663 100644 --- a/code/core/rttbStructureSet.h +++ b/code/core/rttbStructureSet.h @@ -1,85 +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) */ #ifndef __STRUCTURE_SET_H #define __STRUCTURE_SET_H #include #include #include "rttbBaseType.h" #include "rttbStructure.h" #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { /*! @class StructureSet @brief This is an class representing a structure set, which can be used to generate masks. */ class RTTBCore_EXPORT StructureSet { public: using StructTypePointer = Structure::StructTypePointer; using NumberOfStructuresType = size_t; protected: std::vector _structureSetVector; IDType _UID; IDType _patientUID; public: virtual ~StructureSet() = default; /*! @brief Constructor @param aPatientUID the patient UID. @param aUID the structure set UID. If it is empty, it will be calculated in the constructor */ StructureSet(const std::vector& aStructureVector, IDType aPatientUID = "", IDType aUID = ""); /*! @brief Get the Structure with the index aStructureNo @return Return Structure pointer. @exception InvalidParameterException Thrown if structureNo not between 0 and number of structures of structureSet. */ StructTypePointer getStructure(size_t aStructureNo) const; /*! @brief Get the number of structures @return Return the number of structures. */ NumberOfStructuresType getNumberOfStructures() const; virtual IDType getUID() const; virtual IDType getPatientUID() const; }; } } #endif diff --git a/code/core/rttbStructureSetGeneratorInterface.h b/code/core/rttbStructureSetGeneratorInterface.h index 3eacc53..1020b59 100644 --- a/code/core/rttbStructureSetGeneratorInterface.h +++ b/code/core/rttbStructureSetGeneratorInterface.h @@ -1,86 +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) */ #ifndef __STRUCTURE_SET_GENERATOR_INTERFACE_H #define __STRUCTURE_SET_GENERATOR_INTERFACE_H #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { class StructureSet; /*! @class StructureSetGeneratorInterface @brief Interface for all structure set generating classes */ class StructureSetGeneratorInterface { public: using StructureSetPointer = boost::shared_ptr; private: StructureSetGeneratorInterface(const StructureSetGeneratorInterface&) = delete; //not implemented on purpose -> non-copyable StructureSetGeneratorInterface& operator=(const StructureSetGeneratorInterface&) = delete;//not implemented on purpose -> non-copyable protected: StructureSetGeneratorInterface() = default; virtual ~StructureSetGeneratorInterface() = default; private: bool _activeFilter{false}; std::string _filterRegEx; public: void setStructureLabelFilterActive(bool active) { _activeFilter = active; }; bool getStructureLabelFilterActive() const { return _activeFilter; }; void setFilterRegEx(const std::string& filter) { _filterRegEx = filter; }; std::string getFilterRegEx() const { return _filterRegEx; }; /*! @brief Generate StructureSet @return Return shared pointer of StructureSet. */ virtual StructureSetPointer generateStructureSet() = 0; }; } } #endif diff --git a/code/core/rttbUtils.h b/code/core/rttbUtils.h index 806d282..173c89e 100644 --- a/code/core/rttbUtils.h +++ b/code/core/rttbUtils.h @@ -1,47 +1,52 @@ // ----------------------------------------------------------------------- // 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. // //------------------------------------------------------------------------ #ifndef __RTTB_UTILS_H #define __RTTB_UTILS_H #include #include #include #include "RTTBCoreExports.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4251) +#endif + namespace rttb { namespace core { bool RTTBCore_EXPORT isKey(const std::map& values, double value); bool RTTBCore_EXPORT isKey(const std::vector& values, double value); bool RTTBCore_EXPORT valueIsClose(double value1, double value2, double specificErrorConstant = 1e-5); bool RTTBCore_EXPORT isFile(FileNameType aName); bool RTTBCore_EXPORT isDirectory(FileNameType aName); std::string RTTBCore_EXPORT getFilenameWithoutEnding(const std::string& outfilename); std::string RTTBCore_EXPORT getFileEnding(const std::string& outfilename); } } #endif