DCMTK: DSRCodedEntryValue Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | Friends | List of all members
DSRCodedEntryValue Class Reference

Class for handling coded entry values, i.e. unambiguous machine-readable codes. More...

Inheritance diagram for DSRCodedEntryValue:

## Public Member Functions
| DSRCodedEntryValue ()
| default constructor
| DSRCodedEntryValue (const DSRBasicCodedEntry &basicCodedEntry, const OFBool check=OFFalse)
| constructor.
| DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning, const DSRTypes::E_CodeValueType codeValueType=DSRTypes::CVT_auto, const OFExplicitBool check=OFTrue)
| constructor.
| DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning, const DSRTypes::E_CodeValueType codeValueType=DSRTypes::CVT_auto, const OFBool check=OFTrue)
| constructor.
| DSRCodedEntryValue (const DSRCodedEntryValue &codedEntryValue)
| copy constructor
virtual | ~DSRCodedEntryValue ()
| destructor
DSRCodedEntryValue & | operator= (const DSRCodedEntryValue &codedEntryValue)
| assignment operator
virtual void | clear ()
| clear all internal variables.
OFBool | isEqual (const DSRCodedEntryValue &codedEntryValue) const
| check whether codes are "equal".
OFBool | isNotEqual (const DSRCodedEntryValue &codedEntryValue) const
| check whether codes are "not equal".
OFBool | isEqual (const DSRBasicCodedEntry &basicCodedEntry) const
| check whether codes are "equal".
OFBool | isNotEqual (const DSRBasicCodedEntry &basicCodedEntry) const
| check whether codes are "not equal".
virtual OFBool | isValid () const
| check whether the current code is valid.
virtual OFBool | isEmpty () const
| check whether the current code is empty, i.e. whether all four components of the code ("Basic Coded Entry Attributes") are empty.
virtual OFBool | isComplete () const
| check whether the current code is complete, i.e. whether the three (two for URN code value) mandatory components of the code are non-empty.
void | print (STD_NAMESPACE ostream &stream, const OFBool printCodeValue=OFTrue, const size_t flags=0) const
| print code.
OFCondition | readSequence (DcmItem &dataset, const DcmTagKey &tagKey, const OFString &type, const size_t flags=0, const OFString &vm="1")
| read code sequence from dataset.
OFCondition | readSequenceItem (DcmItem &item, const DcmTagKey &tagKey, const size_t flags=0)
| read code from sequence item
OFCondition | writeSequence (DcmItem &dataset, const DcmTagKey &tagKey) const
| write code sequence to dataset
OFCondition | writeSequenceItem (DcmItem &item, const DcmTagKey &tagKey) const
| write code to sequence item
OFCondition | readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor, const size_t flags)
| read code from XML document.
OFCondition | writeXML (STD_NAMESPACE ostream &stream, const size_t flags) const
| write code in XML format.
OFCondition | renderHTML (STD_NAMESPACE ostream &stream, const size_t flags, const OFBool fullCode=OFTrue, const OFBool valueFirst=OFFalse) const
| render code in HTML/XHTML format.
const DSRCodedEntryValue & | getValue () const
| get reference to the code
OFCondition | getValue (DSRCodedEntryValue &codedEntryValue) const
| get copy of the code
const OFString & | getCodeValue () const
| get code value.
DSRTypes::E_CodeValueType | getCodeValueType () const
| get type of code value, i.e. short, long or Uniform Resource Name (URN).
const OFString & | getCodingSchemeDesignator () const
| get coding scheme designator.
const OFString & | getCodingSchemeVersion () const
| get coding scheme version.
const OFString & | getCodeMeaning () const
| get code meaning.
const OFString & | getContextIdentifier () const
| get context identifier.
const OFString & | getContextUID () const
| get context UID.
const OFString & | getMappingResource () const
| get mapping resource.
const OFString & | getContextGroupVersion () const
| get context group version.
const OFString & | getContextGroupLocalVersion () const
| get context group local version.
const OFString & | getContextGroupExtensionCreatorUID () const
| get context group extension creator UID.
OFCondition | setValue (const DSRCodedEntryValue &codedEntryValue, const OFBool check=OFTrue)
| set code.
OFCondition | setCode (const DSRBasicCodedEntry &basicCodedEntry, const OFBool check=OFFalse)
| set code.
OFCondition | setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning, const DSRTypes::E_CodeValueType codeValueType=DSRTypes::CVT_auto, const OFExplicitBool check=OFTrue)
| set code.
OFCondition | setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning, const DSRTypes::E_CodeValueType codeValueType=DSRTypes::CVT_auto, const OFBool check=OFTrue)
| set code.
OFBool | usesEnhancedEncodingMode () const
| check whether the "Enhanced Encoding Mode" is used for this code.
void | removeEnhancedEncodingMode ()
| remove the "Enhanced Encoding Mode" from this code.
OFCondition | setEnhancedEncodingMode (const OFString &contextUID, const OFBool check=OFTrue)
| specify the "Enhanced Encoding Mode" for this code.
OFCondition | setEnhancedEncodingMode (const OFString &contextIdentifier, const OFString &mappingResource, const OFString &contextGroupVersion, const OFString &contextUID="", const OFString &localVersion="", const OFString &extensionCreatorUID="", const OFBool check=OFTrue)
| specify the "Enhanced Encoding Mode" for this code.
OFCondition | checkCurrentValue () const
| check the currently stored code for validity.

