DCMTK  Version 3.6.6
OFFIS DICOM Toolkit
dcmsr: a structured reporting library and utility apps

This module contains classes to read, write, create, modify, access, print and render DICOM Structured Reporting (SR) documents. The list of supported SOP classes is provided in DSRTypes::E_DocumentType.

The main interface classes are:

Here are some further classes that are useful when implementing SR templates:

Currently, the following SR templates are implemented (see notes for details):

Tools

This module contains the following command line tools:

Examples

The following example shows how to load a DICOM Structured Report and render its content in HTML format:

DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
DSRDocument document;
status = document.read(*fileformat.getDataset());
if (status.good())
{
status = document.renderHTML(cout);
if (status.bad())
cerr << "Error: cannot render SR document (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot read SR document (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot load DICOM file (" << status.text() << ")" << endl;

The following example shows how to create a DICOM Structured Report and save it to a file (further details can be found in the mkreport source file):

DSRDocument document;
document.setPatientName("Doe^John");
/* ... */
DSRDocumentTree &tree = document.getTree();
tree.getCurrentContentItem().setCodeValue(CODE_DCM_Person);
/* ... */
DcmFileFormat fileformat;
OFCondition status = document.write(*fileformat.getDataset())
if (status.good())
{
status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
if (status.bad())
cerr << "Error: cannot save DICOM file (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot write SR document (" << status.text() << ")" << endl;

Alternatively, many properties of the document tree can be accessed and modified directly as the following example shows:

/* ... */
DSRDocumentTree &tree = document.getTree();
if (codePtr != NULL)
codePtr->setCode("113000", "DCM", "Of Interest");
/* ... */
if (imagePtr != NULL)
{
imagePtr->setValue(DSRImageReferenceValue(UID_UltrasoundMultiframeImageStorage, /* image UID */));
imagePtr->setPresentationState(DSRCompositeReferenceValue(UID_GrayscaleSoftcopyPresentationStateStorage, /* GSPS UID */));
imagePtr->getFrameList().addItem(2);
imagePtr->getFrameList().addItem(5);
}
/* ... */

In addition, there are specific DSRDocumentTree::addContentItem() and DSRDocumentTree::addChildContentItem() methods that expect a pointer to a newly created DSRDocumentTreeNode instance.

Iterating over a document tree and searching for content items that meet certain criteria can be achieved in various ways. Here are two of them:

DSRDocument document;
/* ... */
DSRDocumentTree &tree = document.getTree();
/* #1: search for content items with a certain concept name */
if (tree.gotoNamedNode(CODE_DCM_ProcedureReported))
{
do {
const DSRDocumentTreeNode *node = tree.getNode();
/* and check for expected value type */
if ((node != NULL) && (node->getValueType() == DSRTypes::VT_Code))
{
/* do something useful with the CODE content item */
}
} while (tree.gotoNextNamedNode(CODE_DCM_ProcedureReported, OFFalse /*searchIntoSub*/));
}
/* #2: search for content items using a more complex filter */
if (tree.gotoMatchingNode(filter))
{
/* found first "has concept mod CODE" content item that has children */
}

The final example shows how to deal with SR templates, e.g. when creating a DICOM Structured Report that is based on TID 1500 (Measurement Report):

report.setLanguage(CID5000_Languages::English);
report.getObservationContext().addPersonObserver("Doe^Jane", "Some Organization");
/* ... */
CMR_TID1411_in_TID1500 &volumetric = report.getVolumetricROIMeasurements();
volumetric.setActivitySession("1");
volumetric.setTrackingIdentifier("aorta reference region");
/* ... */
/* ... */
DSRDocument document;
document.setPatientName("Last Name^First Name");
/* ... */
if (document.setTreeFromRootTemplate(report).good())
else
cerr << "Error: cannot set template content as document tree" << endl;
DSRTypes::VT_Code
@ VT_Code
DICOM Value Type: CODE.
Definition: dsrtypes.h:589
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.
CID5000_Languages::English
@ English
(eng,RFC5646,"English")
Definition: cid5000.h:44
DSRDocumentSubTree::getCurrentContentItem
virtual DSRContentItem & getCurrentContentItem()
get reference to current content item.
CID7469_GenericIntensityAndSizeMeasurements::Volume
@ Volume
(118565006,SCT,"Volume"), included from CID 7472
Definition: cid7469.h:406
DSRDocumentTree
Class managing the SR document tree.
Definition: dsrdoctr.h:45
DSRTypes::VT_Image
@ VT_Image
DICOM Value Type: IMAGE.
Definition: dsrtypes.h:611
TID1419_ROIMeasurements_Measurement
Implementation of the DCMR Template: TID 1419 - ROI Measurements (only the "Measurement" content item...
Definition: tid1419m.h:54
OFCondition::bad
OFBool bad() const
check if the status is not OK, i.e. error or failure.
Definition: ofcond.h:305
DSRDocument::read
virtual OFCondition read(DcmItem &dataset, const size_t flags=0)
read SR document from DICOM dataset.
DSRImageReferenceValue::setPresentationState
OFCondition setPresentationState(const DSRCompositeReferenceValue &pstateValue, const OFBool check=OFTrue)
set reference to presentation state object.
DSRCompositeReferenceValue
Class for composite reference values.
Definition: dsrcomvl.h:39
DSRDocument::print
virtual OFCondition print(STD_NAMESPACE ostream &stream, const size_t flags=0)
print current SR document to specified output stream.
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.
DSRDocumentSubTree::getNode
virtual DSRDocumentTreeNode * getNode() const
get pointer to current node.
DcmFileFormat::getDataset
DcmDataset * getDataset()
get dataset part of the fileformat
DSRDocumentTreeNode
Base class for content items.
Definition: dsrdoctn.h:48
DSRDocumentTreeNode::getValueType
E_ValueType getValueType() const
get value type of the current content item
Definition: dsrdoctn.h:322
DSRTypes::DT_KeyObjectSelectionDocument
@ DT_KeyObjectSelectionDocument
DICOM IOD: Key Object Selection Document.
Definition: dsrtypes.h:513
CID7464_GeneralRegionOfInterestMeasurementModifiers::StandardDeviation
@ StandardDeviation
(386136009,SCT,"Standard Deviation")
Definition: cid7464.h:50
DSRContentItem::getImageReferencePtr
DSRImageReferenceValue * getImageReferencePtr()
get pointer to image reference.
DSRCodedEntryValue
Class for handling coded entry values, i.e. unambiguous machine-readable codes.
Definition: dsrcodvl.h:113
EXS_LittleEndianExplicit
@ EXS_LittleEndianExplicit
Explicit VR Little Endian.
Definition: dcxfer.h:45
DSRDocumentSubTree::gotoNamedNode
virtual size_t gotoNamedNode(const DSRCodedEntryValue &conceptName, const OFBool startFromRoot=OFTrue, const OFBool searchIntoSub=OFTrue)
set internal cursor to a named node.
DSRDocument
Interface class for 'dcmsr' (DICOM Structured Reporting Documents).
Definition: dsrdoc.h:59
CID7181_AbstractMultiDimensionalImageModelComponentUnits::CubicMillimeter
@ CubicMillimeter
(mm3,UCUM,"cubic millimeter"), included from CID 7462
Definition: cid7181.h:76
DSRTypes::VT_Container
@ VT_Container
DICOM Value Type: CONTAINER.
Definition: dsrtypes.h:615
DSRDocument::setPatientName
virtual OFCondition setPatientName(const OFString &value, const OFBool check=OFTrue)
set patient's name
DSRDocument::renderHTML
virtual OFCondition renderHTML(STD_NAMESPACE ostream &stream, const size_t flags=0, const char *styleSheet=NULL)
render current SR document in HTML/XHTML format.
DSRListOfItems::addItem
void addItem(const T &item)
add item to the list
Definition: dsrtlist.h:242
DSRTypes::RT_hasObsContext
@ RT_hasObsContext
DICOM Relationship Type: HAS OBS CONTEXT.
Definition: dsrtypes.h:565
DSRDocument::getTree
DSRDocumentTree & getTree()
get document tree
Definition: dsrdoc.h:215
DSRTypes::RT_isRoot
@ RT_isRoot
internal type used for the document root
Definition: dsrtypes.h:561
DSRDocumentSubTree::gotoNextNamedNode
virtual size_t gotoNextNamedNode(const DSRCodedEntryValue &conceptName, const OFBool searchIntoSub=OFTrue)
set internal cursor to the next named node.
DSRDocumentTreeNodeRelationshipTypeFilter
Class implementing a document tree node filter that checks for a given relationship type.
Definition: dsrdnflt.h:326
DSRContentItem::getConceptNamePtr
DSRCodedEntryValue * getConceptNamePtr()
get pointer to concept name.
DSRDocumentTreeNodeFilterList::addFilter
OFCondition addFilter(DSRDocumentTreeNodeFilter *filter)
add a document tree node filter to the list
TID1419_ROIMeasurements_Measurement::setDerivation
OFCondition setDerivation(const T_Derivation &derivation, const OFBool check=OFTrue)
set the value of the 'Derivation' content item (TID 1419 - Row 8).
TID1419_ROIMeasurements_Measurement::createNewMeasurement
OFCondition createNewMeasurement(const T_Measurement &conceptName, const MeasurementValue &numericValue, const OFBool check=OFTrue)
create a new measurement.
CMR_SRNumericMeasurementValueWithUnits
Class for SR numeric values and measurements (extended version with additional support of the DICOM C...
Definition: srnumvlu.h:39
DSRContentItem::setCodeValue
OFCondition setCodeValue(const DSRCodedEntryValue &codeValue, const OFBool check=OFTrue)
set code value.
TID1411_VolumetricROIMeasurements::setActivitySession
OFCondition setActivitySession(const OFString &session, const OFBool check=OFTrue)
set the value of the 'Activity Session' content item (TID 1411 - Row 1b).
DSRImageReferenceValue::setValue
OFCondition setValue(const DSRImageReferenceValue &referenceValue, const OFBool check=OFTrue)
set image reference value.
DSRContentItem::setConceptName
OFCondition setConceptName(const DSRCodedEntryValue &conceptName, const OFBool check=OFTrue)
set concept name.
TID1411_VolumetricROIMeasurements
Implementation of DCMR Template: TID 1411 - Volumetric ROI Measurements (and included templates 1502 ...
Definition: tid1411.h:57
OFCondition
General purpose class for condition codes.
Definition: ofcond.h:167
DSRDocument::write
virtual OFCondition write(DcmItem &dataset, DcmStack *markedItems=NULL)
write current SR document to DICOM dataset.
OFCondition::good
OFBool good() const
check if the status is OK.
Definition: ofcond.h:296
DSRTypes::RT_hasConceptMod
@ RT_hasConceptMod
DICOM Relationship Type: HAS CONCEPT MOD.
Definition: dsrtypes.h:569
OFCondition::text
const char * text() const
get a human readable text representation of this error code.
Definition: ofcond.h:280
DSRDocumentSubTree::addChildContentItem
virtual OFCondition addChildContentItem(const E_RelationshipType relationshipType, const E_ValueType valueType, const DSRCodedEntryValue &conceptName, const OFBool check=OFTrue)
add specified content item below the current one.
CID7021_MeasurementReportDocumentTitles::ImagingMeasurementReport
@ ImagingMeasurementReport
(126000,DCM,"Imaging Measurement Report")
Definition: cid7021.h:44
DSRDocumentTreeNodeValueTypeFilter
Class implementing a document tree node filter that checks for a given value type.
Definition: dsrdnflt.h:294
DSRDocument::setTreeFromRootTemplate
virtual OFCondition setTreeFromRootTemplate(DSRRootTemplate &rootTemplate, const OFBool expandTree=OFTrue)
set document tree from root template.
DSRTypes::RT_contains
@ RT_contains
DICOM Relationship Type: CONTAINS.
Definition: dsrtypes.h:563
DSRImageReferenceValue
Class for image reference values.
Definition: dsrimgvl.h:50
DSRDocumentSubTree::addContentItem
virtual size_t addContentItem(const E_RelationshipType relationshipType, const E_ValueType valueType, const E_AddMode addMode=AM_afterCurrent)
add specified content item to the current one.
TID1411_VolumetricROIMeasurements::setTrackingIdentifier
OFCondition setTrackingIdentifier(const OFString &trackingID, const OFBool check=OFTrue)
set the value of the 'Tracking Identifier' content item (TID 1411 - Row 2).
DSRDocumentTreeNodeAndFilter
Class implementing a list of document tree node filters that are combined with AND (conjunction)
Definition: dsrdnflt.h:120
DSRImageReferenceValue::getFrameList
DSRImageFrameList & getFrameList()
get reference to list of referenced frame numbers.
Definition: dsrimgvl.h:362
DcmFileFormat
a class handling the DICOM file format (with meta header)
Definition: dcfilefo.h:44
TID1411_VolumetricROIMeasurements::getMeasurement
TID1419_Measurement & getMeasurement() const
get current measurement value of this measurement group as defined by TID 1419 (ROI Measurements),...
Definition: tid1411.h:148
DSRDocumentTreeNodeHasChildrenFilter
Class implementing a document tree node filter that checks for the presence (or absence) of child nod...
Definition: dsrdnflt.h:162
DSRTypes::PF_printTemplateIdentification
static const size_t PF_printTemplateIdentification
print template identification (TID and mapping resource)
Definition: dsrtypes.h:429
TID1500_MeasurementReport
Implementation of DCMR Template: TID 1500 - Measurement Report (and included templates 1204,...
Definition: tid1500.h:74
DSRCodedEntryValue::setCode
OFCondition setCode(const DSRBasicCodedEntry &basicCodedEntry, const OFBool check=OFFalse)
set code.
DSRDocumentSubTree::gotoMatchingNode
virtual size_t gotoMatchingNode(const DSRDocumentTreeNodeFilter &filter, const OFBool startFromRoot=OFTrue, const OFBool searchIntoSub=OFTrue)
set internal cursor to a matching node.


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