DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
DSRCompositeReferenceValue Class Reference

Class for composite reference values. More...

Inheritance diagram for DSRCompositeReferenceValue:

## Public Member Functions
| DSRCompositeReferenceValue ()
| default constructor
| DSRCompositeReferenceValue (const OFString &sopClassUID, const OFString &sopInstanceUID, const OFBool check=OFTrue)
| constructor More...
| DSRCompositeReferenceValue (const DSRCompositeReferenceValue &referenceValue)
| copy constructor More...
virtual | ~DSRCompositeReferenceValue ()
| destructor
DSRCompositeReferenceValue & | operator= (const DSRCompositeReferenceValue &referenceValue)
| assignment operator More...
virtual void | clear ()
| clear all internal variables. More...
OFBool | isEqual (const DSRCompositeReferenceValue &referenceValue) const
| check whether values are "equal" More...
OFBool | isNotEqual (const DSRCompositeReferenceValue &referenceValue) const
| check whether values are "not equal" More...
virtual OFBool | isValid () const
| check whether the current reference value is valid. More...
virtual OFBool | isEmpty () const
| check whether the current reference value is empty. More...
virtual OFBool | isComplete () const
| check whether the current reference value is complete, i.e. whether both mandatory UIDs are non-empty. More...
virtual OFCondition | print (STD_NAMESPACE ostream &stream, const size_t flags) const
| print reference value. More...
virtual OFCondition | readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor, const size_t flags)
| read reference value from XML document More...
virtual OFCondition | writeXML (STD_NAMESPACE ostream &stream, const size_t flags) const
| write reference value in XML format More...
virtual OFCondition | readSequence (DcmItem &dataset, const DcmTagKey &tagKey, const OFString &type, const size_t flags)
| read referenced SOP sequence from dataset. More...
virtual OFCondition | writeSequence (DcmItem &dataset, const DcmTagKey &tagKey) const
| write referenced SOP sequence to dataset. More...
virtual OFCondition | renderHTML (STD_NAMESPACE ostream &docStream, STD_NAMESPACE ostream &annexStream, size_t &annexNumber, const size_t flags, const char *urlPrefix=NULL) const
| render composite reference value in HTML/XHTML format More...
const OFString & | getSOPClassUID () const
| get SOP class UID More...
const OFString | getSOPClassName (const OFString &defaultName="unknown SOP Class UID") const
| get name associated with the SOP class UID (if any) More...
const OFString & | getSOPInstanceUID () const
| get SOP instance UID More...
const DSRCompositeReferenceValue & | getValue () const
| get reference to composite reference value More...
OFCondition | getValue (DSRCompositeReferenceValue &referenceValue) const
| get copy of composite reference value More...
OFCondition | setValue (const DSRCompositeReferenceValue &referenceValue, const OFBool check=OFTrue)
| set composite reference value. More...
OFCondition | setReference (const OFString &sopClassUID, const OFString &sopInstanceUID, const OFBool check=OFTrue)
| set SOP class UID and SOP instance UID value. More...
OFCondition | setReference (DcmItem &dataset, const OFBool check=OFTrue)
| set SOP class UID and SOP instance UID value from dataset. More...
OFCondition | setSOPClassUID (const OFString &sopClassUID, const OFBool check=OFTrue)
| set SOP class UID value. More...
OFCondition | setSOPClassUID (const DcmElement &delem, const unsigned long pos=0, const OFBool check=OFTrue)
| set SOP class UID value from element. More...
OFCondition | setSOPClassUID (DcmItem &dataset, const DcmTagKey &tagKey, const unsigned long pos=0, const OFBool check=OFTrue)
| set SOP class UID value from dataset. More...
OFCondition | setSOPInstanceUID (const OFString &sopInstanceUID, const OFBool check=OFTrue)
| set SOP instance UID value. More...
OFCondition | setSOPInstanceUID (const DcmElement &delem, const unsigned long pos=0, const OFBool check=OFTrue)
| set SOP instance UID value from element. More...
OFCondition | setSOPInstanceUID (DcmItem &dataset, const DcmTagKey &tagKey, const unsigned long pos=0, const OFBool check=OFTrue)
| set SOP instance UID value from dataset. More...