## Protected Member Functions
DSRCodedEntryValue * | getValuePtr ()
| get pointer to this code
OFCondition | readItem (DcmItem &dataset, const char *moduleName, const size_t flags)
| read code from dataset.
OFCondition | writeItem (DcmItem &dataset) const
| write code to dataset.

## Static Protected Member Functions
static OFCondition | checkCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning, const DSRTypes::E_CodeValueType codeValueType)
| check the specified code for validity.
static DSRTypes::E_CodeValueType | determineCodeValueType (const OFString &codeValue)
| try to determine the type of the given code value.

## Private Attributes
DSRTypes::E_CodeValueType | CodeValueType
| type of 'CodeValue': short (SH), long (UC) or Uniform Resource Name (UR)
OFString | CodeValue
| Code Value (VR=SH/UC/UR, type 1)
OFString | CodingSchemeDesignator
| Coding Scheme Designator (VR=SH, type 1C)
OFString | CodingSchemeVersion
| Coding Scheme Version (VR=SH, type 1C)
OFString | CodeMeaning
| Code Meaning (VR=LO, type 1)
OFString | ContextIdentifier
| tbd: Equivalent Code Sequence (VR=SQ, type 3) not yet supported
OFString | ContextUID
| Context UID (VR=UI, type 2)
OFString | MappingResource
| Mapping Resource (VR=CS, type 1C)
OFString | ContextGroupVersion
| Mapping Resource UID (VR=UI, type 3)
OFString | ContextGroupLocalVersion
| Context Group Local Version (VR=DT, type 1C)
OFString | ContextGroupExtensionCreatorUID
| Context Group Extension Creator UID (VR=UI, type 1C)

## Friends
class | DSRContentItem

## Detailed Description

Class for handling coded entry values, i.e. unambiguous machine-readable codes.

This class supports both the "Basic Coded Entry Attributes" and the "Enhanced Encoding Mode". There are also some basic checks that make sure that a given code is valid.

## Constructor & Destructor Documentation

## ◆ DSRCodedEntryValue() [1/4]

DSRCodedEntryValue::DSRCodedEntryValue | ( | const DSRBasicCodedEntry & | basicCodedEntry,
|  | const OFBool | check = OFFalse )

constructor.

To be used for code constants defined by an instance of the DSRBasicCodedEntry class.

Parameters

  basicCodedEntry | code to be set, defined by its "Basic Coded Entry Attributes"
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are never accepted.

## ◆ DSRCodedEntryValue() [2/4]

