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