## Protected Member Functions
DSRCompositeReferenceValue * | getValuePtr ()
| get pointer to reference value More...
virtual OFCondition | readItem (DcmItem &dataset, const size_t flags)
| read reference value from dataset More...
virtual OFCondition | writeItem (DcmItem &dataset) const
| write reference value to dataset More...
virtual OFCondition | checkSOPClassUID (const OFString &sopClassUID, const OFBool reportWarnings=OFFalse) const
| check the specified SOP class UID for validity. More...
virtual OFCondition | checkSOPInstanceUID (const OFString &sopInstanceUID, const OFBool reportWarnings=OFFalse) const
| check the specified SOP instance UID for validity. More...
OFCondition | checkCurrentValue (const OFBool reportWarnings=OFFalse) const
| check the currently stored reference value for validity. More...

## Protected Attributes
OFString | SOPClassUID
| reference SOP class UID (VR=UI, type 1)
OFString | SOPInstanceUID
| reference SOP instance UID (VR=UI, type 1)

## Friends
class | DSRContentItem

## Detailed Description

Class for composite reference values.

## Constructor & Destructor Documentation

## ◆ DSRCompositeReferenceValue() [1/2]

DSRCompositeReferenceValue::DSRCompositeReferenceValue | ( | const OFString & | sopClassUID,
|  | const OFString & | sopInstanceUID,
|  | const OFBool | check = `OFTrue`
| ) |  |

constructor

Parameters

  sopClassUID | referenced SOP class UID of the composite object. (VR=UI, mandatory)
  sopInstanceUID | referenced SOP instance UID of the composite object. (VR=UI, mandatory)
  check | if enabled, check 'sopClassUID' and 'sopInstanceUID' for validity before setting them. See checkXXX() for details. Empty values are never accepted.

## ◆ DSRCompositeReferenceValue() [2/2]

DSRCompositeReferenceValue::DSRCompositeReferenceValue | ( | const DSRCompositeReferenceValue & | referenceValue | ) |

copy constructor

Parameters

  referenceValue | reference value to be copied (not checked !)

## Member Function Documentation

## ◆ checkCurrentValue()

OFCondition DSRCompositeReferenceValue::checkCurrentValue | ( | const OFBool | reportWarnings = `OFFalse` | ) | const
| protected

check the currently stored reference value for validity.

See above checkXXX() methods for details.

Parameters

  reportWarnings | if enabled, report a warning message on each deviation from an expected value to the logger

Returns
  status, EC_Normal if current value is valid, an error code otherwise

## ◆ checkSOPClassUID()

virtual OFCondition DSRCompositeReferenceValue::checkSOPClassUID | ( | const OFString & | sopClassUID,
|  | const OFBool | reportWarnings = `OFFalse`
| ) |  | const
| protected virtual

check the specified SOP class UID for validity.

The only checks performed are that the UID is non-empty and that it conforms to the corresponding VR (UI) and VM (1). Derived classes should overwrite this method for more specific tests (e.g. allowing only particular SOP classes).

Parameters

  sopClassUID | SOP class UID to be checked
  reportWarnings | if enabled, report warning messages to the logger

Returns
  status, EC_Normal if value is valid, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, and DSRImageReferenceValue.

## ◆ checkSOPInstanceUID()

virtual OFCondition DSRCompositeReferenceValue::checkSOPInstanceUID | ( | const OFString & | sopInstanceUID,
|  | const OFBool | reportWarnings = `OFFalse`
| ) |  | const
| protected virtual

check the specified SOP instance UID for validity.

The only checks performed are that the UID is non-empty and that it conforms to the corresponding VR (UI) and VM (1). Derived classes should overwrite this method for more specific tests.

Parameters

  sopInstanceUID | SOP instance UID to be checked
  reportWarnings | if enabled, report warning messages to the logger

Returns
  status, EC_Normal if value is valid, an error code otherwise

## ◆ clear()

virtual void DSRCompositeReferenceValue::clear | ( |  | ) |
| virtual

clear all internal variables.

Since an empty reference value is invalid the reference becomes invalid afterwards.

Reimplemented in DSRWaveformReferenceValue, DSRWaveformTreeNode, DSRImageReferenceValue, DSRImageTreeNode, and DSRCompositeTreeNode.

## ◆ getSOPClassName()