DSRCodedEntryValue::DSRCodedEntryValue | ( | const OFString & | codeValue,
|  | const OFString & | codingSchemeDesignator,
|  | const OFString & | codeMeaning,
|  | const DSRTypes::E_CodeValueType | codeValueType = DSRTypes::CVT_auto,
|  | const OFExplicitBool | check = OFTrue )

constructor.

To be used when the code to be set consists of three values (code value, coding scheme designator and code meaning).

Parameters

  codeValue | identifier of the code to be set that is unambiguous within the coding scheme. (VR=SH/UC/UR, mandatory)
  codingSchemeDesignator | identifier of the coding scheme in which the code for a term is defined. (VR=SH, conditional)
  codeMeaning | human-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
  codeValueType | type of 'codeValue' (short, long or URN) used to map the value to the correct DICOM value representation (VR). By default, the type is determined automatically (see determineCodeValueType()).
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are never accepted.

References DSRTypes::CVT_auto.

## ◆ DSRCodedEntryValue() [3/4]

DSRCodedEntryValue::DSRCodedEntryValue | ( | const OFString & | codeValue,
|  | const OFString & | codingSchemeDesignator,
|  | const OFString & | codingSchemeVersion,
|  | const OFString & | codeMeaning,
|  | const DSRTypes::E_CodeValueType | codeValueType = DSRTypes::CVT_auto,
|  | const OFBool | check = OFTrue )

constructor.

To be used when the code to be set consists of four values (code value, coding scheme designator, coding scheme version and code meaning).

Parameters

  codeValue | identifier of the code to be set that is unambiguous within the coding scheme. (VR=SH/UC/UR, mandatory)
  codingSchemeDesignator | identifier of the coding scheme in which the code for a term is defined. (VR=SH, conditional)
  codingSchemeVersion | version of the coding scheme. May be used to identify the version of a coding scheme if necessary to resolve ambiguity in the 'codeValue' or 'codeMeaning'. (VR=SH, optional)
  codeMeaning | human-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
  codeValueType | type of 'codeValue' (short, long or URN) used to map the value to the correct DICOM value representation (VR). By default, the type is determined automatically (see determineCodeValueType()).
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are only accepted for non-mandatory attributes.

References DSRTypes::CVT_auto.

## ◆ DSRCodedEntryValue() [4/4]

DSRCodedEntryValue::DSRCodedEntryValue | ( | const DSRCodedEntryValue & | codedEntryValue | ) |

copy constructor

Parameters

  codedEntryValue | code to be copied (not checked !)

References DSRCodedEntryValue().

## Member Function Documentation

## ◆ checkCode()

static OFCondition DSRCodedEntryValue::checkCode | ( | const OFString & | codeValue,
|  | const OFString & | codingSchemeDesignator,
|  | const OFString & | codingSchemeVersion,
|  | const OFString & | codeMeaning,
|  | const DSRTypes::E_CodeValueType | codeValueType )
| staticprotected

check the specified code for validity.

Currently, the only checks performed are that the three (two for URN code value) mandatory string values are non-empty and that all four values conform to the corresponding VR and VM. Later on, it might also be checked whether the specified code really belongs to the coding scheme, etc. This requires the presence of the relevant code dictionaries, though.

Parameters

  codeValue | code value to be checked
  codingSchemeDesignator | coding scheme designator to be checked
  codingSchemeVersion | coding scheme version to be checked (might be empty)
  codeMeaning | code meaning to be checked
  codeValueType | type of 'codeValue' (short, long or URN). Never use DSRTypes::CVT_auto for this function.

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

## ◆ checkCurrentValue()

OFCondition DSRCodedEntryValue::checkCurrentValue | ( |  | ) | const

check the currently stored code for validity.

See below checkCode() method for details.

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

## ◆ clear()

virtual void DSRCodedEntryValue::clear | ( |  | ) |
| virtual

clear all internal variables.

Since an empty code is invalid the code becomes invalid afterwards.

Reimplemented in DSRCodeTreeNode.

## ◆ determineCodeValueType()

static DSRTypes::E_CodeValueType DSRCodedEntryValue::determineCodeValueType | ( | const OFString & | codeValue | ) |
| staticprotected

