diff --git a/code/algorithms/rttbDoseToVolumeMeasureCollection.h b/code/algorithms/rttbDoseToVolumeMeasureCollection.h index c335296..ba462a9 100644 --- a/code/algorithms/rttbDoseToVolumeMeasureCollection.h +++ b/code/algorithms/rttbDoseToVolumeMeasureCollection.h @@ -1,76 +1,76 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #ifndef __DOSE_TO_VOLUME_MEASURE_COLLECTION_H #define __DOSE_TO_VOLUME_MEASURE_COLLECTION_H #include "rttbMeasureCollection.h" #include #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4251) #endif namespace rttb { namespace algorithms { /*! @class DoseToVolumeMeasureCollection @brief This class handels the access to the DoseToVolumeMeasureCollection elements for a specific complex statistic @note _referenceDose has to be set to use getValueRelative() otherwise an exception is thrown */ class RTTBAlgorithms_EXPORT DoseToVolumeMeasureCollection : public MeasureCollection { public: rttbClassMacro(DoseToVolumeMeasureCollection, MeasureCollection) typedef std::map DoseToVolumeFunctionType; private: complexStatistics _name; DoseTypeGy _referenceDose; DoseToVolumeFunctionType _values; public: DoseToVolumeMeasureCollection(complexStatistics name, DoseTypeGy referenceDose = -1); /*! @brief This has to be set >=0 to use getValueRelative() */ void setReferenceDose(DoseTypeGy referenceDose); void insertValue(DoseTypeGy dose, VolumeType volume); /*! @brief Gets the volume irradiated with a dose >= x, depending on the complexStatistics name. @return Return absolute volume in absolute cm^3. @exception InvalidDoseException if the vector values is empty or _referenceDose is -1 @exception NoDataException if the requested Dose is not in the vector */ VolumeType getValue(DoseTypeGy xVolumeAbsolute) const; VolumeType getValue(DoseTypeGy xVolumeAbsolute, bool findNearestValue, DoseTypeGy& nearestXDose) const; VolumeType getValueRelative(DoseTypeGy xDoseRelative) const; VolumeType getValueRelative(DoseTypeGy xDoseRelative, bool findNearestValue, DoseTypeGy& nearestXDose) const; DoseToVolumeFunctionType getAllValues() const; - - friend bool operator==(const DoseToVolumeMeasureCollection& volumeToDoseMesureCollection, const DoseToVolumeMeasureCollection& otherVolumeToDoseMesureCollection); }; + + RTTBAlgorithms_EXPORT bool operator==(const DoseToVolumeMeasureCollection& volumeToDoseMesureCollection, const DoseToVolumeMeasureCollection& otherVolumeToDoseMesureCollection); } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/algorithms/rttbVolumeToDoseMeasureCollection.h b/code/algorithms/rttbVolumeToDoseMeasureCollection.h index c9e4f71..9602e93 100644 --- a/code/algorithms/rttbVolumeToDoseMeasureCollection.h +++ b/code/algorithms/rttbVolumeToDoseMeasureCollection.h @@ -1,76 +1,76 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #ifndef __VOLUME_TO_DOSE_MEASURE_COLLECTION_H #define __VOLUME_TO_DOSE_MEASURE_COLLECTION_H #include "rttbMeasureCollection.h" #include #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4251) #endif namespace rttb { namespace algorithms { /*! @class VolumeToDoseMeasureCollection @brief This class handels the access to the VolumeToDoseMeasureCollection elements for a specific complex statistic @note _volume has to be set to use getValueRelative() otherwise an exception is thrown */ class RTTBAlgorithms_EXPORT VolumeToDoseMeasureCollection : public MeasureCollection { public: rttbClassMacro(VolumeToDoseMeasureCollection, MeasureCollection) typedef std::map VolumeToDoseFunctionType; private: complexStatistics _name; VolumeType _volume; VolumeToDoseFunctionType _values; public: VolumeToDoseMeasureCollection(complexStatistics name, VolumeType volume = -1); /*! @brief This has to be set >=0 to use getValueRelative() */ void setVolume(VolumeType volume); void insertValue(VolumeType volume, DoseTypeGy dose); /*! @brief Gets the x of the current volume, depending on the complexStatistics name. @return Return dose value in Gy. @exception InvalidDoseException if the vector values is empty @exception DataNotAvailableException if _volume is not set */ DoseTypeGy getValue(VolumeType xVolumeAbsolute) const; DoseTypeGy getValue(VolumeType xVolumeAbsolute, bool findNearestValue, VolumeType& nearestXDose) const; DoseTypeGy getValueRelative(VolumeType xDoseRelative) const; DoseTypeGy getValueRelative(VolumeType xDoseRelative, bool findNearestValue, VolumeType& nearestXDose) const; VolumeToDoseFunctionType getAllValues() const; - - friend bool operator==(const VolumeToDoseMeasureCollection& volumeToDoseMesureCollection, const VolumeToDoseMeasureCollection& otherVolumeToDoseMesureCollection); }; + + RTTBAlgorithms_EXPORT bool operator==(const VolumeToDoseMeasureCollection& volumeToDoseMesureCollection, const VolumeToDoseMeasureCollection& otherVolumeToDoseMesureCollection); } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/files.cmake b/code/core/files.cmake index 5f2cbff..3180ba9 100644 --- a/code/core/files.cmake +++ b/code/core/files.cmake @@ -1,58 +1,59 @@ SET(CPP_FILES rttbAccessorWithGeoInfoBase.cpp rttbDoseIteratorInterface.cpp rttbDVH.cpp rttbDVHCalculator.cpp rttbDVHSet.cpp rttbGenericDoseIterator.cpp rttbGenericMaskedDoseIterator.cpp rttbGeometricInfo.cpp rttbMaskedDoseIteratorInterface.cpp rttbMaskVoxel.cpp rttbStructure.cpp rttbStructureSet.cpp rttbStrVectorStructureSetGenerator.cpp rttbUtils.cpp + rttbMutableMaskAccessorInterface.cpp ) SET(H_FILES rttbAccessorInterface.h rttbAccessorWithGeoInfoBase.h rttbBaseType.h rttbDataNotAvailableException.h rttbDoseAccessorInterface.h rttbDoseIteratorInterface.h rttbDoseAccessorGeneratorBase.h rttbDoseAccessorGeneratorInterface.h rttbDVH.h rttbDVHCalculator.h rttbDVHGeneratorInterface.h rttbDVHSet.h rttbException.h rttbExceptionMacros.h rttbGenericDoseIterator.h rttbGenericMaskedDoseIterator.h rttbGeometricInfo.h rttbIndexConversionInterface.h rttbIndexOutOfBoundsException.h rttbInvalidDoseException.h rttbInvalidParameterException.h rttbMappingOutsideOfImageException.h rttbMaskAccessorGeneratorBase.h rttbMaskAccessorGeneratorInterface.h rttbMaskAccessorInterface.h rttbMaskAccessorProcessorBase.h rttbMaskAccessorProcessorInterface.h rttbMaskedDoseIteratorInterface.h rttbMaskVoxel.h rttbMutableDoseAccessorInterface.h rttbMutableMaskAccessorInterface.h rttbNullPointerException.h rttbPaddingException.h rttbStructure.h rttbStructureSet.h rttbStructureSetGeneratorInterface.h rttbStrVectorStructureSetGenerator.h rttbUtils.h rttbCommon.h ) diff --git a/code/core/rttbDVH.h b/code/core/rttbDVH.h index 59e75f3..6db285c 100644 --- a/code/core/rttbDVH.h +++ b/code/core/rttbDVH.h @@ -1,213 +1,213 @@ // ----------------------------------------------------------------------- // 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 __DVH_H #define __DVH_H #include #include #include #include "boost/shared_ptr.hpp" #include "rttbBaseType.h" #include "rttbCommon.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; rttbClassMacroNoParent(DVH); 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 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; /*! @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() 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() 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 Convert absolute values relative to the total number of voxels */ DataDifferentialType convertAbsoluteToRelative(bool isCumulative = true) 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; }; + + /*! equality operator + DVHs are considered equal if the following are equal (let alone double inconsistencies): + - structureID + - doseID + - voxelizationID + - number of voxels + - Histogram entries. + */ + RTTBCore_EXPORT bool operator==(const DVH& aDVH, const DVH& otherDVH); + + RTTBCore_EXPORT std::ostream& operator<<(std::ostream& s, const DVH& aDVH); } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/rttbDVHSet.h b/code/core/rttbDVHSet.h index 62b4e1f..887754d 100644 --- a/code/core/rttbDVHSet.h +++ b/code/core/rttbDVHSet.h @@ -1,146 +1,140 @@ // ----------------------------------------------------------------------- // 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 __DVH_SET_H #define __DVH_SET_H #include #include #include #include "rttbCommon.h" #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: rttbClassMacroNoParent(DVHSet) 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); + /*! DVHSets are considered equal if they have the same structureSet, dose and voxelization ID + and the number of DVHs are equal. + */ + RTTBCore_EXPORT bool operator==(const DVHSet& aDVHSet, const DVHSet& otherDVHSet); - std::ostream& operator<<(std::ostream& s, const DVHSet& aDVHSet); + RTTBCore_EXPORT std::ostream& operator<<(std::ostream& s, const DVHSet& aDVHSet); - std::ostream& operator<<(std::ostream& s, const DVHSet::DVHSetType& aDVHSet); + RTTBCore_EXPORT std::ostream& operator<<(std::ostream& s, const DVHSet::DVHSetType& aDVHSet); } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/rttbGeometricInfo.h b/code/core/rttbGeometricInfo.h index 26df4fb..68d57c3 100644 --- a/code/core/rttbGeometricInfo.h +++ b/code/core/rttbGeometricInfo.h @@ -1,187 +1,187 @@ // ----------------------------------------------------------------------- // 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 __GEOMETRIC_INFO_NEW_H #define __GEOMETRIC_INFO_NEW_H #include #include #include "rttbBaseType.h" #include #include "rttbCommon.h" #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 { public: rttbClassMacroNoParent(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, ContinuousVoxelGridIndex3D @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 worldCoordinateToContinuousIndex(const WorldCoordinate3D& aWorldCoordinate, ContinuousVoxelGridIndex3D& 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 ContinuousVoxelGridIndex3D, 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 continuousIndexToWorldCoordinate(const ContinuousVoxelGridIndex3D& 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); }; + + /*!@ brief generates string stream representation of the GeometricInfo object. */ + RTTBCore_EXPORT std::ostream& operator << (std::ostream& s, const GeometricInfo& anGeometricInfo); } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/rttbIndexConversionInterface.h b/code/core/rttbIndexConversionInterface.h index 36c7bc6..66ee3d8 100644 --- a/code/core/rttbIndexConversionInterface.h +++ b/code/core/rttbIndexConversionInterface.h @@ -1,55 +1,57 @@ // ----------------------------------------------------------------------- // 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 __INDEX_CONVERSION_INTERFACE_NEW_H #define __INDEX_CONVERSION_INTERFACE_NEW_H #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4251) #endif + #include +#include "RTTBCoreExports.h" namespace rttb { namespace core { /*! @class IndexConversionInterface @brief This class represents the conversion of 3D grid indices to 1D grid IDs. */ - class IndexConversionInterface + class RTTBCore_EXPORT IndexConversionInterface { public: rttbClassMacroNoParent(IndexConversionInterface); private: IndexConversionInterface(const IndexConversionInterface&) = delete; //not implemented on purpose -> non-copyable IndexConversionInterface& operator=(const IndexConversionInterface&) = delete;//not implemented on purpose -> non-copyable - public: + protected: IndexConversionInterface() = default; virtual ~IndexConversionInterface() = default; }; } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/rttbMaskAccessorInterface.h b/code/core/rttbMaskAccessorInterface.h index 0b532d6..14374c2 100644 --- a/code/core/rttbMaskAccessorInterface.h +++ b/code/core/rttbMaskAccessorInterface.h @@ -1,106 +1,109 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #ifndef __MASK_ACCESSOR_INTERFACE_NEW_H #define __MASK_ACCESSOR_INTERFACE_NEW_H #include "rttbCommon.h" #include "rttbBaseType.h" #include "rttbMaskVoxel.h" #include "rttbIndexConversionInterface.h" +#include "RTTBCoreExports.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 + class RTTBCore_EXPORT MaskAccessorInterface: public IndexConversionInterface { public: rttbClassMacro(MaskAccessorInterface, IndexConversionInterface); using MaskVoxelList = std::vector; using MaskVoxelListPointer = 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: + protected: MaskAccessorInterface() = default; ~MaskAccessorInterface() override = default; + public: /*! @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; }; } + } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/core/rttbMutableDoseAccessorInterface.h b/code/core/rttbMutableDoseAccessorInterface.h index c491e90..af4b37c 100644 --- a/code/core/rttbMutableDoseAccessorInterface.h +++ b/code/core/rttbMutableDoseAccessorInterface.h @@ -1,54 +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. // //------------------------------------------------------------------------ #ifndef __MUTABLE_DOSE_ACCESSOR_INTERFACE_NEW_H #define __MUTABLE_DOSE_ACCESSOR_INTERFACE_NEW_H #include "rttbDoseAccessorInterface.h" #include "rttbBaseType.h" #include "rttbCommon.h" +#include "RTTBCoreExports.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 + class RTTBCore_EXPORT MutableDoseAccessorInterface: public DoseAccessorInterface { public: rttbClassMacro(MutableDoseAccessorInterface, DoseAccessorInterface) virtual void setDoseAt(const VoxelGridID aID, DoseTypeGy value) = 0; virtual void setDoseAt(const VoxelGridIndex3D& aIndex, DoseTypeGy value) = 0; + protected: + MutableDoseAccessorInterface() = default; + ~MutableDoseAccessorInterface() override = default; + + private: + MutableDoseAccessorInterface(const MutableDoseAccessorInterface&) = delete; //not implemented on purpose -> non-copyable + MutableDoseAccessorInterface& operator=(const + MutableDoseAccessorInterface&) = delete;//not implemented on purpose -> non-copyable }; } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/io/dicom/rttbDcmrtException.h b/code/core/rttbMutableMaskAccessorInterface.cpp similarity index 57% copy from code/io/dicom/rttbDcmrtException.h copy to code/core/rttbMutableMaskAccessorInterface.cpp index 135f684..fad0e6c 100644 --- a/code/io/dicom/rttbDcmrtException.h +++ b/code/core/rttbMutableMaskAccessorInterface.cpp @@ -1,43 +1,21 @@ -// ----------------------------------------------------------------------- -// 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 __DCMRT_EXCEPTION_H -#define __DCMRT_EXCEPTION_H - -#include - -#include "rttbException.h" - -namespace rttb -{ - namespace io - { - namespace dicom - { - - /*! @class DcmrtException - @brief This class represents a DcmrtException. Any dcmrt error will throw this exception. - */ - class DcmrtException: public core::Exception - { - public: - explicit DcmrtException(const std::string& aWhat): Exception(aWhat) {} - }; - } - } - -} - -#endif +// ----------------------------------------------------------------------- +// 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. +// +//------------------------------------------------------------------------ + + +#include "rttbMutableMaskAccessorInterface.h" + +//This file was added, because on windows some compiler +//do not export the class symbols correctly if only the +//header is specified. diff --git a/code/core/rttbMutableMaskAccessorInterface.h b/code/core/rttbMutableMaskAccessorInterface.h index 6601102..282735b 100644 --- a/code/core/rttbMutableMaskAccessorInterface.h +++ b/code/core/rttbMutableMaskAccessorInterface.h @@ -1,60 +1,77 @@ // ----------------------------------------------------------------------- // 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 __MUTABLE_MASK_ACCESSOR_INTERFACE_H #define __MUTABLE_MASK_ACCESSOR_INTERFACE_H #include "rttbCommon.h" #include "rttbMaskAccessorInterface.h" #include "rttbBaseType.h" +#include "RTTBCoreExports.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 + class RTTBCore_EXPORT MutableMaskAccessorInterface: public MaskAccessorInterface { public: rttbClassMacro(MutableMaskAccessorInterface, MaskAccessorInterface) 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; + virtual bool isGridHomogeneous() const + { + return false; + } + + protected: + MutableMaskAccessorInterface() = default; + ~MutableMaskAccessorInterface() override = default; + + private: + MutableMaskAccessorInterface(const MutableMaskAccessorInterface&) = delete; //not implemented on purpose -> non-copyable + MutableMaskAccessorInterface& operator=(const + MutableMaskAccessorInterface&) = delete;//not implemented on purpose -> non-copyable + }; } + } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/interpolation/rttbRosuMappableDoseAccessor.h b/code/interpolation/rttbRosuMappableDoseAccessor.h index a7ea314..ef3f14d 100644 --- a/code/interpolation/rttbRosuMappableDoseAccessor.h +++ b/code/interpolation/rttbRosuMappableDoseAccessor.h @@ -1,75 +1,77 @@ // ----------------------------------------------------------------------- // 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 __ROSU_MAPPABLE_DOSE_ACCESSOR_H #define __ROSU_MAPPABLE_DOSE_ACCESSOR_H #include #include "rttbBaseType.h" #include "rttbInterpolationBase.h" #include "rttbMappableDoseAccessorInterface.h" +#include "RTTBInterpolationExports.h" + namespace rttb { namespace interpolation { class TransformationInterface; /*! @class RosuMappableDoseAccessor @brief Class for dose mapping based on interpolation described in the Rosu2005 paper @details implementation of the following paper: Rosu, M., Chetty, I. J., Balter, J. M., Kessler, M. L., McShan, D. L., & Ten Haken, R. K. (2005). Dose reconstruction in deforming lung anatomy: Dose grid size effects and clinical implications. Medical Physics, 32(8), 2487. @ingroup interpolation */ - class RosuMappableDoseAccessor: public MappableDoseAccessorInterface + class RTTBInterpolation_EXPORT RosuMappableDoseAccessor: public MappableDoseAccessorInterface { private: InterpolationBase::Pointer _spInterpolation; public: /*! @brief Constructor. Just hands values over to base class constructor. @note no interpolation as parameter since linear interpolation is fixed. @sa MappableDoseAccessorBase */ RosuMappableDoseAccessor(const core::GeometricInfo& geoInfoTargetImage, core::DoseAccessorInterface::ConstPointer doseMovingImage, const TransformationInterface::Pointer aTransformation, bool acceptPadding = true, DoseTypeGy defaultOutsideValue = 0.0); /*! @brief Virtual destructor. */ ~RosuMappableDoseAccessor() override = default; GenericValueType getValueAt(const VoxelGridID aID) const override; /*! @brief Returns the dose for a given voxel grid index. The computation of the octant around the voxel is done and the interpolation is performed. @details Boundary treatment: if more than 6 subvoxels are outside: return _defaultOutsideValue. Otherwise: ignore the outside values. @return the dose or if (isOutside==true && _acceptPadding==true) then _defaultValue @exception core::MappingOutsideOfImageException if the point is mapped outside and if _acceptPadding==false, possibly returning _defaultValue) */ GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const override; private: /*! @brief returns the octant coordinates around a coordinate. @details i.e. coordinate is the center of a virtual voxel. Then, each side is divided into equal parts. The centers of the new subvoxels are then returned. @return a vector of the octant coordinates. */ std::vector getOctants(const WorldCoordinate3D& aCoordinate) const; }; } } #endif diff --git a/code/io/dicom/rttbDVHDicomFileReader.h b/code/io/dicom/rttbDVHDicomFileReader.h index c8f68b6..74ebfbe 100644 --- a/code/io/dicom/rttbDVHDicomFileReader.h +++ b/code/io/dicom/rttbDVHDicomFileReader.h @@ -1,53 +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. // //------------------------------------------------------------------------ #ifndef __DVH_DICOM_FILE_READER_H #define __DVH_DICOM_FILE_READER_H #include "rttbBaseType.h" #include "rttbDVHGeneratorInterface.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DVHDicomFileReader @brief Read DVH data from a dicom file and create corresponding DVH object. */ - class DVHDicomFileReader: public core::DVHGeneratorInterface + class RTTBDicomIO_EXPORT DVHDicomFileReader: public core::DVHGeneratorInterface { private: FileNameString _fileName; void createDVH(); public: /*! @brief DVHDicomFileReader Constructor @param aFileName the dicom dvh file name */ explicit DVHDicomFileReader(FileNameString aFileName); /*! @brief Set the dicom dvh file name (triggers data import) @param aFileName the dicom dvh file name */ void setFileName(FileNameString aFileName); }; } } } #endif diff --git a/code/io/dicom/rttbDcmrtException.h b/code/io/dicom/rttbDcmrtException.h index 135f684..ed87178 100644 --- a/code/io/dicom/rttbDcmrtException.h +++ b/code/io/dicom/rttbDcmrtException.h @@ -1,43 +1,45 @@ // ----------------------------------------------------------------------- // 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 __DCMRT_EXCEPTION_H #define __DCMRT_EXCEPTION_H #include #include "rttbException.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DcmrtException @brief This class represents a DcmrtException. Any dcmrt error will throw this exception. */ - class DcmrtException: public core::Exception + class RTTBDicomIO_EXPORT DcmrtException: public core::Exception { public: explicit DcmrtException(const std::string& aWhat): Exception(aWhat) {} }; } } } #endif diff --git a/code/io/dicom/rttbDicomDoseAccessor.cpp b/code/io/dicom/rttbDicomDoseAccessor.cpp index a018e77..e4d5ba5 100644 --- a/code/io/dicom/rttbDicomDoseAccessor.cpp +++ b/code/io/dicom/rttbDicomDoseAccessor.cpp @@ -1,285 +1,285 @@ // ----------------------------------------------------------------------- // 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. // //------------------------------------------------------------------------ -#include "drtdose.h" +#include #include #include #include "rttbDicomDoseAccessor.h" #include "rttbNullPointerException.h" #include "rttbInvalidDoseException.h" #include "rttbDcmrtException.h" #include "rttbIndexOutOfBoundsException.h" namespace rttb { namespace io { namespace dicom { DicomDoseAccessor::~DicomDoseAccessor() = default; DicomDoseAccessor::DicomDoseAccessor(DRTDoseIODPtr aDRTDoseIODP, DcmItemPtr aDcmDataset) { _dose = aDRTDoseIODP; _dataSet = aDcmDataset; OFString uid; _dose->getSeriesInstanceUID(uid); _doseUID = uid.c_str(); this->begin(); } bool DicomDoseAccessor::begin() { assembleGeometricInfo(); doseData.clear(); OFString doseGridScalingStr; this->_dose->getDoseGridScaling(doseGridScalingStr); try { _doseGridScaling = boost::lexical_cast(doseGridScalingStr.c_str()); } catch (boost::bad_lexical_cast&) { throw core::InvalidDoseException("Dose grid scaling not readable or = 0!") ; } OFCondition status; unsigned long count; const Uint16* pixelData; status = _dataSet->findAndGetUint16Array(DcmTagKey(0x7fe0, 0x0010), pixelData, &count); if (status.good()) { for (unsigned int i = 0; i < static_cast(this->_geoInfo.getNumberOfVoxels()); i++) { this->doseData.push_back(pixelData[i]); } return true; } else { throw io::dicom::DcmrtException("Read Pixel Data (7FE0,0010) failed!"); } } void DicomDoseAccessor::assembleGeometricInfo() { Uint16 temp = 0; this->_dose->getColumns(temp); _geoInfo.setNumColumns(temp); temp = 0; this->_dose->getRows(temp); _geoInfo.setNumRows(temp); if (_geoInfo.getNumColumns() == 0 || _geoInfo.getNumRows() == 0) { throw core::InvalidDoseException("Empty dicom dose!") ; } OFString numberOfFramesStr; OFString imageOrientationRowX, imageOrientationRowY, imageOrientationRowZ; OFString imageOrientationColumnX, imageOrientationColumnY, imageOrientationColumnZ; WorldCoordinate3D imageOrientationRow; WorldCoordinate3D imageOrientationColumn; try { this->_dose->getNumberOfFrames(numberOfFramesStr); _geoInfo.setNumSlices(boost::lexical_cast(numberOfFramesStr.c_str())); _dose->getImageOrientationPatient(imageOrientationRowX, 0); _dose->getImageOrientationPatient(imageOrientationRowY, 1); _dose->getImageOrientationPatient(imageOrientationRowZ, 2); _dose->getImageOrientationPatient(imageOrientationColumnX, 3); _dose->getImageOrientationPatient(imageOrientationColumnY, 4); _dose->getImageOrientationPatient(imageOrientationColumnZ, 5); imageOrientationRow(0) = boost::lexical_cast(imageOrientationRowX.c_str()); imageOrientationRow(1) = boost::lexical_cast(imageOrientationRowY.c_str()); imageOrientationRow(2) = boost::lexical_cast(imageOrientationRowZ.c_str()); imageOrientationColumn(0) = boost::lexical_cast(imageOrientationColumnX.c_str()); imageOrientationColumn(1) = boost::lexical_cast(imageOrientationColumnY.c_str()); imageOrientationColumn(2) = boost::lexical_cast(imageOrientationColumnZ.c_str()); } catch (boost::bad_lexical_cast&) { throw core::InvalidDoseException("boost::lexical_cast failed! Empty dicom dose!") ; } /*Get orientation*/ OrientationMatrix orientation; orientation(0, 0) = imageOrientationRow.x(); orientation(1, 0) = imageOrientationRow.y(); orientation(2, 0) = imageOrientationRow.z(); orientation(0, 1) = imageOrientationColumn.x(); orientation(1, 1) = imageOrientationColumn.y(); orientation(2, 1) = imageOrientationColumn.z(); WorldCoordinate3D perpendicular = imageOrientationRow.cross(imageOrientationColumn); orientation(0, 2) = perpendicular.x(); orientation(1, 2) = perpendicular.y(); orientation(2, 2) = perpendicular.z(); _geoInfo.setOrientationMatrix(orientation); OFString imagePositionX, imagePositionY, imagePositionZ; _dose->getImagePositionPatient(imagePositionX, 0); _dose->getImagePositionPatient(imagePositionY, 1); _dose->getImagePositionPatient(imagePositionZ, 2); WorldCoordinate3D imagePositionPatient; try { imagePositionPatient(0) = boost::lexical_cast(imagePositionX.c_str()); imagePositionPatient(1) = boost::lexical_cast(imagePositionY.c_str()); imagePositionPatient(2) = boost::lexical_cast(imagePositionZ.c_str()); } catch (boost::bad_lexical_cast&) { throw core::InvalidDoseException("Can not read image position X/Y/Z!") ; } _geoInfo.setImagePositionPatient(imagePositionPatient); /*Get spacing*/ SpacingVectorType3D spacingVector; OFString pixelSpacingRowStr, pixelSpacingColumnStr, sliceThicknessStr; _dose->getPixelSpacing(pixelSpacingRowStr, 0); _dose->getPixelSpacing(pixelSpacingColumnStr, 1); try { spacingVector(1) = boost::lexical_cast(pixelSpacingRowStr.c_str()); spacingVector(0) = boost::lexical_cast(pixelSpacingColumnStr.c_str()); } catch (boost::bad_lexical_cast&) { throw core::InvalidDoseException("Can not read Pixel Spacing Row/Column!") ; } _geoInfo.setSpacing(spacingVector); if (_geoInfo.getSpacing()(0) == 0 || _geoInfo.getSpacing()(1) == 0) { throw core::InvalidDoseException("Pixel spacing is 0!"); } _dose->getSliceThickness(sliceThicknessStr); try { spacingVector(2) = boost::lexical_cast(sliceThicknessStr.c_str()); } catch (boost::bad_lexical_cast&) { spacingVector(2) = 0 ; } if (spacingVector(2) == 0) { OFVector gridFrameOffsetVector; _dose->getGridFrameOffsetVector(gridFrameOffsetVector); if (gridFrameOffsetVector.size() >= 2) { spacingVector(2) = gridFrameOffsetVector.at(1) - gridFrameOffsetVector.at( 0); //read slice thickness from GridFrameOffsetVector (3004,000c) } if (spacingVector(2) == 0) { OFCondition status; DcmItem doseitem; OFString pixelSpacingBetweenSlices; status = _dose->write(doseitem); if (status.good()) { status = doseitem.findAndGetOFString(DcmTagKey(0x0018, 0x0088), pixelSpacingBetweenSlices); try { spacingVector(2) = boost::lexical_cast (pixelSpacingBetweenSlices.c_str());//read slice thickness from PixelSpacingBetweenSlices (0018,0088) } catch (boost::bad_lexical_cast&) { spacingVector(2) = 0 ; } } //if no useful tags to compute slicing -> set slice thickness to spacingVector(0) if (spacingVector(2) == 0) { std::cerr << "sliceThickness == 0! It wird be replaced with pixelSpacingRow=" << _geoInfo.getSpacing()(0) << "!" << std::endl; spacingVector(2) = spacingVector(0); } } } _geoInfo.setSpacing(spacingVector); } GenericValueType DicomDoseAccessor::getValueAt(const VoxelGridID aID) const { return doseData.at(aID) * _doseGridScaling; } GenericValueType DicomDoseAccessor::getValueAt(const VoxelGridIndex3D& aIndex) const { VoxelGridID aVoxelGridID; if (_geoInfo.convert(aIndex, aVoxelGridID)) { return getValueAt(aVoxelGridID); } else { return -1; } } } } } diff --git a/code/io/dicom/rttbDicomDoseAccessor.h b/code/io/dicom/rttbDicomDoseAccessor.h index 5e54f62..d4ba869 100644 --- a/code/io/dicom/rttbDicomDoseAccessor.h +++ b/code/io/dicom/rttbDicomDoseAccessor.h @@ -1,93 +1,95 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #ifndef __DICOM_DOSE_ACCESSOR_H #define __DICOM_DOSE_ACCESSOR_H -#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ -#include "drtdose.h" +#include /* make sure OS specific configuration is included first */ +#include #include #include #include #include "rttbAccessorWithGeoInfoBase.h" #include "rttbBaseType.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DicomDoseAccessor @brief This class gives access to dose information from DRTDoseIOD and DcmItem */ - class DicomDoseAccessor: public core::AccessorWithGeoInfoBase + class RTTBDicomIO_EXPORT DicomDoseAccessor: public core::AccessorWithGeoInfoBase { public: using DRTDoseIODPtr = boost::shared_ptr; using DcmItemPtr = boost::shared_ptr; private: DRTDoseIODPtr _dose; DcmItemPtr _dataSet; /*! vector of dose data(absolute Gy dose/doseGridScaling)*/ std::vector doseData; double _doseGridScaling; IDType _doseUID; DicomDoseAccessor() = delete; protected: /*! @brief Initialize dose data @exception InvalidDoseException Thrown if _dose is invalid: one of column/row/numberOfFrames/doseGridScaling/pixelSpacing=0 @exception DcmrtException Throw if dcmrt error @exception boost/bad_lexical_cast Thrown if the imported header tags are not numerical. */ bool begin(); /*! @brief get all required data from dicom information contained in _dose @exception boost/bad_lexical_cast Thrown if the imported header tags are not numerical. */ void assembleGeometricInfo() override; public: ~DicomDoseAccessor() override; /*! @brief Constructor. Initialisation with a boost::shared_ptr of DRTDoseIOD and of DcmItem to get the pixel data @exception DcmrtException Throw if dcmrt error */ DicomDoseAccessor(DRTDoseIODPtr aDRTDoseIODP, DcmItemPtr aDcmDataset); GenericValueType getValueAt(const VoxelGridID aID) const override; GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const override; const IDType getUID() const override { return _doseUID; }; }; } } } #endif diff --git a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h index 50f581f..61527a4 100644 --- a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h +++ b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h @@ -1,71 +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. // //------------------------------------------------------------------------ #ifndef __DICOM_FILE_DOSE_ACCESSOR_GENERATOR_H #define __DICOM_FILE_DOSE_ACCESSOR_GENERATOR_H -#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ -#include "drtdose.h" +#include /* make sure OS specific configuration is included first */ +#include #include "rttbDoseAccessorGeneratorBase.h" #include "rttbBaseType.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DicomFileDoseAccessorGenerator @brief Load dose data from dicom file and generate DicomDoseAccessor. */ - class DicomFileDoseAccessorGenerator: public core::DoseAccessorGeneratorBase + class RTTBDicomIO_EXPORT DicomFileDoseAccessorGenerator: public core::DoseAccessorGeneratorBase { public: using DRTDoseIODPtr = boost::shared_ptr; using DcmItemPtr = boost::shared_ptr; private: FileNameType _dicomDoseFileName; DicomFileDoseAccessorGenerator() = delete; protected: public: ~DicomFileDoseAccessorGenerator() override; /*! @brief Constructor. Initialization with a DICOM-RT dose file or a directory name @param aDICOMRTDoseFileName a DICOM-RT dose file name or a directory name @exception InvalidParameterException thrown if the file does not exist or the directory has no dicom dose file @exception DcmrtException thrown if load and read file failed */ explicit DicomFileDoseAccessorGenerator(FileNameType aDICOMRTDoseFileName); /*! @brief Generate DoseAccessor @return Return shared pointer of DoseAccessor. @exception InvalidDoseException Thrown if the loaded dose is invalid: one of column/row/numberOfFrames/doseGridScaling/pixelSpacing=0 @exception DcmrtException Throw if dcmrt error */ DoseAccessorPointer generateDoseAccessor() override ; }; } } } #endif diff --git a/code/io/dicom/rttbDicomFileDoseAccessorWriter.h b/code/io/dicom/rttbDicomFileDoseAccessorWriter.h index db43ac5..2301706 100644 --- a/code/io/dicom/rttbDicomFileDoseAccessorWriter.h +++ b/code/io/dicom/rttbDicomFileDoseAccessorWriter.h @@ -1,77 +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. // //------------------------------------------------------------------------ #ifndef __DICOM_FILE_DOSE_ACCESSOR_WRITER_H #define __DICOM_FILE_DOSE_ACCESSOR_WRITER_H #include "../itk/rttbDoseAccessorProcessorBase.h" #include "../itk/rttbDoseAccessorConversionSettingInterface.h" #include "rttbDicomDoseAccessor.h" +#include "RTTBDicomIOExports.h" + //pixel data max value UINT16_MAX #define PixelDataMaxValue 0xffff namespace rttb { namespace io { namespace dicom { /*! @class DicomFileDoseAccessorWriter @brief Class converts/dumps the processed accessor into an dicom file @remark DoseAccessorConversionInterface defines how the converter should react on non valid dose values. */ - class DicomFileDoseAccessorWriter: public core::DoseAccessorProcessorBase, + class RTTBDicomIO_EXPORT DicomFileDoseAccessorWriter: public core::DoseAccessorProcessorBase, public core::DoseAccessorConversionSettingInterface { public: using DoseAccessorPointer = core::DoseAccessorInterface::Pointer; using DRTDoseIODPointer = DicomDoseAccessor::DRTDoseIODPtr; /*! @brief Standard Constructor. */ DicomFileDoseAccessorWriter(); ~DicomFileDoseAccessorWriter() override = default; /*! Set a file name to write the dose @param aFileName a file name to write the dose */ void setFileName(DICOMRTFileNameString aFileName); /*! @brief Convert the accessor into dicom dataset and write dicom dataset to a file @exception InvalidDoseException thrown if put and insert pixel data into dicom dataset failed */ bool process() override; private: DicomFileDoseAccessorWriter(const DicomFileDoseAccessorWriter&) = delete; //not implemented on purpose -> non-copyable DicomFileDoseAccessorWriter& operator=(const DicomFileDoseAccessorWriter&) = delete;//not implemented on purpose -> non-copyable DRTDoseIODPointer _doseIOD; DICOMRTFileNameString _fileName; DcmFileFormat _fileformat; DcmDataset* _dataset; }; } } } #endif diff --git a/code/io/dicom/rttbDicomFileReaderHelper.h b/code/io/dicom/rttbDicomFileReaderHelper.h index 739d4ca..2e6a3cd 100644 --- a/code/io/dicom/rttbDicomFileReaderHelper.h +++ b/code/io/dicom/rttbDicomFileReaderHelper.h @@ -1,74 +1,76 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #ifndef __DICOM_FILE_READER_HELPER_H #define __DICOM_FILE_READER_HELPER_H #include -#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ -#include "drtdose.h" +#include /* make sure OS specific configuration is included first */ +#include #include "rttbBaseType.h" #include "boost/shared_ptr.hpp" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { struct Modality { enum Type { RTDOSE = 1, RTSTRUCT = 2, RTPLAN = 3, UserDefined = 128 } Type; }; using DRTDoseIODPtr = boost::shared_ptr; using DcmDataSetPtr = boost::shared_ptr; /*! Return the vector of all files with the same UID in the given directory, the UID is defined by the first file with the modality. @exception InvalidParameterException thrown if the file/directory does not exist or the modality is invalid @exception DcmrtException thrown if load/read file failed */ - std::vector getFileNamesWithSameUID(FileNameType aDirName, Modality aModality); + RTTBDicomIO_EXPORT std::vector getFileNamesWithSameUID(FileNameType aDirName, Modality aModality); /*! Return the vector of all files with the same UID in the directory of the given file @exception InvalidParameterException thrown if the file does not exist @exception DcmrtException thrown if load/read file failed */ - std::vector getFileNames(FileNameType aFileName); + RTTBDicomIO_EXPORT std::vector getFileNames(FileNameType aFileName); /*! Return modality DcmTagKey(0x0008, 0x0060) @exception DcmrtException thrown if reading modality failed*/ - OFString getModality(DcmDataSetPtr aDcmDataSet); + RTTBDicomIO_EXPORT OFString getModality(DcmDataSetPtr aDcmDataSet); /*! Return uid DcmTagKey(0x0020, 0x000e) @exception DcmrtException thrown if reading uid failed*/ - OFString getUID(DcmDataSetPtr aDcmDataSet); + RTTBDicomIO_EXPORT OFString getUID(DcmDataSetPtr aDcmDataSet); }; } } #endif diff --git a/code/io/dicom/rttbDicomFileStructureSetGenerator.h b/code/io/dicom/rttbDicomFileStructureSetGenerator.h index 082a1a6..3e8c1b5 100644 --- a/code/io/dicom/rttbDicomFileStructureSetGenerator.h +++ b/code/io/dicom/rttbDicomFileStructureSetGenerator.h @@ -1,89 +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. // //------------------------------------------------------------------------ /* Changes in Architecture: The DICOM specific classes will be removed and transfered to the corresponding IO classes. This class should only provide general structure functionality. */ #ifndef __DICOM_FILE_STRUCTURE_SET_GENERATOR_H #define __DICOM_FILE_STRUCTURE_SET_GENERATOR_H #include #include -#include "drtstrct.h" +#include #include "rttbBaseType.h" #include "rttbStrVectorStructureSetGenerator.h" +#include "RTTBDicomIOExports.h" + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4251) #endif namespace rttb { namespace io { namespace dicom { /*! @class DicomFileStructureSetGenerator @brief Generate a structure set from a corresponding dicomRT file. */ - class DicomFileStructureSetGenerator: public core::StrVectorStructureSetGenerator + class RTTBDicomIO_EXPORT DicomFileStructureSetGenerator: public core::StrVectorStructureSetGenerator { public: using StructTypePointer = core::Structure::Pointer; using StructureSetPointer = core::StructureSet::Pointer; using DRTStrSetIODPtr = boost::shared_ptr; private: IDType _UID; DICOMRTFileNameString _fileName; DicomFileStructureSetGenerator() = default; public: /*! @brief Constructor @param aDICOMRTStrSetFileName a DICOM-RT Structure set file name or a directory name @exception InvalidParameterException thrown if the file does not exist or the directory has no dicom structure file @exception DcmrtException thrown if load and read file failed */ explicit DicomFileStructureSetGenerator(DICOMRTFileNameString aDICOMRTStrSetFileName); /*! @brief Destructor */ ~DicomFileStructureSetGenerator() override; /*! @brief generate structure set @return return shared pointer of StructureSet @exception DcmrtException Thrown if loadFile and read failed @exception InvalidParameterException throw if the imported header tags are not numerical. */ StructureSetPointer generateStructureSet() override; }; } } } #ifdef _MSC_VER #pragma warning(pop) #endif #endif diff --git a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h index 95de522..e3896ed 100644 --- a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h +++ b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h @@ -1,69 +1,71 @@ // ----------------------------------------------------------------------- // 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 __DICOM_IOD_DOSE_ACCESSOR_GENERATOR_H #define __DICOM_IOD_DOSE_ACCESSOR_GENERATOR_H -#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ -#include "drtdose.h" +#include /* make sure OS specific configuration is included first */ +#include #include "rttbDoseAccessorGeneratorBase.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DicomIODDoseAccessorGenerator @brief Generate DicomDoseAccessor with a DRTDoseIOD. */ - class DicomIODDoseAccessorGenerator: public core::DoseAccessorGeneratorBase + class RTTBDicomIO_EXPORT DicomIODDoseAccessorGenerator: public core::DoseAccessorGeneratorBase { public: using DRTDoseIODPtr = boost::shared_ptr; using DcmItemPtr = boost::shared_ptr; protected: private: DRTDoseIODPtr _doseIODPtr; DicomIODDoseAccessorGenerator() = delete; public: ~DicomIODDoseAccessorGenerator() override; /*! @brief Constructor. Initialization with a boost shared pointer of DRTDoseIOD */ explicit DicomIODDoseAccessorGenerator(DRTDoseIODPtr aDRTDoseIODP); /*! @brief Generate DoseAccessor @return Return shared pointer of DoseAccessor. @exception InvalidDoseException Thrown if aDRTDoseIODP is invalid: one of column/row/numberOfFrames/doseGridScaling/pixelSpacing=0 @exception DcmrtException Throw if dcmrt error */ DoseAccessorPointer generateDoseAccessor() override ; }; } } } #endif diff --git a/code/io/dicom/rttbDicomIODStructureSetGenerator.h b/code/io/dicom/rttbDicomIODStructureSetGenerator.h index 4b5c3f6..e01573e 100644 --- a/code/io/dicom/rttbDicomIODStructureSetGenerator.h +++ b/code/io/dicom/rttbDicomIODStructureSetGenerator.h @@ -1,84 +1,86 @@ // ----------------------------------------------------------------------- // 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. // //------------------------------------------------------------------------ /* Changes in Architecture: The DICOM specific classes will be removed and transfered to the corresponding IO classes. This class should only provide general structure functionality. */ #ifndef __DICOM_IOD_STRUCTURE_SET_GENERATOR_H #define __DICOM_IOD_STRUCTURE_SET_GENERATOR_H #include -#include "drtstrct.h" +#include #include "rttbBaseType.h" #include "rttbStrVectorStructureSetGenerator.h" +#include "RTTBDicomIOExports.h" + namespace rttb { namespace io { namespace dicom { /*! @class DicomIODStructureSetGenerator @brief Generate a structure set from a DRTStructureSetIOD pointer. */ - class DicomIODStructureSetGenerator: public core::StrVectorStructureSetGenerator + class RTTBDicomIO_EXPORT DicomIODStructureSetGenerator: public core::StrVectorStructureSetGenerator { public: using StructTypePointer = core::Structure::Pointer; using StructureSetPointer = core::StructureSet::Pointer; using DRTStrSetIODPtr = boost::shared_ptr; private: DRTStrSetIODPtr _drtStrSetIOD; IDType _UID; /*! Import Structure data from file. @exception InvalidParameterException Thrown if the imported header tags are not numerical. */ void readStrSet(); /*! Replaces the character 'รก' ((int)-96) to ' ' ((int)32) in a string. */ void correctSpacesInROIName(std::string& roiName); public: /*! @brief Structure Constructor Get the vector of structures from DRTStructureSetIOD object @exception NullPointerException Thrown if structureSet is nullptr */ explicit DicomIODStructureSetGenerator(DRTStrSetIODPtr aDRTStructureSetIOD); /*! @brief Destructor */ ~DicomIODStructureSetGenerator() override; /*! @brief generate structure set @return return shared pointer of StructureSet @exception InvalidParameterException throw if the imported header tags are not numerical. */ StructureSetPointer generateStructureSet() override; }; } } } #endif diff --git a/code/io/models/rttbModelXMLWriter.h b/code/io/models/rttbModelXMLWriter.h index 7a1e779..4ea4343 100644 --- a/code/io/models/rttbModelXMLWriter.h +++ b/code/io/models/rttbModelXMLWriter.h @@ -1,57 +1,59 @@ // ----------------------------------------------------------------------- // 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 __MODELS_XML_WRITER_H #define __MODELS_XML_WRITER_H #include "rttbBioModel.h" +#include "RTTBModelsIOExports.h" + namespace rttb { namespace io { namespace models { /*! @class ModelXMLWriter @brief Writes a model (TCP, NTCP, ...) to an xml file */ - class ModelXMLWriter + class RTTBModelsIO_EXPORT ModelXMLWriter { private: std::string _filename; rttb::models::BioModel::Pointer _model; bool _printDVH; public: ModelXMLWriter(const std::string& filename, rttb::models::BioModel::Pointer model, bool printDVH = true); void setFilename(std::string filename); std::string getFilename() const; void setModel(rttb::models::BioModel::Pointer model); rttb::models::BioModel::Pointer getModel() const; void setPrintDVH(bool printDVH); bool getPrintDVH() const; void writeModel(); }; } } } #endif diff --git a/code/io/other/rttbDVHXMLFileReader.h b/code/io/other/rttbDVHXMLFileReader.h index 01e8e60..8822af0 100644 --- a/code/io/other/rttbDVHXMLFileReader.h +++ b/code/io/other/rttbDVHXMLFileReader.h @@ -1,64 +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. // //------------------------------------------------------------------------ #ifndef __DVH_XML_FILE_READER_H #define __DVH_XML_FILE_READER_H #include "rttbBaseType.h" #include "rttbDVHGeneratorInterface.h" +#include "RTTBOtherIOExports.h" + namespace rttb { namespace io { namespace other { /*! @class DVHXMLFileReader @brief Reads DVH data from xml files. */ - class DVHXMLFileReader: public core::DVHGeneratorInterface + class RTTBOtherIO_EXPORT DVHXMLFileReader: public core::DVHGeneratorInterface { private: FileNameString _fileName; bool _resetFile; /*! @brief Create new DVH object using the info from dvh txt file @exception InvalidParameterException Thrown if _fileName invalid */ void createDVH(); public: /*! @brief Constructor. */ explicit DVHXMLFileReader(FileNameString aFileName); ~DVHXMLFileReader(); /*! @brief Change file name. */ void resetFileName(FileNameString aFileName); /*! @brief Generate DVH, createDVH() will be called @return Return new shared pointer of DVH. @exception InvalidParameterException Thrown if _fileName invalid */ core::DVH::Pointer generateDVH() override; }; } } } #endif diff --git a/code/io/other/rttbDoseStatisticsXMLReader.h b/code/io/other/rttbDoseStatisticsXMLReader.h index 73bf445..abb806d 100644 --- a/code/io/other/rttbDoseStatisticsXMLReader.h +++ b/code/io/other/rttbDoseStatisticsXMLReader.h @@ -1,58 +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. // //------------------------------------------------------------------------ #ifndef __DOSE_STATISTICS_XML_READER_H #define __DOSE_STATISTICS_XML_READER_H #include "rttbDoseStatistics.h" +#include "RTTBOtherIOExports.h" + namespace rttb { namespace io { namespace other { /*! @class DoseStatisticsXMLReader @brief Reads a dose statistics XML into a DoseStatistics object */ - class DoseStatisticsXMLReader{ + class RTTBOtherIO_EXPORT DoseStatisticsXMLReader{ public: explicit DoseStatisticsXMLReader(const std::string& filename); ~DoseStatisticsXMLReader(); void setFilename(const std::string& filename); /*! @brief Generate a Model, createModel() will be called @return Return new shared pointer of a Model. @exception InvalidParameterException Thrown if _filename invalid */ algorithms::DoseStatistics::Pointer generateDoseStatistic(); private: std::string _filename; bool _newFile; algorithms::DoseStatistics::Pointer _doseStatistic; /*! @brief Create new Model object using the info from model xml file @exception InvalidParameterException Thrown if _filename invalid */ void createDoseStatistic(); }; } } } #endif diff --git a/code/masks/rttbBoostMask.h b/code/masks/rttbBoostMask.h index 18b009c..e37d886 100644 --- a/code/masks/rttbBoostMask.h +++ b/code/masks/rttbBoostMask.h @@ -1,195 +1,197 @@ // ----------------------------------------------------------------------- // 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 __BOOST_MASK_R_H #define __BOOST_MASK_R_H #include "rttbBaseType.h" #include "rttbStructure.h" #include "rttbGeometricInfo.h" #include "rttbMaskAccessorInterface.h" #include #include #include #include +#include "RTTBMaskExports.h" + namespace rttb { namespace masks { namespace boost { /*! @class BoostMask * @brief Implementation of voxelization using boost::geometry. * @attention If "strict" is set to true, an exception will be thrown when the given structure has self intersection. * (A structure without self intersection means all contours of the structure have no self intersection, and * the polygons on the same slice have no intersection between each other, unless the case of a donut. A donut is accepted.) * If "strict" is set to false, debug information will be displayed when the given structure has self intersection. Self intersections will be ignored * and the mask will be calculated, however, it may cause errors in the mask results. */ - class BoostMask + class RTTBMask_EXPORT BoostMask { public: using MaskVoxelList = core::MaskAccessorInterface::MaskVoxelList; using MaskVoxelListPointer = core::MaskAccessorInterface::MaskVoxelListPointer; /*! @brief Constructor * @exception rttb::core::NullPointerException thrown if aDoseGeoInfo or aStructure is nullptr * @param aDoseGeoInfo the GeometricInfo * @param aStructure the structure set * @param strict indicates whether to allow self intersection in the structure. If it is set to true, an exception will be thrown when the given structure has self intersection. * @param numberOfThreads number of threads used for voxelization. default value 0 means automatic detection, using the number of Hardware thread/cores * @exception InvalidParameterException thrown if strict is true and the structure has self intersections */ BoostMask(core::GeometricInfo::Pointer aDoseGeoInfo, core::Structure::Pointer aStructure, bool strict = true, unsigned int numberOfThreads = 0); /*! @brief Generate mask and return the voxels in the mask * @exception rttb::core::InvalidParameterException thrown if the structure has self intersections */ MaskVoxelListPointer getRelevantVoxelVector(); private: using BoostPoint2D = ::boost::geometry::model::d2::point_xy; using BoostPolygon2D = ::boost::geometry::model::polygon< ::boost::geometry::model::d2::point_xy >; using BoostRing2D = ::boost::geometry::model::ring< ::boost::geometry::model::d2::point_xy >; using BoostRingVector = std::vector;//polygon without holes using BoostPolygonVector = std::vector;//polygon with or without holes using VoxelIndexVector = std::vector; typedef std::map BoostPolygonMap;//map of the z index with the vector of boost 2d polygon typedef std::map BoostRingMap;//map of the z index with the vector of boost 2d ring typedef ::boost::multi_array BoostArray2D; using BoostArray2DPointer = ::boost::shared_ptr; typedef ::boost::shared_ptr > BoostArrayMapPointer; core::GeometricInfo::Pointer _geometricInfo; core::Structure::Pointer _structure; bool _strict; /*! @brief The number of threads */ unsigned int _numberOfThreads; //@brief The thickness of the voxelization plane (the contour plane), in double dose grid index //@details for example, the first contour has the double grid index 0.1, the second 0.3, the third 0.5, then the thickness is 0.2 double _voxelizationThickness; //@brief vector of the MaskVoxel inside the structure MaskVoxelListPointer _voxelInStructure; /*! @brief The map of z index and a vector of boost ring 2d (without holes) * @details Key: the double z grid index * Value: the vector of boost ring 2d (without holes) */ BoostRingMap _ringMap; /*! @brief The min and max index of the global bounding box. * @details The first index has the minimum for x/y/z of the global bounding box. * The second index has the maximum for x/y/z of the global bounding index. */ VoxelIndexVector _globalBoundingBox; /*! @brief The voxelization map * @details key: the converted double z grid index of a contour plane * value: the 2d mask, array[i][j] = the mask value of the position (i,j) in the global bounding box, * i: 0 - (_globalBoundingBoxSize0-1), j: 0 - (_globalBoundingBoxSize1-1) */ BoostArrayMapPointer _voxelizationMap; /*! @brief If the mask is up to date */ bool _isUpToDate; /*! @brief Voxelization and generate mask */ void calcMask(); /*! @brief The preprocessing step, wich consists of the following logic and Sub setps: * @details For all contours in a struct: * 1) Transfer the contour polygons into boost::geometry structures * 1a) Convert the contur points from world coordinates into geometry coordinates. * 1b) get min and max for x/y/z of a contour * 2) Tilt check: if difference of z_min and z_max is larger then a tolerance value -> there is a tilt. Throw rttb::TiltedMaskPlaneException. * 3) Get struct-bounding-box: get x_min_struct, y_min_struct, x_max_struct, y_max_struct to define the bounding box that containes all contours of a struct in x-y-dimensions. */ void preprocessing(); /*! @brief The voxelization step, which computes the voxelization planes (in x/y) for all contours of an struct. * @details For each contour (that is in the z-Range of the reference geometry) of the struct: * 1) Allocate result array (voxelization plane) based on the bounding box (see Preprocessing Step 3) * 2) Generate voxelization plane for the contour (based on the x-y-raster of the reference geometry). * 3) Add result Array (key is the z-Value of the contour) */ void voxelization(); /*! @brief mask voxel Generation step which transfers the voxelization planes into the (z-)geometry of the reference geometry. * @details It consists of following Sub steps : * For all "slices" in the reference geometry : * 1) generate weight vector for all voxelization planes for a given z - value of a slice * Iterate over the bounding box of a struct.For each voxel : * 2) Compute weighted sum of all voxelization planes(use weight vector, step 1) * 2a) If sum > 0 : Add mask voxel for the current x / y(inner Loop) and z value(outer Loop). * 3) return mask voxel list. */ void generateMaskVoxelList(); /*! @brief Convert the rttb polygon with world coordinate to the rttb polygon with double geometry coordinate, calculate the current min/max * and check if the polygon is planar * @param minimum the current global minimum * @param maximum the current global maximum * @return Return true if the polygon is planar, which means that the minimal and maximal z-coordinate of the polygon is not larger than a error constant */ bool preprocessingPolygon(const rttb::PolygonType& aRTTBPolygon, rttb::PolygonType& geometryCoordinatePolygon, rttb::ContinuousVoxelGridIndex3D& minimum, rttb::ContinuousVoxelGridIndex3D& maximum, double aErrorConstant) const; /*! @brief Convert a rttb 3d polygon to a 2d boost ring*/ BoostRing2D convertRTTBPolygonToBoostRing(const rttb::PolygonType& aRTTBPolygon) const; /*! @brief Convert a rttb 3d polygon to a map of z index with a vector of boost 2d ring, because of tilt check use the first z index of the polygon as the map key*/ BoostRingMap convertRTTBPolygonSequenceToBoostRingMap(const rttb::PolygonSequenceType& aRTTBPolygonVector) const; /*! @brief Find the key with error constant to aIndex * @pre aBoostRingMap should not be empty * @return Return aBoostRingMap.end() if the key is not found */ BoostMask::BoostRingMap::iterator findNearestKey(BoostMask::BoostRingMap& aBoostRingMap, double aIndex, double aErrorConstant) const; /*! @brief If 2 rings in the vector build a donut, convert the 2 rings to a donut polygon, other rings unchanged*/ BoostPolygonVector checkDonutAndConvert(const BoostRingVector& aRingVector) const; /*! @brief Calculate the voxelization thickness. Return false, if the voxelization plane is not homogeneous */ bool calcVoxelizationThickness(double& aThickness) const; }; } } } #endif diff --git a/code/masks/rttbBoostMaskAccessor.h b/code/masks/rttbBoostMaskAccessor.h index d615ba7..362f160 100644 --- a/code/masks/rttbBoostMaskAccessor.h +++ b/code/masks/rttbBoostMaskAccessor.h @@ -1,116 +1,116 @@ // ----------------------------------------------------------------------- // 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 __BOOST_MASK_R_ACCESSOR__H #define __BOOST_MASK_R_ACCESSOR__H #include "rttbBaseType.h" #include "rttbGeometricInfo.h" #include "rttbMaskAccessorInterface.h" #include "rttbStructure.h" #include "RTTBMaskExports.h" namespace rttb { namespace masks { namespace boost { /*! @class BoostMaskAccessor * @brief Using the voxelization based on boost::geometry and generate the mask accessor. * @attention If "strict" is set to true, an exception will be thrown when the given structure has self intersection. * (A structure without self intersection means all contours of the structure have no self intersection, and * the polygons on the same slice have no intersection between each other, unless the case of a donut. A donut is accepted.) * If "strict" is set to false, debug information will be displayed when the given structure has self intersection. Self intersections will be ignored * and the mask will be calculated, however, it may cause errors in the mask results. */ - class RTTBMask_EXPORT BoostMaskAccessor : public core::MaskAccessorInterface + class RTTBMask_EXPORT BoostMaskAccessor : public core::MaskAccessorInterface { public: using MaskVoxelList = core::MaskAccessorInterface::MaskVoxelList; using MaskVoxelListPointer = core::MaskAccessorInterface::MaskVoxelListPointer; using StructTypePointer = core::Structure::Pointer; private: StructTypePointer _spStructure; core::GeometricInfo _geoInfo; bool _strict; /*! vector containing list of mask voxels*/ MaskVoxelListPointer _spRelevantVoxelVector; IDType _maskUID; public: /*! @brief Constructor with a structure pointer and a geometric info pointer * @param aStructurePointer smart pointer of the structure * @param aGeometricInfo smart pointer of the geometricInfo of the dose * @param strict indicates whether to allow self intersection in the structure. If it is set to true, an exception will be thrown when the given structure has self intersection. * @exception InvalidParameterException thrown if strict is true and the structure has self intersections */ BoostMaskAccessor(StructTypePointer aStructurePointer, const core::GeometricInfo& aGeometricInfo, bool strict = true); /*! @brief destructor*/ ~BoostMaskAccessor() override; /*! @brief voxelization of the given structures using boost algorithms*/ void updateMask() override; /*! @brief get vector containing all relevant voxels that are inside the given structure*/ MaskVoxelListPointer getRelevantVoxelVector() override; /*! @brief get vector containing all relevant voxels that have a relevant volume above the given threshold and are inside the given structure*/ MaskVoxelListPointer getRelevantVoxelVector(float lowerThreshold) override; /*!@brief determine how a given voxel on the dose grid is masked * @param aID ID of the voxel in grid. * @param voxel Reference to the voxel. * @post after a valid call voxel containes the information of the specified grid voxel. If aID is not valid, voxel values are undefined. * The relevant volume fraction will be set to zero. * @return Indicates of the voxel exists and therefore if parameter voxel containes valid values.*/ bool getMaskAt(const VoxelGridID aID, core::MaskVoxel& voxel) const override; /*!@brief determine how a given voxel on the dose grid is masked * @param aIndex 3d index of the voxel in grid. * @param voxel Reference to the voxel. * @return Indicates of the voxel exists and therefore if parameter voxel containes valid values.*/ bool getMaskAt(const VoxelGridIndex3D& aIndex, core::MaskVoxel& voxel) const override; /*! @brief give access to GeometricInfo*/ const core::GeometricInfo& getGeometricInfo() const override; /* @ brief is true if dose is on a homogeneous grid * @remark Inhomogeneous grids are not supported at the moment, but if they will be supported in the future the interface does not need to change.*/ bool isGridHomogeneous() const override { return true; }; IDType getMaskUID() const override { return _maskUID; }; }; } } } #endif diff --git a/code/models/rttbBioModelCurve.h b/code/models/rttbBioModelCurve.h index 7e4e44d..46dd759 100644 --- a/code/models/rttbBioModelCurve.h +++ b/code/models/rttbBioModelCurve.h @@ -1,49 +1,51 @@ // ----------------------------------------------------------------------- // 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 __MODEL_CURVE_H #define __MODEL_CURVE_H +#include "RTTBModelsExports.h" + namespace rttb { namespace models { class BioModel; class NTCPLKBModel; //map of dose value and model value typedef std::map CurveDataType; //pair of dose value and model value typedef std::pair CurvePointType; /*! @brief Get the curve TCP/NTCP Value vs normalisationDose, normalisationDose variant between minDose and maxDose. @param aBin the size of the map @param minDose min value for x axis @param maxDose max value for x axis @param normalisationDose prescribed dose of the current _dvh or mean/maximum. */ - CurveDataType getCurveDoseVSBioModel(BioModel& aModel, double normalisationDose, int aBin = 201, + RTTBModels_EXPORT CurveDataType getCurveDoseVSBioModel(BioModel& aModel, double normalisationDose, int aBin = 201, double minDose = 0.1, double maxDose = 150); /*! @brief Get the curve NTCP Value vs EUD, dvh variant between minFactor*deltaD and maxFactor*deltaD. @param aBin the size of the map @param minFactor min factor for dvh deltaD @param maxFactor max factor for dvh deltaD */ - CurveDataType getCurveEUDVSBioModel(NTCPLKBModel& aModel, DoseCalcType maxFactor = 10, + RTTBModels_EXPORT CurveDataType getCurveEUDVSBioModel(NTCPLKBModel& aModel, DoseCalcType maxFactor = 10, DoseCalcType minFactor = 0.1, int aBin = 201); } } #endif \ No newline at end of file diff --git a/code/models/rttbBioModelScatterPlots.h b/code/models/rttbBioModelScatterPlots.h index 9268b63..980a87d 100644 --- a/code/models/rttbBioModelScatterPlots.h +++ b/code/models/rttbBioModelScatterPlots.h @@ -1,90 +1,92 @@ // ----------------------------------------------------------------------- // 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 __MODEL_SCATTER_H #define __MODEL_SCATTER_H #include "rttbBaseType.h" #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { class BioModel; // maps dose to a pair of model value and probability typedef std::multimap > ScatterPlotType; using ParamVectorType = std::vector; /*! @brief Get the points (TCP/NTCP Value, probability of the value) if 1 parameter vary from a normal- distribution with mean=aMean, variance=aVariance. @param aModel biological model for which the scatter plot will be generated @param aParamId ID of the parameter to be varied to generate the scatter plot @param aMean mean value for the distribution of the varied parameter @param aVariance variance of the varied parameter. The variance may not be exactly zero. If so, it is set to 1e-30 to avoid numerical instability. @param aNormalisationDose prescribed dose of the current _dvh @param numberOfPoints the size of the map, number of points to be calculated @param aMinDose dose will be randomly selected from [aMinDose] (uniform distribution). They will define the minvalue for x axis @param aMaxDose dose will be randomly selected from [aMaxDose] (uniform distribution). They will define the max value for x axis @return Map of scattered values. If all parameters are valid, this map contains numberOfPoints valid scatter values. If aMaxDose<=aMinDose, the scatter plot cannot be generated. The map will therefore be empty. @warning This method is slow, do not use with too many points. Because the scatter plot map must contain numberOfPoints the scatter plot generation may run more often (producing invalid values). In tests the generation process runs on average approximately 20% more often. @exception InvalidParameterException Thrown if aNormalisationDose<=0 or aMinDose<=aMaxiDose */ - ScatterPlotType getScatterPlotVary1Parameter(BioModel& aModel, int aParamId, + RTTBModels_EXPORT ScatterPlotType getScatterPlotVary1Parameter(BioModel& aModel, int aParamId, BioModelParamType aMean, BioModelParamType aVariance, DoseTypeGy aNormalisationDose, int numberOfPoints = 100, DoseTypeGy aMinDose = 0, DoseTypeGy aMaxDose = 150); /*! @brief Get the points (TCP/NTCP Value, probability of the value) if >=1 parameter vary from a normal- distribution with mean of parameter aParamIdVec.at(i)=aMeanVec.at(i), variance of parameter aParamIdVec.at(i)= aVarianceVec.at(i). @param aModel biological model for which the scatter plot will be generated @param aParamIdVec a vector containing the IDs of the parameters to be varied to generate the scatter plot @param aMeanVec a vector of mean values for the distribution of individually the varied parameters @param aVarianceVec a vector of variance values of the individually varied parameter. The variance may not be exactly zero for any parameter. If so, it is set to 1e-30 to avoid numerical instability. @param aNormalisationDose prescribed dose of the current _dvh @param numberOfPoints the size of the map, number of points to be calculated @param aMinDose dose will be randomly selected from [aMinDose] (uniform distribution). They will define the min value for x axis @param aMaxDose dose will be randomly selected from [aMaxDose] (uniform distribution). They will define the max value for x axis @throw InvalidParameterException is thrown if the parameter vectors do not have the same size. @return Map of scattered values. If all parameters are valid, this map contains numberOfPoints valid scatter values. If aMaxDose<=aMinDose, the scatter plot cannot be generated. The map will therefore be empty. @warning This method is very slow do not use with too many points. Because the scatter plot map must contain numberOfPoints the scatter plot generation may run more often (producing invalid values). In tests the generation process runs on average approximately 20% more often. @exception InvalidParameterException Thrown if aNormalisationDose<=0 or aMinDose<=aMaxiDose */ - ScatterPlotType getScatterPlotVaryParameters(BioModel& aModel, std::vector aParamIdVec, + RTTBModels_EXPORT ScatterPlotType getScatterPlotVaryParameters(BioModel& aModel, std::vector aParamIdVec, ParamVectorType aMeanVec, ParamVectorType aVarianceVec, DoseTypeGy aNormalisationDose, int numberOfPoints = 50, DoseTypeGy aMinDose = 0, DoseTypeGy aMaxDose = 150); /*! Compute normal probability density function for zero mean at aValue with aVariance. */ - double normal_pdf(double aValue, double aVariance); + RTTBModels_EXPORT double normal_pdf(double aValue, double aVariance); } } -#endif \ No newline at end of file +#endif diff --git a/code/models/rttbDoseBasedModels.h b/code/models/rttbDoseBasedModels.h index 0101de3..d83591d 100644 --- a/code/models/rttbDoseBasedModels.h +++ b/code/models/rttbDoseBasedModels.h @@ -1,37 +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. // //------------------------------------------------------------------------ #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @brief Calculate biological LinearQuadratic Model of a dose @details \f$LQ = exp(-\frac{alpha*d+beta*d^2}{nFractions})\f$ @param dose @param alpha @param beta @param nFractions the number of fractions @pre dose>=0 @pre alpha>=0 @pre beta>=0 @return The LQ value @exception rttb::core::InvalidParameterException Thrown if parameters were not set correctly. */ - BioModelValueType calcLQ(DoseTypeGy dose, DoseCalcType alpha, + RTTBModels_EXPORT BioModelValueType calcLQ(DoseTypeGy dose, DoseCalcType alpha, DoseCalcType beta, unsigned int nFractions=1); } } \ No newline at end of file diff --git a/code/models/rttbDvhBasedModels.h b/code/models/rttbDvhBasedModels.h index 7d5334e..b87cd89 100644 --- a/code/models/rttbDvhBasedModels.h +++ b/code/models/rttbDvhBasedModels.h @@ -1,65 +1,67 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ #include #include "rttbDVH.h" #include "rttbBaseType.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { using DataDifferentialType = core::DVH::DataDifferentialType; typedef std::map BEDDVHType; typedef std::map LQEDDVHType; /*! @brief Get Equivalent Uniform Dose (EUD) @pre dvh data differential is not empty, @pre aA is not zero, @return Return calculated EUD value, @exception InvalidParameterException Thrown if parameters were not set correctly. */ - DoseStatisticType getEUD(core::DVH::ConstPointer dvh, const DoseCalcType aA); + RTTBModels_EXPORT DoseStatisticType getEUD(core::DVH::ConstPointer dvh, const DoseCalcType aA); /*! @brief Calculate Biological Effective/Equivalent Dose (BED) of dvh @param relativeVolume default false-> the corresponding volume value is the voxel number of the dose bin; if true-> the corresponding volume value is the relative volume % between 0 and 1, (the voxel number of this dose bin)/(number of voxels) @pre dvh should be an accumulated dvh of all fractions, not a single fraction dvh @pre dvh data differential is not empty @pre alpha_beta > 0 @pre numberOfFractions > 1 @return Return map: keys are BEDi in Gy, values are the volume of the dose bin @exception InvalidParameterException Thrown if parameters were not set correctly. */ - BEDDVHType calcBEDDVH(core::DVH::ConstPointer dvh, const int numberOfFractions, + RTTBModels_EXPORT BEDDVHType calcBEDDVH(core::DVH::ConstPointer dvh, const int numberOfFractions, const DoseCalcType alpha_beta, const bool relativeVolume = false); /*! @brief Calculate Linear-quadratic equivalent dose for 2-Gy (LQED2) of dvh @param relativeVolume default false-> the corresponding volume value is the voxel number of the dose bin; if true-> the corresponding volume value is the relative volume % between 0 and 1, (the voxel number of this dose bin)/(number of voxels) @pre dvh should be an accumulated dvh of all fractions, not a single fraction dvh @pre dvh data differential is not empty @pre alpha_beta > 0 @pre numberOfFractions > 1 @return Return map: keys are LQED2 in Gy, values are the volume of the dose bin; return empty map if not initialized @exception InvalidParameterException Thrown if parameters were not set correctly. */ - LQEDDVHType calcLQED2DVH(core::DVH::ConstPointer dvh, const int numberOfFractions, + RTTBModels_EXPORT LQEDDVHType calcLQED2DVH(core::DVH::ConstPointer dvh, const int numberOfFractions, const DoseCalcType alpha_beta, const bool relativeVolume = false); } } \ No newline at end of file diff --git a/code/models/rttbLQModelAccessor.h b/code/models/rttbLQModelAccessor.h index c97ba08..9442af9 100644 --- a/code/models/rttbLQModelAccessor.h +++ b/code/models/rttbLQModelAccessor.h @@ -1,87 +1,89 @@ // ----------------------------------------------------------------------- // 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 __LQ_MODEL_ACCESSOR_H #define __LQ_MODEL_ACCESSOR_H #include "rttbAccessorWithGeoInfoBase.h" #include "rttbDoseAccessorInterface.h" #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @class LQModelAccessor @brief This class gives access to the LQ Model information in an image */ - class LQModelAccessor: public core::AccessorWithGeoInfoBase + class RTTBModels_EXPORT LQModelAccessor: public core::AccessorWithGeoInfoBase { public: using DoseAccessorPointer = core::DoseAccessorInterface::Pointer; private: DoseAccessorPointer _dose; BioModelParamType _alpha; BioModelParamType _beta; unsigned int _nFractions; DoseAccessorPointer _alphaMap; DoseAccessorPointer _betaMap; double _doseScaling; bool _withAlphaBetaMaps; IDType _bioModelUID; LQModelAccessor() = delete; /*! @brief get all required data from the dose geometric info */ void assembleGeometricInfo() override; public: ~LQModelAccessor() override; /*! @brief Constructor. @pre dose must be a valid instance (and != nullptr) @exception InvalidDoseException if _dose is nullptr */ LQModelAccessor(DoseAccessorPointer dose, BioModelParamType alpha, BioModelParamType beta, unsigned int nFractions=1, double doseScaling = 1.0); /*! @brief Constructor. @pre dose must be a valid instance (and != nullptr) @exception InvalidDoseException if dose is nullptr, if alphaMap is nullptr or if betaMap is nullptr */ LQModelAccessor(DoseAccessorPointer dose, DoseAccessorPointer alphaMap, DoseAccessorPointer betaMap, unsigned int nFractions = 1, double doseScaling = 1.0); /*! @brief returns the LQ Model value for an id */ GenericValueType getValueAt(const VoxelGridID aID) const override; /*! @brief returns the LQ Model value for an index */ GenericValueType getValueAt(const VoxelGridIndex3D& aIndex) const override; const IDType getUID() const override { return _bioModelUID; }; }; } } #endif diff --git a/code/models/rttbNTCPLKBModel.h b/code/models/rttbNTCPLKBModel.h index 56b8690..e0b8332 100644 --- a/code/models/rttbNTCPLKBModel.h +++ b/code/models/rttbNTCPLKBModel.h @@ -1,97 +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. // //------------------------------------------------------------------------ #ifndef __NTCP_LKB_MODEL_H #define __NTCP_LKB_MODEL_H #include #include "rttbNTCPModel.h" #include "rttbBaseTypeModels.h" namespace rttb { namespace models { /*! @class NTCPLKBModel @brief This class represents a NTCP(Normal Tissue Complication Probability) LKB model (Lyman 1985, Kutcher and Burman 1989) @see NTCPModel */ - class NTCPLKBModel: public NTCPModel + class RTTBModels_EXPORT NTCPLKBModel: public NTCPModel { public: using ParamVectorType = NTCPModel::ParamVectorType; private: /*! The steepness of the dose-response curve. Must not be zero on model evaluation. */ BioModelParamType _m{0}; /*! Tumor or normal tissue-specific parameter that describes the dose-volume effect, e.g. -10 for prostate (Wu 2002). Must not be zero on model evaluation, because EUD calculation will fail. */ BioModelParamType _a{0}; protected: /*! @brief Calculate the model value * @param doseFactor: scaling factor for the dose. The model calculation will use the dvh with each di=old di*doseFactor. * @throw if either _a or _m is zero for the model calculation */ BioModelValueType calcModel(const double doseFactor = 1) override; public: NTCPLKBModel(); NTCPLKBModel(core::DVH::Pointer aDvh, BioModelParamType aD50, BioModelParamType aM, BioModelParamType aA); void setM(const BioModelParamType aM); const BioModelParamType getM(); void setA(const BioModelParamType aA); const BioModelParamType getA(); /*! @brief Set parameter with ID. "d50":0,"m":1,"a":2 @exception InvalidParameterException Thrown if aParamId is not 0 or 1 or 2. */ void setParameterByID(const int aParamId, const BioModelParamType aValue) override; /*! @brief Set parameter vector, where index of vector is the parameter ID. "d50":0,"m":1,"a":2 @exception InvalidParameterException Thrown if aParamterVector.size()!=3. */ void setParameterVector(const ParamVectorType& aParameterVector) override; /*! @brief Get parameter ID. "d50":0,"m":1,"a":2 @return 0 for "d50", 1 for "m", 2 for "a" @exception InvalidParameterException Thrown if aParamName is not d50 or m or a. */ const int getParameterID(const std::string& aParamName) const override; std::map getParameterMap() const override; void fillParameterMap() override; std::string getModelType() const override; }; } } #endif diff --git a/code/models/rttbNTCPModel.h b/code/models/rttbNTCPModel.h index 6416c9f..dfc5f59 100644 --- a/code/models/rttbNTCPModel.h +++ b/code/models/rttbNTCPModel.h @@ -1,57 +1,59 @@ // ----------------------------------------------------------------------- // 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 __NTCP_MODEL_H #define __NTCP_MODEL_H #include "rttbBioModel.h" #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @class NTCPModel @brief This is the interface class for NTCP(Normal Tissue Complication Probability) models */ - class NTCPModel: public BioModel + class RTTBModels_EXPORT NTCPModel: public BioModel { public: using ParamVectorType = BioModel::ParamVectorType; protected: BioModelParamType _d50{0}; public: NTCPModel(): BioModel() {} explicit NTCPModel(const BioModelParamType aD50): BioModel(), _d50(aD50) {} NTCPModel(core::DVH::Pointer aDvh, const BioModelParamType aD50): BioModel(aDvh), _d50(aD50) {} const BioModelParamType getD50() { return _d50; } void setD50(const BioModelParamType aD50) { _d50 = aD50; } }; }//end namespace models }//end namespace rttb #endif diff --git a/code/models/rttbNTCPRSModel.h b/code/models/rttbNTCPRSModel.h index 387871b..f93f1c7 100644 --- a/code/models/rttbNTCPRSModel.h +++ b/code/models/rttbNTCPRSModel.h @@ -1,104 +1,106 @@ // ----------------------------------------------------------------------- // 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 __NTCP_RS_MODEL_H #define __NTCP_RS_MODEL_H #include #include "rttbNTCPModel.h" #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @class NTCPRSModel @brief This class represents a NTCP(Normal Tissue Complication Probability) relative seriality model (Kaellman 1992) @see NTCPModel */ - class NTCPRSModel: public NTCPModel + class RTTBModels_EXPORT NTCPRSModel: public NTCPModel { public: using ParamVectorType = NTCPModel::ParamVectorType; using DVHPointer = NTCPModel::DVHPointer; private: /*! _gamma The normalised dose-response gradient, values between 1.7 and 2.0 are typical for human tumours. (Kaellman 1992) */ BioModelParamType _gamma{0}; /*! _s The relative seriality factor, e.g. s=3.4 for the esophagus (highly serial structure) and s=0.0061 for the lung(highly parallel structure). Must not be zero on model evaluation. */ BioModelParamType _s{0}; const double poissonModel(const double dose); protected: /*! @brief Calculate the model value @param doseFactor scaling factor for the dose. The model calculation will use the dvh with each di=old di*doseFactor. @throw if either _s or _d50 is zero for the model calculation. */ BioModelValueType calcModel(const double doseFactor = 1) override; public: NTCPRSModel(); /*!@brief Constructor initializing all member variables with given parameters. */ NTCPRSModel(DVHPointer aDvh, BioModelParamType aD50, BioModelParamType aGamma, BioModelParamType aS); void setGamma(const BioModelParamType aGamma); const BioModelParamType getGamma(); void setS(const BioModelParamType aS); const BioModelParamType getS(); /*! @brief Set parameter with ID. "d50":0,"gamma":1,"s":2 @exception InvalidParameterException Thrown if aParamId is not 0 or 1 or 2. */ void setParameterByID(const int aParamId, const BioModelParamType aValue) override; /*! @brief Set parameter vector, where index of vector is the parameter Id. "d50":0,"gamma":1,"s":2 @exception InvalidParameterException Thrown if aParamterVector.size()!=3. */ void setParameterVector(const ParamVectorType& aParameterVector) override; /*! @brief Get parameter ID. "d50":0,"gamma":1,"s":2 @return 0 for "d50", 1 for "gamma", 2 for "s" @exception InvalidParameterException Thrown if aParamName is not d50 or gamma or s. */ const int getParameterID(const std::string& aParamName) const override; std::map getParameterMap() const override; void fillParameterMap() override; std::string getModelType() const override; }; } } #endif diff --git a/code/models/rttbTCPLQModel.h b/code/models/rttbTCPLQModel.h index 9b7eba2..a975437 100644 --- a/code/models/rttbTCPLQModel.h +++ b/code/models/rttbTCPLQModel.h @@ -1,163 +1,165 @@ // ----------------------------------------------------------------------- // 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 __TCP_LQ_MODEL_H #define __TCP_LQ_MODEL_H #include #include #include "rttbTCPModel.h" #include "rttbBaseTypeModels.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @class TCPLQModel @brief This class represents a TCP(Tumor Control Probability) LQ model (Nahum and Sanchez-Nieto 2001, Hall and Giaccia 2006) @see TCPModel */ - class TCPLQModel: public TCPModel + class RTTBModels_EXPORT TCPLQModel: public TCPModel { public: using ParamVectorType = TCPModel::ParamVectorType; using DVHPointer = core::DVH::Pointer; private: /*! @brief Calculate intermediate tcp using alpha constant. This is a helper function for calcTCP() @see calcTCP */ long double calcTCPi(BioModelParamType aRho, BioModelParamType aAlphaMean, double vj, double bedj); /*! @brief Calculate tcp using alpha constant. */ long double calcTCP(std::map aBEDDVH, BioModelParamType aRho, BioModelParamType aAlphaMean, double aDeltaV); /*! @brief Calculate tcp using a normal distribution for alpha. */ long double calcTCPAlphaNormalDistribution(std::map aBEDDVH, BioModelParamType aRho, BioModelParamType aAlphaMean, BioModelParamType aAlphaVariance, double aDeltaV); protected: BioModelParamType _alphaMean{0}; BioModelParamType _alphaVariance{0}; BioModelParamType _alpha_beta{0}; /*! Roh is the initial clonogenic cell density */ BioModelParamType _rho{0}; /*! @brief Calculate the model value @param doseFactor scaling factor for prescribed dose. The model calculation will use the dvh with each di=old di*doseFactor. @pre _alphaMean >0 @pre _alphaVariance >= 0 @pre _alpha_beta > 0 @pre _rho > 0 @pre _numberOfFractions > 1 @exception InvalidParameterException Thrown if parameters were not set correctly. */ BioModelValueType calcModel(const double doseFactor = 1) override; public: TCPLQModel(); /*! @brief Constructor initializes member variables with given parameters. @pre aAlphaMean >0 @pre aBeta > 0 @pre aRho > 0 @pre aNumberOfFractions > 1 */ TCPLQModel(DVHPointer aDVH, BioModelParamType aAlphaMean, BioModelParamType aBeta, BioModelParamType aRho, int aNumberOfFractions); /*! @brief Constructor for alpha distribution initializes member variables with given parameters. @pre aAlphaMean >0 @pre aAlphaVariance >0 @pre aAlpha_Beta > 0 @pre aRho > 0 @pre aNumberOfFractions > 1 */ TCPLQModel(DVHPointer aDVH, BioModelParamType aRho, int aNumberOfFractions, BioModelParamType aAlpha_Beta, BioModelParamType aAlphaMean, BioModelParamType aAlphaVariance); const BioModelParamType getRho(); void setRho(const BioModelParamType aRho); const BioModelParamType getAlphaMean(); const BioModelParamType getAlphaVariance(); /*! @brief The distribution of the parameter alpha, which is characteristic for a population of cells, is described by the its mean and variance. If alpha is constant the variance is 0. @param aAlphaVariance The variance of alpha can be given, the default value is 0 resulting in constant alpha. */ void setAlpha(const BioModelParamType aAlphaMean, const BioModelParamType aAlphaVariance = 0); const BioModelParamType getAlphaBeta(); void setAlphaBeta(const BioModelParamType aAlpha_Beta); /*! @brief Set parameters for the TCP model. _value will be reset to 0. @param aAlpha_Beta alpha/beta constant . @param aAlphaMean mean of alpha distribution. @param aAlphaVariance variance of alpha distribution. */ void setParameters(const BioModelParamType aAlphaMean, const BioModelParamType aAlpha_Beta, const BioModelParamType aRho, const BioModelParamType aAlphaVariance = 0); /*! @brief Set parameter with ID. "alphaMean":0,"alphaVariance":1,"alpha_beta":2, "rho":3 @exception InvalidParameterException Thrown if aParamId is not 0 or 1 or 2 or 3. */ void setParameterByID(const int aParamId, const BioModelParamType aValue) override; /*! @brief Set parameter vector, where index of vector is the parameter id. "alphaMean":0,"alphaVariance":1,"alpha_beta":2, "rho":3 @exception InvalidParameterException Thrown if aParamterVector.size()!=4. */ void setParameterVector(const ParamVectorType& aParameterVector) override; /*! @brief Get parameter id. "alphaMean":0,"alphaVariance":1,"alpha_beta":2, "rho":3 @return 0 for "alphaMean", 1 for "alphaVariance", 2 for "alpha_beta", 3 for "rho" @exception InvalidParameterException Thrown if aParamName is not alphaMean or alphaVariance or alpha_beta or rho. */ const int getParameterID(const std::string& aParamName) const override; std::map getParameterMap() const override; void fillParameterMap() override; std::string getModelType() const override; }; }//end algorithms }//end rttb #endif diff --git a/code/models/rttbTCPModel.h b/code/models/rttbTCPModel.h index 03169a4..2f22235 100644 --- a/code/models/rttbTCPModel.h +++ b/code/models/rttbTCPModel.h @@ -1,56 +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. // //------------------------------------------------------------------------ #ifndef __TCP_MODEL_H #define __TCP_MODEL_H #include "rttbBioModel.h" +#include "RTTBModelsExports.h" + namespace rttb { namespace models { /*! @class TCPModel @brief This is the interface class for TCP(Tumor Control Probability) models */ - class TCPModel: public BioModel + class RTTBModels_EXPORT TCPModel: public BioModel { public: using ParamVectorType = BioModel::ParamVectorType; protected: int _numberOfFractions{0}; public: TCPModel(): BioModel() {}; explicit TCPModel(int aNum): BioModel(), _numberOfFractions(aNum) {}; TCPModel(core::DVH::Pointer aDvh, int aNum): BioModel(aDvh), _numberOfFractions(aNum) {}; void setNumberOfFractions(const int aNumberOfFractions); const int getNumberOfFractions(); }; }//end namespace models }//end namespace rttb #endif