const OFString DSRCompositeReferenceValue::getSOPClassName | ( | const OFString & | defaultName = `"unknown SOP Class UID"` | ) | const

get name associated with the SOP class UID (if any)

Parameters

  defaultName | string value that is returned if the SOP class UID is unknown

Returns
  name associated with the current SOP class UID (might be empty, e.g. in case the SOP class UID is empty or 'defaultName' is an empty string)

## ◆ getSOPClassUID()

const OFString& DSRCompositeReferenceValue::getSOPClassUID | ( |  | ) | const
| inline

get SOP class UID

Returns
  current SOP class UID (might be invalid or an empty string)

## ◆ getSOPInstanceUID()

const OFString& DSRCompositeReferenceValue::getSOPInstanceUID | ( |  | ) | const
| inline

get SOP instance UID

Returns
  current SOP instance UID (might be invalid or an empty string)

## ◆ getValue() [1/2]

const DSRCompositeReferenceValue& DSRCompositeReferenceValue::getValue | ( |  | ) | const
| inline

get reference to composite reference value

Returns
  reference to composite reference value

## ◆ getValue() [2/2]

OFCondition DSRCompositeReferenceValue::getValue | ( | DSRCompositeReferenceValue & | referenceValue | ) | const

get copy of composite reference value

Parameters

  referenceValue | reference to variable in which the value should be stored

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ getValuePtr()

DSRCompositeReferenceValue* DSRCompositeReferenceValue::getValuePtr | ( |  | ) |
| inline protected

get pointer to reference value

Returns
  pointer to reference value (never NULL)

## ◆ isComplete()

virtual OFBool DSRCompositeReferenceValue::isComplete | ( |  | ) | const
| virtual

check whether the current reference value is complete, i.e. whether both mandatory UIDs are non-empty.

This is just a basic check that might be useful for "validating" input data. See isValid() for a more sophisticated way of checking the current reference value.

Returns
  OFTrue if value is complete, OFFalse otherwise

## ◆ isEmpty()

virtual OFBool DSRCompositeReferenceValue::isEmpty | ( |  | ) | const
| virtual

check whether the current reference value is empty.

Checks whether both mandatory UIDs of the reference value are empty.

Returns
  OFTrue if value is empty, OFFalse otherwise

## ◆ isEqual()

OFBool DSRCompositeReferenceValue::isEqual | ( | const DSRCompositeReferenceValue & | referenceValue | ) | const

check whether values are "equal"

Parameters

  referenceValue | reference value that should be compared to the current one

Returns
  OFTrue if both composite reference values are equal, OFFalse otherwise

## ◆ isNotEqual()

OFBool DSRCompositeReferenceValue::isNotEqual | ( | const DSRCompositeReferenceValue & | referenceValue | ) | const

check whether values are "not equal"

Parameters

  referenceValue | reference value that should be compared to the current one

Returns
  OFTrue if both composite reference values are not equal, OFFalse otherwise

## ◆ isValid()

virtual OFBool DSRCompositeReferenceValue::isValid | ( |  | ) | const
| virtual

check whether the current reference value is valid.

The reference value is valid if SOP class UID and SOP instance UID are valid. See checkSOPClassUID() and checkSOPInstanceUID() methods for details.

Returns
  OFTrue if reference value is valid, OFFalse otherwise

Reimplemented in DSRWaveformTreeNode, DSRImageReferenceValue, DSRImageTreeNode, and DSRCompositeTreeNode.

## ◆ operator=()

DSRCompositeReferenceValue& DSRCompositeReferenceValue::operator= | ( | const DSRCompositeReferenceValue & | referenceValue | ) |

assignment operator

Parameters

  referenceValue | reference value to be copied (not checked !)

Returns
  reference to this reference value after 'referenceValue' has been copied

## ◆ print()

virtual OFCondition DSRCompositeReferenceValue::print | ( | STD_NAMESPACE ostream & | stream,
|  | const size_t | flags
| ) |  | const
| virtual

print reference value.

The output of a typical composite reference value looks like this: (BasicTextSR,"1.2.3"). If the SOP class UID is unknown, the UID is printed instead of the related name.