try to determine the type of the given code value.

Please note that the check that is currently performed is very simple. So, the user is advised to passed the correct type (short, long or URN) to the appropriate method and should not rely on this automatic detection. Specifically, URN values are only detected by the prefix "urn:" or by the substring "://". The maximum length of a short code value is determined based on the number of bytes (not characters, since the character set is unknown to this function - and to this class).

Parameters

  codeValue | code value to be checked

Returns
  automatically determined type that should be used for the given code value

## ◆ getCodeMeaning()

const OFString & DSRCodedEntryValue::getCodeMeaning | ( |  | ) | const
| inline

get code meaning.

Human-readable translation of the code value. Can be used for display when code dictionary is not available.

Returns
  current code meaning (might be invalid or an empty string)

References CodeMeaning.

## ◆ getCodeValue()

const OFString & DSRCodedEntryValue::getCodeValue | ( |  | ) | const
| inline

get code value.

This is an identifier of the code that is unambiguous within the coding scheme.

Returns
  current code value (might be invalid or an empty string)

References CodeValue.

## ◆ getCodeValueType()

DSRTypes::E_CodeValueType DSRCodedEntryValue::getCodeValueType | ( |  | ) | const
| inline

get type of code value, i.e. short, long or Uniform Resource Name (URN).

The type is used to map the value to the correct DICOM value representation (VR).

Returns
  type of code value. Should never be DSRTypes::CVT_auto for non-empty value.

References CodeValueType.

## ◆ getCodingSchemeDesignator()

const OFString & DSRCodedEntryValue::getCodingSchemeDesignator | ( |  | ) | const
| inline

get coding scheme designator.

This is an identifier of the coding scheme in which the code for a term is defined. Designators beginning with "99" and the designator "L" are defined to be private or local coding schemes. More details on the coding scheme might be retrieved via the DSRDocument::getCodingSchemeIdentification() method.

Returns
  current coding scheme designator (might be invalid or an empty string)

References CodingSchemeDesignator.

## ◆ getCodingSchemeVersion()

const OFString & DSRCodedEntryValue::getCodingSchemeVersion | ( |  | ) | const
| inline

get coding scheme version.

Optional - May be used to identify the version of a coding scheme if necessary to resolve ambiguity in the code value or code meaning. Coding scheme version is not required for backward-compatible revisions of a coding scheme.

Returns
  current coding scheme version (might be invalid or an empty string)

References CodingSchemeVersion.

## ◆ getContextGroupExtensionCreatorUID()

const OFString & DSRCodedEntryValue::getContextGroupExtensionCreatorUID | ( |  | ) | const
| inline

get context group extension creator UID.

Optional - Identifies the person or organization who created the extension to the context group. This attribute is part of the "Enhanced Encoding Mode".

Returns
  current context group extension creator UID (might be invalid or an empty string)

References ContextGroupExtensionCreatorUID.

## ◆ getContextGroupLocalVersion()

const OFString & DSRCodedEntryValue::getContextGroupLocalVersion | ( |  | ) | const
| inline

get context group local version.

Optional - Implementation-specific version of a context group that contains private extensions. This attribute is part of the "Enhanced Encoding Mode".

Returns
  current context group local version (might be invalid or an empty string)

References ContextGroupLocalVersion.

## ◆ getContextGroupVersion()

const OFString & DSRCodedEntryValue::getContextGroupVersion | ( |  | ) | const
| inline

get context group version.

Optional - Version of the context group. This attribute is part of the "Enhanced Encoding Mode".

Returns
  current context group version (might be invalid or an empty string)

References ContextGroupVersion.

## ◆ getContextIdentifier()

const OFString & DSRCodedEntryValue::getContextIdentifier | ( |  | ) | const
| inline

get context identifier.

Optional - Identifier of the context group defined by a mapping resource from which the code was selected, or to which the code has been added as a private context group extension. This attribute is part of the "Enhanced Encoding Mode".

Returns
  current context identifier (might be invalid or an empty string)

