DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
Class for coded entry values. More...
Public Member Functions | |
DSRCodedEntryValue () | |
default contructor | |
DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning) | |
constructor. | |
DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning) | |
constructor. | |
DSRCodedEntryValue (const DSRCodedEntryValue &codedEntryValue) | |
copy constructor | |
virtual | ~DSRCodedEntryValue () |
destructor | |
DSRCodedEntryValue & | operator= (const DSRCodedEntryValue &codedEntryValue) |
assignment operator | |
OFBool | operator== (const DSRCodedEntryValue &codedEntryValue) const |
comparison operator. | |
virtual void | clear () |
clear all internal variables. | |
virtual OFBool | isValid () const |
check whether the current code is valid. | |
virtual OFBool | isEmpty () const |
check whether the current code is empty. | |
void | print (STD_NAMESPACE ostream &stream, const OFBool printCodeValue=OFTrue, const OFBool printInvalid=OFFalse) const |
print code. | |
OFCondition | readSequence (DcmItem &dataset, const DcmTagKey &tagKey, const OFString &type) |
read code sequence from dataset. | |
OFCondition | writeSequence (DcmItem &dataset, const DcmTagKey &tagKey) const |
write code sequence to dataset | |
OFCondition | readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor) |
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. | |
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) |
set code. | |
OFCondition | setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning) |
set code. | |
OFCondition | setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning) |
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) |
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="") |
specify the "Enhanced Encoding Mode" for this code. | |
Protected Member Functions | |
DSRCodedEntryValue * | getValuePtr () |
get pointer to this code | |
OFCondition | readItem (DcmItem &dataset, const char *moduleName=NULL) |
read code from dataset. | |
OFCondition | writeItem (DcmItem &dataset) const |
write code to dataset. | |
OFBool | checkCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning) const |
check the specified code for validity. | |
Private Attributes | |
OFString | CodeValue |
Code Value (VR=SH, mandatory) | |
OFString | CodingSchemeDesignator |
Coding Scheme Designator (VR=SH, mandatory) | |
OFString | CodingSchemeVersion |
Coding Scheme Version (VR=SH, optional) | |
OFString | CodeMeaning |
Code Meaning (VR=LO, mandatory) | |
OFString | ContextIdentifier |
Context Identifier (VR=CS, optional) | |
OFString | ContextUID |
Context UID (VR=UI, optional) | |
OFString | MappingResource |
Mapping Resource (VR=CS, conditional) | |
OFString | ContextGroupVersion |
Context Group Version (VR=DT, conditional) | |
OFString | ContextGroupLocalVersion |
Context Group Local Version (VR=DT, conditional) | |
OFString | ContextGroupExtensionCreatorUID |
Context Group Extension Creator UID (VR=UI, conditional) | |
Friends | |
class | DSRContentItem |
Class for coded entry values.
DSRCodedEntryValue::DSRCodedEntryValue | ( | const OFString & | codeValue, |
const OFString & | codingSchemeDesignator, | ||
const OFString & | codeMeaning | ||
) |
constructor.
The code triple is only set if it passed the validity check (see setCode()).
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, mandatory) |
codeMeaning | human-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory) |
DSRCodedEntryValue::DSRCodedEntryValue | ( | const OFString & | codeValue, |
const OFString & | codingSchemeDesignator, | ||
const OFString & | codingSchemeVersion, | ||
const OFString & | codeMeaning | ||
) |
constructor.
The code 4-tuple is only set if it passed the validity check (see setCode()).
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, mandatory) |
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) |
DSRCodedEntryValue::DSRCodedEntryValue | ( | const DSRCodedEntryValue & | codedEntryValue | ) |
copy constructor
codedEntryValue | code to be copied (not checked !) |
OFBool DSRCodedEntryValue::checkCode | ( | const OFString & | codeValue, |
const OFString & | codingSchemeDesignator, | ||
const OFString & | codeMeaning | ||
) | const [protected] |
check the specified code for validity.
Currently, the only check that is performed is that the three given string values are not empty. Later on, it might be checked whether the specified code really belongs to the coding scheme, etc. This require the presence of the relevant code dictionaries.
codeValue | code value to be checked |
codingSchemeDesignator | coding scheme designator to be checked |
codeMeaning | code meaning tobe checked |
virtual void DSRCodedEntryValue::clear | ( | ) | [virtual] |
clear all internal variables.
Since an empty code is invalid the code becomes invalid afterwards.
Reimplemented in DSRCodeTreeNode.
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.
const OFString& DSRCodedEntryValue::getCodeValue | ( | ) | const [inline] |
get code value.
This is an identifier of the code that is unambiguous within the coding scheme.
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.
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.
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".
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".
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".
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".
const OFString& DSRCodedEntryValue::getContextUID | ( | ) | const [inline] |
get context UID.
Optional - Uniquely identifies the context group. This attribute is part of the "Enhanced Encoding Mode".
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".
const DSRCodedEntryValue& DSRCodedEntryValue::getValue | ( | ) | const [inline] |
get reference to the code
OFCondition DSRCodedEntryValue::getValue | ( | DSRCodedEntryValue & | codedEntryValue | ) | const |
get copy of the code
codedEntryValue | reference to variable in which the code should be stored |
DSRCodedEntryValue* DSRCodedEntryValue::getValuePtr | ( | ) | [inline, protected] |
get pointer to this code
virtual OFBool DSRCodedEntryValue::isEmpty | ( | ) | const [virtual] |
check whether the current code is empty.
Checks whether all four components of the code are empty.
virtual OFBool DSRCodedEntryValue::isValid | ( | ) | const [virtual] |
check whether the current code is valid.
See checkCode() for details.
Reimplemented in DSRCodeTreeNode.
DSRCodedEntryValue& DSRCodedEntryValue::operator= | ( | const DSRCodedEntryValue & | codedEntryValue | ) |
assignment operator
codedEntryValue | code to be copied (not checked !) |
OFBool DSRCodedEntryValue::operator== | ( | const DSRCodedEntryValue & | codedEntryValue | ) | const |
comparison operator.
Two codes are equal if the code value, coding scheme designator and the (optional) coding scheme version are equal. The code meaning is not relevant for this check.
codedEntryValue | code which should be compared to the current one |
void DSRCodedEntryValue::print | ( | STD_NAMESPACE ostream & | stream, |
const OFBool | printCodeValue = OFTrue , |
||
const OFBool | printInvalid = OFFalse |
||
) | 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.
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") |
printInvalid | flag indicating whether the text "invalid code" should be printed for invalid codes or not (default) |
OFCondition DSRCodedEntryValue::readItem | ( | DcmItem & | dataset, |
const char * | moduleName = NULL |
||
) | [protected] |
read code from dataset.
This method also supports the attributes from the "Enhanced Encoding Mode".
dataset | DICOM dataset from which the code should be read |
moduleName | optional module name (sequence) from which the item is read |
OFCondition DSRCodedEntryValue::readSequence | ( | DcmItem & | dataset, |
const DcmTagKey & | tagKey, | ||
const OFString & | type | ||
) |
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 than one item.
dataset | DICOM dataset from which the code sequence should be read |
tagKey | DICOM tag specifying the attribute (= sequence) which 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. |
OFCondition DSRCodedEntryValue::readXML | ( | const DSRXMLDocument & | doc, |
DSRXMLCursor | cursor | ||
) |
read code from XML document.
Please note that only the "Basic Coded Entry Attributes" are supported by this method.
doc | document containing the XML file content |
cursor | cursor pointing to the starting node |
remove the "Enhanced Encoding Mode" from this code.
Internally, all attributes that belong to this mode are cleared.
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.
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) |
OFCondition DSRCodedEntryValue::setCode | ( | const OFString & | codeValue, |
const OFString & | codingSchemeDesignator, | ||
const OFString & | codeMeaning | ||
) |
set code.
Before setting the code, it is checked (see checkCode()). 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).
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, mandatory) 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) |
OFCondition DSRCodedEntryValue::setCode | ( | const OFString & | codeValue, |
const OFString & | codingSchemeDesignator, | ||
const OFString & | codingSchemeVersion, | ||
const OFString & | codeMeaning | ||
) |
set code.
Before setting the code, it is checked (see checkCode()). 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).
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, mandatory) 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) |
OFCondition DSRCodedEntryValue::setEnhancedEncodingMode | ( | const OFString & | contextUID | ) |
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.
contextUID | uniquely identifies the context group. (VR=UI, mandatory) |
OFCondition DSRCodedEntryValue::setEnhancedEncodingMode | ( | const OFString & | contextIdentifier, |
const OFString & | mappingResource, | ||
const OFString & | contextGroupVersion, | ||
const OFString & | contextUID = "" , |
||
const OFString & | localVersion = "" , |
||
const OFString & | extensionCreatorUID = "" |
||
) |
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).
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. |
OFCondition DSRCodedEntryValue::setValue | ( | const DSRCodedEntryValue & | codedEntryValue | ) |
set code.
Before setting the code, it is checked (see checkCode()). If the code is invalid the current code is not replaced and remains unchanged. The attributes from the "Enhanced Encoding Mode" are set by one of the setEnhancedEncodingMode() methods.
codedEntryValue | code to be set |
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.
OFCondition DSRCodedEntryValue::writeItem | ( | DcmItem & | dataset | ) | const [protected] |
write code to dataset.
This method also supports the attributes from the "Enhanced Encoding Mode".
dataset | DICOM dataset to which the code should be written |
OFCondition DSRCodedEntryValue::writeSequence | ( | DcmItem & | dataset, |
const DcmTagKey & | tagKey | ||
) | const |
write code sequence to dataset
dataset | DICOM dataset to which the code sequence should be written |
tagKey | DICOM tag specifying the attribute (= sequence) which should be written |
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.
stream | output stream to which the XML document is written |
flags | flag used to customize the output (see DSRTypes::XF_xxx) |
Reimplemented in DSRCodeTreeNode.