diff --git a/code/io/dicom/rttbDicomDoseAccessor.cpp b/code/io/dicom/rttbDicomDoseAccessor.cpp index 5c8c702..36adcc6 100644 --- a/code/io/dicom/rttbDicomDoseAccessor.cpp +++ b/code/io/dicom/rttbDicomDoseAccessor.cpp @@ -1,303 +1,294 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #include #include #include "rttbDicomDoseAccessor.h" #include "rttbNullPointerException.h" #include "rttbInvalidDoseException.h" #include "rttbDcmrtException.h" #include "rttbIndexOutOfBoundsException.h" namespace rttb { namespace io { namespace dicom { DicomDoseAccessor::~DicomDoseAccessor() { } - DicomDoseAccessor::DicomDoseAccessor(DRTDoseIODPtr aDRTDoseIODP) + 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; - DcmFileFormat fileformat; - DcmItem doseitem; - status = _dose->write(doseitem); + unsigned long count; + const Uint16* pixelData; + status = _dataSet->findAndGetUint16Array(DcmTagKey(0x7fe0, 0x0010), pixelData, &count); if (status.good()) { - unsigned long count; - const Uint16* pixelData; - status = doseitem.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 + for (unsigned int i = 0; i < static_cast(this->_geoInfo.getNumberOfVoxels()); i++) { - throw io::dicom::DcmrtException("Read Pixel Data (7FE0,0010) failed!"); + this->doseData.push_back(pixelData[i]); } + + return true; } else { - throw io::dicom::DcmrtException("Read DICOM-RT Dose file failed!"); + throw io::dicom::DcmrtException("Read Pixel Data (7FE0,0010) failed!"); } + } bool 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.getPixelSpacingRow() == 0 || _geoInfo.getPixelSpacingColumn() == 0) { throw core::InvalidDoseException("Pixel spacing = 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) + 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) + (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.getPixelSpacingRow() - << "!" << std::endl; + _geoInfo.getPixelSpacingRow() + << "!" << std::endl; spacingVector(2) = spacingVector(0); } } } _geoInfo.setSpacing(spacingVector); return true; } DoseTypeGy DicomDoseAccessor::getDoseAt(const VoxelGridID aID) const { return doseData.at(aID) * _doseGridScaling; } DoseTypeGy DicomDoseAccessor::getDoseAt(const VoxelGridIndex3D& aIndex) const { VoxelGridID aVoxelGridID; if (_geoInfo.convert(aIndex, aVoxelGridID)) { return getDoseAt(aVoxelGridID); } else { return -1; } } } } } diff --git a/code/io/dicom/rttbDicomDoseAccessor.h b/code/io/dicom/rttbDicomDoseAccessor.h index 68f04f5..1e609fc 100644 --- a/code/io/dicom/rttbDicomDoseAccessor.h +++ b/code/io/dicom/rttbDicomDoseAccessor.h @@ -1,99 +1,101 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __DICOM_DOSE_ACCESSOR_H #define __DICOM_DOSE_ACCESSOR_H #include #include #include #include #include "osconfig.h" /* make sure OS specific configuration is included first */ #include "drtdose.h" #include "rttbDoseAccessorInterface.h" #include "rttbBaseType.h" namespace rttb { namespace io { namespace dicom { /*! @class DicomDoseAccessor - @brief This class gives access to dose information from DRTDoseIOD + @brief This class gives access to dose information from DRTDoseIOD and DcmItem */ class DicomDoseAccessor: public core::DoseAccessorInterface { public: typedef boost::shared_ptr DRTDoseIODPtr; + typedef boost::shared_ptr DcmItemPtr; private: DRTDoseIODPtr _dose; + DcmItemPtr _dataSet; /*! vector of dose data(absolute Gy dose/doseGridScaling)*/ std::vector doseData; double _doseGridScaling; IDType _doseUID; DicomDoseAccessor(); 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. */ bool assembleGeometricInfo(); public: ~DicomDoseAccessor(); - /*! @brief Constructor. Initialisation with a boost::shared_ptr of DRTDoseIOD + /*! @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); + DicomDoseAccessor(DRTDoseIODPtr aDRTDoseIODP, DcmItemPtr aDcmDataset); DoseTypeGy getDoseAt(const VoxelGridID aID) const; DoseTypeGy getDoseAt(const VoxelGridIndex3D& aIndex) const; const IDType getDoseUID() const { return _doseUID; }; }; } } } #endif diff --git a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.cpp b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.cpp index 152ac4f..af06a39 100644 --- a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.cpp +++ b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.cpp @@ -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. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #include #include #include "rttbDicomFileDoseAccessorGenerator.h" #include "rttbDicomDoseAccessor.h" #include "rttbNullPointerException.h" #include "rttbInvalidDoseException.h" #include "rttbDcmrtException.h" #include "rttbIndexOutOfBoundsException.h" namespace rttb{ namespace io{ namespace dicom{ DicomFileDoseAccessorGenerator::~DicomFileDoseAccessorGenerator(){} DicomFileDoseAccessorGenerator::DicomFileDoseAccessorGenerator(FileNameType aDICOMRTDoseFileName){ _dicomDoseFileName=aDICOMRTDoseFileName; } core::DoseAccessorGeneratorInterface::DoseAccessorPointer DicomFileDoseAccessorGenerator::generateDoseAccessor() { OFCondition status; DcmFileFormat fileformat; DRTDoseIODPtr dose= boost::make_shared(); status = fileformat.loadFile(_dicomDoseFileName.c_str()); if (!status.good()) { std::cerr << "Error: load rtdose loadFile("<<_dicomDoseFileName.c_str()<<") failed!"<read(*fileformat.getDataset()); + + DcmItemPtr dataSet = boost::make_shared(*fileformat.getDataset()); + status = dose->read(*dataSet); if(!status.good()) { std::cerr << "Error: read DRTDoseIOD failed!"<(dose); + _doseAccessor=boost::make_shared(dose, dataSet); return _doseAccessor; } } } } diff --git a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h index e13f954..be59786 100644 --- a/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h +++ b/code/io/dicom/rttbDicomFileDoseAccessorGenerator.h @@ -1,76 +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. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __DICOM_FILE_DOSE_ACCESSOR_GENERATOR_H #define __DICOM_FILE_DOSE_ACCESSOR_GENERATOR_H #include #include #include #include "osconfig.h" /* make sure OS specific configuration is included first */ #include "drtdose.h" #include "rttbDoseAccessorGeneratorBase.h" #include "rttbBaseType.h" namespace rttb{ namespace io{ namespace dicom{ /*! @class DicomFileDoseAccessorGenerator @brief Load dose data from dicom file and generate DicomDoseAccessor. */ class DicomFileDoseAccessorGenerator: public core::DoseAccessorGeneratorBase { public: typedef boost::shared_ptr DRTDoseIODPtr; + typedef boost::shared_ptr DcmItemPtr; private: FileNameType _dicomDoseFileName; DicomFileDoseAccessorGenerator(); protected: public: ~DicomFileDoseAccessorGenerator(); /*! @brief Constructor. Initialisation with a DICOM-RT dose file with name aDICOMRTDoseFileName */ 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() ; }; } } } #endif diff --git a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.cpp b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.cpp index e8fe27f..238c7b0 100644 --- a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.cpp +++ b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.cpp @@ -1,52 +1,64 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #include #include #include "rttbDicomIODDoseAccessorGenerator.h" #include "rttbDicomDoseAccessor.h" #include "rttbNullPointerException.h" #include "rttbInvalidDoseException.h" #include "rttbDcmrtException.h" #include "rttbIndexOutOfBoundsException.h" namespace rttb{ namespace io{ namespace dicom{ DicomIODDoseAccessorGenerator::~DicomIODDoseAccessorGenerator(){} DicomIODDoseAccessorGenerator::DicomIODDoseAccessorGenerator(DRTDoseIODPtr aDRTDoseIODP){ _doseIODPtr=aDRTDoseIODP; } core::DoseAccessorGeneratorInterface::DoseAccessorPointer DicomIODDoseAccessorGenerator::generateDoseAccessor() { - _doseAccessor=boost::make_shared(_doseIODPtr); + DcmItem doseitem; + OFCondition status; + + status = _doseIODPtr->write(doseitem);//write DoseIOD to DcmItem to get pixel data + + if(status.good()){ + DcmItemPtr dataSetPtr = boost::make_shared(doseitem); + _doseAccessor=boost::make_shared(_doseIODPtr, dataSetPtr); return _doseAccessor; } + else + { + throw io::dicom::DcmrtException("Write DICOM RT Dose to DcmItem failed!"); + } + } } } } diff --git a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h index 30e209d..df32063 100644 --- a/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h +++ b/code/io/dicom/rttbDicomIODDoseAccessorGenerator.h @@ -1,77 +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. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ #ifndef __DICOM_IOD_DOSE_ACCESSOR_GENERATOR_H #define __DICOM_IOD_DOSE_ACCESSOR_GENERATOR_H #include #include #include #include "osconfig.h" /* make sure OS specific configuration is included first */ #include "drtdose.h" #include "rttbDoseAccessorGeneratorBase.h" #include "rttbBaseType.h" namespace rttb{ namespace io{ namespace dicom{ /*! @class DicomIODDoseAccessorGenerator @brief Generate DicomDoseAccessor with a DRTDoseIOD. */ class DicomIODDoseAccessorGenerator: public core::DoseAccessorGeneratorBase { public: typedef boost::shared_ptr DRTDoseIODPtr; - + typedef boost::shared_ptr DcmItemPtr; protected: private: DRTDoseIODPtr _doseIODPtr; DicomIODDoseAccessorGenerator(); public: ~DicomIODDoseAccessorGenerator(); /*! @brief Constructor. Initialisation with a boost shared pointer of DRTDoseIOD */ 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() ; }; } } } #endif diff --git a/testing/io/dicom/DicomDoseAccessorGeneratorTest.cpp b/testing/io/dicom/DicomDoseAccessorGeneratorTest.cpp index 2a8b508..28bbeec 100644 --- a/testing/io/dicom/DicomDoseAccessorGeneratorTest.cpp +++ b/testing/io/dicom/DicomDoseAccessorGeneratorTest.cpp @@ -1,113 +1,114 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html [^] // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notices for more information. // //------------------------------------------------------------------------ /*! // @file // @version $Revision$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) */ // this file defines the rttbCoreTests for the test driver // and all it expects is that you have a function called RegisterTests #include #include #include #include "litCheckMacros.h" #include "rttbBaseType.h" #include "rttbDicomDoseAccessor.h" #include "rttbDicomFileDoseAccessorGenerator.h" #include "rttbDicomIODDoseAccessorGenerator.h" #include "rttbInvalidDoseException.h" +#include "rttbDcmrtException.h" namespace rttb { namespace testing { /*!@brief DicomDoseAccessorGeneratorTest - test the generators for dicom data 1) test dicom file generator generateDoseAccessor() 2) test dicom IOD generator generateDoseAccessor() */ int DicomDoseAccessorGeneratorTest(int argc, char* argv[]) { typedef boost::shared_ptr DRTDoseIODPtr; PREPARE_DEFAULT_TEST_REPORTING; //ARGUMENTS: // 1: dose1 file name // 2: dose2 file name // 3: dose3 file name std::string RTDOSE_FILENAME; std::string RTDOSE2_FILENAME; std::string RTDOSE3_FILENAME; if (argc > 1) { RTDOSE_FILENAME = argv[1]; } if (argc > 2) { RTDOSE2_FILENAME = argv[2]; } if (argc > 3) { RTDOSE3_FILENAME = argv[3]; } OFCondition status; DcmFileFormat fileformat; /* test DicomFileDoseAccessorGenerator generateDoseAccessor()*/ CHECK_THROW_EXPLICIT(io::dicom::DicomFileDoseAccessorGenerator("test.test").generateDoseAccessor(), core::InvalidDoseException); CHECK_NO_THROW(io::dicom::DicomFileDoseAccessorGenerator( RTDOSE_FILENAME.c_str()).generateDoseAccessor()); CHECK_NO_THROW(io::dicom::DicomFileDoseAccessorGenerator( RTDOSE2_FILENAME.c_str()).generateDoseAccessor()); CHECK_NO_THROW(io::dicom::DicomFileDoseAccessorGenerator( RTDOSE3_FILENAME.c_str()).generateDoseAccessor()); /* test DicomIODDoseAccessorGenerator generateDoseAccessor()*/ DRTDoseIODPtr dose = boost::make_shared(); CHECK_THROW_EXPLICIT(io::dicom::DicomIODDoseAccessorGenerator(dose).generateDoseAccessor(), - core::InvalidDoseException); + io::dicom::DcmrtException); fileformat.loadFile(RTDOSE_FILENAME.c_str()); dose->read(*fileformat.getDataset()); CHECK_NO_THROW(io::dicom::DicomIODDoseAccessorGenerator(dose).generateDoseAccessor()); RETURN_AND_REPORT_TEST_SUCCESS; } }//testing }//rttb