References ContextIdentifier.

## ◆ getContextUID()

const OFString & DSRCodedEntryValue::getContextUID | ( |  | ) | const
| inline

get context UID.

Optional - Uniquely identifies the context group. This attribute is part of the "Enhanced Encoding Mode".

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

References ContextUID.

## ◆ getMappingResource()

const OFString & DSRCodedEntryValue::getMappingResource | ( |  | ) | const
| inline

get mapping resource.

Optional - Message/Terminology mapping resource that specifies the context group with the given identifier. This attribute is part of the "Enhanced Encoding Mode".

Returns
  current mapping resource (might be invalid or an empty string)

References MappingResource.

## ◆ getValue() [1/2]

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

get reference to the code

Returns
  reference to the code

References DSRCodedEntryValue().

## ◆ getValue() [2/2]

OFCondition DSRCodedEntryValue::getValue | ( | DSRCodedEntryValue & | codedEntryValue | ) | const

get copy of the code

Parameters

  codedEntryValue | reference to variable in which the code should be stored

Returns
  status, EC_Normal if successful, an error code otherwise

References DSRCodedEntryValue().

## ◆ getValuePtr()

DSRCodedEntryValue * DSRCodedEntryValue::getValuePtr | ( |  | ) |
| inlineprotected

get pointer to this code

Returns
  pointer to this code (never NULL)

References DSRCodedEntryValue().

## ◆ isComplete()

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

check whether the current code is complete, i.e. whether the three (two for URN code value) mandatory components of the code 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 code.

Returns
  OFTrue if code is complete, OFFalse otherwise

## ◆ isEmpty()

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

check whether the current code is empty, i.e. whether all four components of the code ("Basic Coded Entry Attributes") are empty.

Returns
  OFTrue if code is empty, OFFalse otherwise

## ◆ isEqual() [1/2]

OFBool DSRCodedEntryValue::isEqual | ( | const DSRBasicCodedEntry & | basicCodedEntry | ) | const

check whether codes are "equal".

Two codes are equal if the code value, the coding scheme designator and the (optional) coding scheme version are equal. The code meaning is not used for this check.

Parameters

  basicCodedEntry | code that should be compared to the current one

Returns
  OFTrue if both codes are equal, OFFalse otherwise

## ◆ isEqual() [2/2]

OFBool DSRCodedEntryValue::isEqual | ( | const DSRCodedEntryValue & | codedEntryValue | ) | const

check whether codes are "equal".

Two codes are equal if the code value, the coding scheme designator and the (optional) coding scheme version are equal. The code meaning or attributes from the "Enhanced Encoding Mode" are not used for this check.

Parameters

  codedEntryValue | code that should be compared to the current one

Returns
  OFTrue if both codes are equal, OFFalse otherwise

References DSRCodedEntryValue().

## ◆ isNotEqual() [1/2]

OFBool DSRCodedEntryValue::isNotEqual | ( | const DSRBasicCodedEntry & | basicCodedEntry | ) | const

check whether codes are "not equal".

Two codes are not equal if either the code value or the coding scheme designator or the (optional) coding scheme version are not equal. The code meaning is not used for this check.

Parameters

  basicCodedEntry | code that should be compared to the current one

Returns
  OFTrue if both codes are not equal, OFFalse otherwise

## ◆ isNotEqual() [2/2]

OFBool DSRCodedEntryValue::isNotEqual | ( | const DSRCodedEntryValue & | codedEntryValue | ) | const

check whether codes are "not equal".

Two codes are not equal if either the code value or the coding scheme designator or the (optional) coding scheme version are not equal. The code meaning is not used for this check.

Parameters

  codedEntryValue | code that should be compared to the current one

Returns
  OFTrue if both codes are not equal, OFFalse otherwise

References DSRCodedEntryValue().

## ◆ isValid()

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

check whether the current code is valid.

This check only covers the "Basic Coded Entry Attributes". An empty code is not valid. See checkCode() for details.

Returns
  OFTrue if code is valid, OFFalse otherwise

