DCMTK  Version 3.6.6
OFFIS DICOM Toolkit
dcmrt: a radiation therapy library and utility apps

This module contains classes to read, write, create, modify and access various DICOM Radiation Therapy (RT) objects. These classes are generated automatically from the official DocBook/XML version of the DICOM standard.

The main interface classes are:

To simplify working with this low-level interface, there are some hand-written classes which provide commonly needed functionality.

These classes are:

Tools

This module contains the following command line tools:

Examples

The following example shows how to load an RT Dose file and output the patient's name:

DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("rtdose.dcm");
if (status.good())
{
DRTDoseIOD rtdose;
status = rtdose.read(*fileformat.getDataset());
if (status.good())
{
OFString patientName;
status = rtdose.getPatientName(patientName);
if (status.good())
{
cout << "Patient's Name: " << patientName << endl;
} else
cerr << "Error: cannot access Patient's Name (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot read RT Dose object (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot load DICOM file (" << status.text() << ")" << endl;

The following example shows how to load an RT Dose file and access the scaled dose image:

DRTDose rtdose;
OFCondition status = rtdose.loadFile("rtdose.dcm");
if (status.good())
{
const unsigned int frame = 0;
OFVector<double> doseImage;
status = rtdose.getDoseImage(doseImage, frame);
if (status.good())
{
for (int y = 0; y < doseImage.getDoseImageHeight(); ++y)
{
for (int x = 0; x < doseImage.getDoseImageWidth(); ++x)
{
double value = *it++;
/* do something useful with the dose image pixel */
}
}
} else
cerr << "Error: cannot read RT Dose image (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot load RT Dose object (" << status.text() << ")" << endl;

The following example shows how to load an RT Plan file, change the patient's name and save it to a new file:

DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("rtplan.dcm");
if (status.good())
{
DRTPlanIOD rtplan;
status = rtplan.read(*fileformat.getDataset());
if (status.good())
{
status = rtplan.setPatientName("Doe^John");
if (status.good())
{
fileformat.clear();
status = rtplan.write(*fileformat.getDataset());
if (status.good())
{
status = fileformat.saveFile("rtplan_new.dcm");
if (status.bad())
cerr << "Error: cannot save DICOM file (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot write RT Plan object (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot change Patient's Name (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot read RT Plan object (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot load DICOM file (" << status.text() << ")" << endl;

Known Issues

Since most of the classes in this module are generated automatically from a machine-readable version of the DICOM standard and the RT objects are known to "re-use" the same sequence attributes with different content at various places, there still might be some issues with wrong definitions in a few sub-sequences. E.g., the Referenced Beam Sequence (300C,0004) and the Referenced SOP Sequence (0008,1199) are candidates that might not be handled 100% correctly yet.

DRTDose
helper class for working with radio therapy dose information objects.
Definition: drmdose.h:38
DcmFileFormat::loadFile
virtual OFCondition loadFile(const OFFilename &fileName, const E_TransferSyntax readXfer=EXS_Unknown, const E_GrpLenEncoding groupLength=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength, const E_FileReadMode readMode=ERM_autoDetect)
load object from a DICOM file.
DRTPlanIOD::write
virtual OFCondition write(DcmItem &dataset)
write object to dataset
OFCondition::bad
OFBool bad() const
check if the status is not OK, i.e. error or failure.
Definition: ofcond.h:305
DRTDoseIOD::read
virtual OFCondition read(DcmItem &dataset)
read object from dataset
DcmFileFormat::saveFile
virtual OFCondition saveFile(const OFFilename &fileName, const E_TransferSyntax writeXfer=EXS_Unknown, const E_EncodingType encodingType=EET_UndefinedLength, const E_GrpLenEncoding groupLength=EGL_recalcGL, const E_PaddingEncoding padEncoding=EPD_noChange, const Uint32 padLength=0, const Uint32 subPadLength=0, const E_FileWriteMode writeMode=EWM_createNewMeta)
save object to a DICOM file.
OFString
a simple string class that implements a subset of std::string.
Definition: ofstring.h:81
DRTPlanIOD::read
virtual OFCondition read(DcmItem &dataset)
read object from dataset
DcmFileFormat::getDataset
DcmDataset * getDataset()
get dataset part of the fileformat
OFVector::begin
iterator begin()
get an iterator for the first element in this object.
Definition: ofvector.h:171
DRTPlanIOD
Interface class for RTPlanIOD.
Definition: drtplan.h:92
DRTDoseIOD::getPatientName
virtual OFCondition getPatientName(OFString &value, const signed long pos=0) const
get PatientName (0010,0010)
DRTPlanIOD::setPatientName
virtual OFCondition setPatientName(const OFString &value, const OFBool check=OFTrue)
set PatientName (0010,0010)
OFVector::iterator
T * iterator
the type of mutable iterators on this object
Definition: ofvector.h:62
OFCondition
General purpose class for condition codes.
Definition: ofcond.h:167
OFCondition::good
OFBool good() const
check if the status is OK.
Definition: ofcond.h:296
DRTDoseIOD
Interface class for RTDoseIOD.
Definition: drtdose.h:92
OFCondition::text
const char * text() const
get a human readable text representation of this error code.
Definition: ofcond.h:280
DRTDose::loadFile
virtual OFCondition loadFile(const OFFilename &fileName, const E_FileReadMode readMode=ERM_autoDetect, const E_TransferSyntax readXfer=EXS_Unknown)
load an object from a file
DRTDose::getDoseImage
virtual OFCondition getDoseImage(OFVector< double > &result, unsigned int frame) const
get the dose information for a single frame of the image.
OFVector
this is a resizable array.
Definition: ofvector.h:55
DcmFileFormat
a class handling the DICOM file format (with meta header)
Definition: dcfilefo.h:44
DcmFileFormat::clear
virtual OFCondition clear()
clear file meta information header and dataset


Generated on Thu Jan 14 2021 for DCMTK Version 3.6.6 by Doxygen 1.8.18