Parameters

  stream | output stream to which the reference value should be printed
  flags | flag used to customize the output (see DSRTypes::PF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, DSRWaveformTreeNode, DSRImageReferenceValue, DSRImageTreeNode, and DSRCompositeTreeNode.

## ◆ readItem()

virtual OFCondition DSRCompositeReferenceValue::readItem | ( | DcmItem & | dataset,
|  | const size_t | flags
| ) |  |
| protected virtual

read reference value from dataset

Parameters

  dataset | DICOM dataset from which the value should be read
  flags | flag used to customize the reading process (see DSRTypes::RF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, and DSRImageReferenceValue.

## ◆ readSequence()

virtual OFCondition DSRCompositeReferenceValue::readSequence | ( | DcmItem & | dataset,
|  | const DcmTagKey & | tagKey,
|  | const OFString & | type,
|  | const size_t | flags
| ) |  |
| virtual

read referenced SOP sequence from dataset.

The number of items within the sequence is checked. If error/warning output are enabled, a warning message is printed if the sequence is absent or contains more than one item.

Parameters

  dataset | DICOM dataset from which the sequence should be read
  tagKey | DICOM tag specifying the attribute (= sequence) that should be read
  type | value type of the sequence (valid value: "1", "2", something else) This parameter is used for checking purpose, any difference is reported.
  flags | flag used to customize the reading process (see DSRTypes::RF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readXML()

virtual OFCondition DSRCompositeReferenceValue::readXML | ( | const DSRXMLDocument & | doc,
|  | DSRXMLCursor | cursor,
|  | const size_t | flags
| ) |  |
| virtual

read reference value from XML document

Parameters

  doc | document containing the XML file content
  cursor | cursor pointing to the starting node
  flags | flag used to customize the reading process (see DSRTypes::XF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, and DSRImageReferenceValue.

## ◆ renderHTML()

virtual OFCondition DSRCompositeReferenceValue::renderHTML | ( | STD_NAMESPACE ostream & | docStream,
|  | STD_NAMESPACE ostream & | annexStream,
|  | size_t & | annexNumber,
|  | const size_t | flags,
|  | const char * | urlPrefix = `NULL`
| ) |  | const
| virtual

render composite reference value in HTML/XHTML format

Parameters

  docStream | output stream to which the main HTML/XHTML document is written
  annexStream | output stream to which the HTML/XHTML document annex is written
  annexNumber | reference to the variable where the current annex number is stored. Value is increased automatically by 1 after a new entry has been added.
  flags | flag used to customize the output (see DSRTypes::HF_xxx)
  urlPrefix | optional URL prefix used for hyperlink to referenced composite object

Note
  Please note that using parameter 'urlPrefix' can lead to security issues, as an attacker could misuse it to potentially inject dangerous content into the HTML/XHTML output. The value of this parameter is not checked. This is also true for derived classes.

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, and DSRImageReferenceValue.

## ◆ setReference() [1/2]

OFCondition DSRCompositeReferenceValue::setReference | ( | const OFString & | sopClassUID,
|  | const OFString & | sopInstanceUID,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP class UID and SOP instance UID value.

Before setting the values, they are usually checked. If the value pair is invalid the current value pair is not replaced and remains unchanged.

Parameters

  sopClassUID | referenced SOP class UID to be set. (VR=UI, mandatory)
  sopInstanceUID | referenced SOP instance UID to be set. (VR=UI, mandatory)
  check | if enabled, check 'sopClassUID' and 'sopInstanceUID' for validity before setting them. See checkXXX() for details. Empty values are never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setReference() [2/2]

OFCondition DSRCompositeReferenceValue::setReference | ( | DcmItem & | dataset,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP class UID and SOP instance UID value from dataset.

Internally, the methods setSOPClassUID() and setSOPInstanceUID() are called with the given 'dataset' and the tags DCM_SOPClassUID and DCM_SOPInstanceUID, respectively. I.e., the SOP class UID might be set even if the SOP instance UID value is invalid.

Parameters

  dataset | DICOM dataset from which the UID values should be retrieved
  check | if enabled, check retrieved UID values for validity before setting them. See checkXXX() for details. Empty values are never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPClassUID() [1/3]

OFCondition DSRCompositeReferenceValue::setSOPClassUID | ( | const DcmElement & | delem,
|  | const unsigned long | pos = `0`,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP class UID value from element.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  delem | DICOM element from which the UID value should be retrieved
  pos | index of the value in case of multi-valued elements (0..vm-1)
  check | if enabled, check UID value for validity before setting it. See checkSOPClassUID() for details. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPClassUID() [2/3]

OFCondition DSRCompositeReferenceValue::setSOPClassUID | ( | const OFString & | sopClassUID,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP class UID value.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  sopClassUID | SOP class UID to be set
  check | if enabled, check 'sopClassUID' for validity before setting it. See checkSOPClassUID() for details. Am empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPClassUID() [3/3]

OFCondition DSRCompositeReferenceValue::setSOPClassUID | ( | DcmItem & | dataset,
|  | const DcmTagKey & | tagKey,
|  | const unsigned long | pos = `0`,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP class UID value from dataset.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  dataset | DICOM dataset from which the UID value should be retrieved
  tagKey | DICOM tag specifying the attribute from which the value should be retrieved. The search is limited to the top-level of the dataset.
  pos | index of the value in case of multi-valued elements (0..vm-1)
  check | if enabled, check UID value for validity before setting it. See checkSOPClassUID() for details. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPInstanceUID() [1/3]

OFCondition DSRCompositeReferenceValue::setSOPInstanceUID | ( | const DcmElement & | delem,
|  | const unsigned long | pos = `0`,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP instance UID value from element.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  delem | DICOM element from which the UID value should be retrieved
  pos | index of the value in case of multi-valued elements (0..vm-1)
  check | if enabled, check UID value for validity before setting it. See checkSOPInstanceUID() for details. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPInstanceUID() [2/3]

OFCondition DSRCompositeReferenceValue::setSOPInstanceUID | ( | const OFString & | sopInstanceUID,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP instance UID value.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  sopInstanceUID | SOP instance UID to be set
  check | if enabled, check 'sopInstanceUID' for validity before setting it. See checkSOPInstanceUID() for details. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setSOPInstanceUID() [3/3]

OFCondition DSRCompositeReferenceValue::setSOPInstanceUID | ( | DcmItem & | dataset,
|  | const DcmTagKey & | tagKey,
|  | const unsigned long | pos = `0`,
|  | const OFBool | check = `OFTrue`
| ) |  |

set SOP instance UID value from dataset.

Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  dataset | DICOM dataset from which the UID value should be retrieved
  tagKey | DICOM tag specifying the attribute from which the value should be retrieved. The search is limited to the top-level of the dataset.
  pos | index of the value in case of multi-valued elements (0..vm-1)
  check | if enabled, check UID value for validity before setting it. See checkSOPInstanceUID() for details. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setValue()

OFCondition DSRCompositeReferenceValue::setValue | ( | const DSRCompositeReferenceValue & | referenceValue,
|  | const OFBool | check = `OFTrue`
| ) |  |

set composite reference value.

Before setting the reference, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.

Parameters

  referenceValue | value to be set
  check | if enabled, check value for validity before setting it. See checkXXX() for details. Empty values are never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ writeItem()

virtual OFCondition DSRCompositeReferenceValue::writeItem | ( | DcmItem & | dataset | ) | const
| protected virtual

write reference value to dataset

Parameters

  dataset | DICOM dataset to which the value should be written

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, and DSRImageReferenceValue.

## ◆ writeSequence()

virtual OFCondition DSRCompositeReferenceValue::writeSequence | ( | DcmItem & | dataset,
|  | const DcmTagKey & | tagKey
| ) |  | const
| virtual

write referenced SOP sequence to dataset.

If the value is empty an empty sequence (without any items) is written.

Parameters

  dataset | DICOM dataset to which the sequence should be written
  tagKey | DICOM tag specifying the attribute (= sequence) that should be written

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ writeXML()

virtual OFCondition DSRCompositeReferenceValue::writeXML | ( | STD_NAMESPACE ostream & | stream,
|  | const size_t | flags
| ) |  | const
| virtual

write reference value in XML format

Parameters

  stream | output stream to which the XML document is written
  flags | flag used to customize the output (see DSRTypes::XF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRWaveformReferenceValue, DSRWaveformTreeNode, DSRImageReferenceValue, DSRImageTreeNode, and DSRCompositeTreeNode.

The documentation for this class was generated from the following file:

- dcmsr/include/dcmtk/dcmsr/dsrcomvl.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1