Reimplemented in DSRCodeTreeNode.

## ◆ operator=()

DSRCodedEntryValue & DSRCodedEntryValue::operator= | ( | const DSRCodedEntryValue & | codedEntryValue | ) |

assignment operator

Parameters

  codedEntryValue | code to be copied (not checked !)

Returns
  reference to this code after 'codedEntryValue' has been copied

References DSRCodedEntryValue().

## ◆ print()

void DSRCodedEntryValue::print | ( | STD_NAMESPACE ostream & | stream,
|  | const OFBool | printCodeValue = OFTrue,
|  | const size_t | flags = 0 ) const

print code.

The output of a typical code triple looks like this: (1234,99_OFFIS_DCMTK,"Code Meaning"). The optional coding scheme version is printed in square brackets directly after the coding scheme designator, e.g.: (cm,UCUM[1.4],"centimeter"). Please note that only the "Basic Coded Entry Attributes" are supported by this method.

Parameters

  stream | output stream to which the code should be printed
  printCodeValue | flag indicating whether the code value and coding scheme designator should be printed (default) or not. If OFFalse, the output looks like this: (,,"Code Meaning")
  flags | flag used to customize the output (see DSRTypes::PF_xxx)

## ◆ readItem()

OFCondition DSRCodedEntryValue::readItem | ( | DcmItem & | dataset,
|  | const char * | moduleName,
|  | const size_t | flags )
| protected

read code from dataset.

This method also supports the attributes from the "Enhanced Encoding Mode".

Parameters

  dataset | DICOM dataset from which the code should be read
  moduleName | module name (sequence) from which the item is read. If NULL, the default value "SR document" is used for output messages.
  flags | flag used to customize the reading process (see DSRTypes::RF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readSequence()

OFCondition DSRCodedEntryValue::readSequence | ( | DcmItem & | dataset,
|  | const DcmTagKey & | tagKey,
|  | const OFString & | type,
|  | const size_t | flags = 0,
|  | const OFString & | vm = "1" )

read code sequence from dataset.

The number of items within the code sequence is checked. If error/warning output are enabled, a warning message is printed if the sequence is empty or contains more items than specified in the 'vm ' parameter (1 by default, which applies to most use cases). However, this method always reads the first item from the given sequence. If another item should be read (e.g. a modifier), the method readSequenceItem() should be used.

Parameters

  dataset | DICOM dataset from which the code 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 | optional flag used to customize the reading process (see DSRTypes::RF_xxx)
  vm | value multiplicity to be checked, interpreted as cardinality (number of items). See DcmElement::checkVM() for a list of valid values.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readSequenceItem()

OFCondition DSRCodedEntryValue::readSequenceItem | ( | DcmItem & | item,
|  | const DcmTagKey & | tagKey,
|  | const size_t | flags = 0 )

read code from sequence item

Parameters

  item | DICOM sequence item from which the code should be read
  tagKey | DICOM tag specifying the sequence in which this item is contained
  flags | flag used to customize the reading process (see DSRTypes::RF_xxx)

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readXML()

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

read code from XML document.

Please note that only the "Basic Coded Entry Attributes" are supported by this method.

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

## ◆ removeEnhancedEncodingMode()

void DSRCodedEntryValue::removeEnhancedEncodingMode | ( |  | ) |

remove the "Enhanced Encoding Mode" from this code.

Internally, all elements that belong to this mode are cleared.

## ◆ renderHTML()

OFCondition DSRCodedEntryValue::renderHTML | ( | STD_NAMESPACE ostream & | stream,
|  | const size_t | flags,
|  | const OFBool | fullCode = OFTrue,
|  | const OFBool | valueFirst = OFFalse ) const

render code in HTML/XHTML format.

Please note that only the "Basic Coded Entry Attributes" are supported by this method.

Parameters

  stream | output stream to which the HTML/XHTML document is written
  flags | flag used to customize the output (see DSRTypes::HF_xxx)
  fullCode | optional flag indicating whether to render the full code tuple or the code value/meaning only
  valueFirst | optional flag indicating whether to render the code value or meaning first (outside the brackets)

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setCode() [1/3]

OFCondition DSRCodedEntryValue::setCode | ( | const DSRBasicCodedEntry & | basicCodedEntry,
|  | const OFBool | check = OFFalse )

set code.

To be used for code constants defined by an instance of the DSRBasicCodedEntry class.

Parameters

  basicCodedEntry | code to be set, defined by its "Basic Coded Entry Attributes"
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setCode() [2/3]

OFCondition DSRCodedEntryValue::setCode | ( | const OFString & | codeValue,
|  | const OFString & | codingSchemeDesignator,
|  | const OFString & | codeMeaning,
|  | const DSRTypes::E_CodeValueType | codeValueType = DSRTypes::CVT_auto,
|  | const OFExplicitBool | check = OFTrue )

set code.

To be used when the code to be set consists of three values (code value, coding scheme designator and code meaning). The attributes from the "Enhanced Encoding Mode" are set by one of the setEnhancedEncodingMode() methods. Before setting the code, it is usually checked. If the code is invalid, the current code is not replaced and remains unchanged. Additional information on the coding scheme can be provided via the DSRDocument::getCodingSchemeIdentification() method (highly recommended for private coding schemes).

Parameters

  codeValue | identifier of the code to be set that is unambiguous within the coding scheme. (VR=SH/UC/UR, mandatory)
  codingSchemeDesignator | identifier of the coding scheme in which the code for a term is defined. (VR=SH, conditional) Designators beginning with "99" and the designator "L" are defined to be private or local coding schemes.
  codeMeaning | human-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
  codeValueType | type of 'codeValue' (short, long or URN) used to map the value to the correct DICOM value representation (VR). By default, the type is determined automatically (see determineCodeValueType()).
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are only accepted for non-mandatory attributes.

Returns
  status, EC_Normal if successful, an error code otherwise

References DSRTypes::CVT_auto.

## ◆ setCode() [3/3]

OFCondition DSRCodedEntryValue::setCode | ( | const OFString & | codeValue,
|  | const OFString & | codingSchemeDesignator,
|  | const OFString & | codingSchemeVersion,
|  | const OFString & | codeMeaning,
|  | const DSRTypes::E_CodeValueType | codeValueType = DSRTypes::CVT_auto,
|  | const OFBool | check = OFTrue )

set code.

To be used when the code to be set consists of four values (code value, coding scheme designator, coding scheme version and code meaning). The attributes from the "Enhanced Encoding Mode" are set by one of the setEnhancedEncodingMode() methods. Before setting the code, it is usually checked. If the code is invalid, the current code is not replaced and remains unchanged. Additional information on the coding scheme can be provided via the DSRDocument::getCodingSchemeIdentification() method (highly recommended for private coding schemes).

Parameters

  codeValue | identifier of the code to be set that is unambiguous within the coding scheme. (VR=SH, mandatory)
  codingSchemeDesignator | identifier of the coding scheme in which the code for a term is defined. (VR=SH, conditional) Designators beginning with "99" and the designator "L" are defined to be private or local coding schemes.
  codingSchemeVersion | version of the coding scheme. May be used to identify the version of a coding scheme if necessary to resolve ambiguity in the 'codeValue' or 'codeMeaning. (VR=SH, optional)
  codeMeaning | human-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
  codeValueType | type of 'codeValue' (short, long or URN) used to map the value to the correct DICOM value representation (VR). By default, the type is determined automatically (see determineCodeValueType()).
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are only accepted for non-mandatory attributes.

Returns
  status, EC_Normal if successful, an error code otherwise

References DSRTypes::CVT_auto.

## ◆ setEnhancedEncodingMode() [1/2]

OFCondition DSRCodedEntryValue::setEnhancedEncodingMode | ( | const OFString & | contextIdentifier,
|  | const OFString & | mappingResource,
|  | const OFString & | contextGroupVersion,
|  | const OFString & | contextUID = "",
|  | const OFString & | localVersion = "",
|  | const OFString & | extensionCreatorUID = "",
|  | const OFBool | check = OFTrue )

specify the "Enhanced Encoding Mode" for this code.

This method should be used for codes from or extensions to non-private context groups, e.g. from the DICOM Content Mapping Resource (DCMR).

Parameters

  contextIdentifier | identifier of the context group defined by 'mappingResource' from which the code was selected, or to which the code has been added as a private context group extension. (VR=CS, mandatory)
  mappingResource | message/terminology mapping resource that specifies the context group with the given identifier. (VR=CS, mandatory)
  contextGroupVersion | version of the context group. (VR=DT, mandatory)
  contextUID | uniquely identifies the context group. (VR=UI, optional)
  localVersion | implementation-specific version of a context group that contains private extensions. (VR=DT, conditional)
  extensionCreatorUID | identifies the person or organization who created the extension to the context group. (VR=UI, conditional) Should be specified if 'localVersion' is non-empty.
  check | if enabled, the given values are checked for validity (conformance with corresponding VR and VM) before setting them. Empty values are only accepted for non-mandatory attributes.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setEnhancedEncodingMode() [2/2]

OFCondition DSRCodedEntryValue::setEnhancedEncodingMode | ( | const OFString & | contextUID,
|  | const OFBool | check = OFTrue )

specify the "Enhanced Encoding Mode" for this code.

This method should be used for private context groups, which are not identified by a context identifier and mapping resource.

Parameters

  contextUID | uniquely identifies the context group. (VR=UI, mandatory)
  check | if enabled, the given value is checked for validity (conformance with corresponding VR and VM) before setting it. An empty value is never accepted.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ setValue()

OFCondition DSRCodedEntryValue::setValue | ( | const DSRCodedEntryValue & | codedEntryValue,
|  | const OFBool | check = OFTrue )

set code.

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

Parameters

  codedEntryValue | code to be set
  check | if enabled, check code for validity before setting it. See checkCode() for details. Empty values are only accepted for non-mandatory attributes.

Returns
  status, EC_Normal if successful, an error code otherwise

References DSRCodedEntryValue().

## ◆ usesEnhancedEncodingMode()

OFBool DSRCodedEntryValue::usesEnhancedEncodingMode | ( |  | ) | const

check whether the "Enhanced Encoding Mode" is used for this code.

Currently, the only check that is performed is that either the context identifier or the context UID have a non-empty value.

Returns
  OFTrue if the "Enhanced Encoding Mode" is used, OFFalse otherwise

## ◆ writeItem()

OFCondition DSRCodedEntryValue::writeItem | ( | DcmItem & | dataset | ) | const
| protected

write code to dataset.

This method also supports the attributes from the "Enhanced Encoding Mode".

Parameters

  dataset | DICOM dataset to which the code should be written

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ writeSequence()

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

write code sequence to dataset

Parameters

  dataset | DICOM dataset to which the code 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

## ◆ writeSequenceItem()

OFCondition DSRCodedEntryValue::writeSequenceItem | ( | DcmItem & | item,
|  | const DcmTagKey & | tagKey ) const

write code to sequence item

Parameters

  item | DICOM sequence item to which the code should be written
  tagKey | DICOM tag specifying the sequence in which this item is contained

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ writeXML()

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

write code in XML format.

Please note that only the "Basic Coded Entry Attributes" are supported by this method.

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

## Member Data Documentation

## ◆ ContextGroupVersion

OFString DSRCodedEntryValue::ContextGroupVersion
| private

Mapping Resource UID (VR=UI, type 3)

Mapping Resource Name (VR=LO, type 3) Context Group Version (VR=DT, type 1C)

Referenced by getContextGroupVersion().

## ◆ ContextIdentifier

OFString DSRCodedEntryValue::ContextIdentifier
| private

tbd: Equivalent Code Sequence (VR=SQ, type 3) not yet supported

Context Identifier (VR=CS, type 3)

Referenced by getContextIdentifier().

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

- dcmsr/include/dcmtk/dcmsr/dsrcodvl.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2