DCMTK  Version 3.6.1 20121102
OFFIS DICOM Toolkit
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
DSRCodedEntryValue Class Reference

Class for coded entry values. More...

+ Inheritance diagram for DSRCodedEntryValue:
+ Collaboration diagram for DSRCodedEntryValue:

Public Member Functions

 DSRCodedEntryValue ()
 default contructor
 
 DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning, const OFBool check=OFTrue)
 constructor More...
 
 DSRCodedEntryValue (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning, const OFBool check=OFTrue)
 constructor More...
 
 DSRCodedEntryValue (const DSRCodedEntryValue &codedEntryValue)
 copy constructor More...
 
virtual ~DSRCodedEntryValue ()
 destructor
 
DSRCodedEntryValueoperator= (const DSRCodedEntryValue &codedEntryValue)
 assignment operator More...
 
OFBool operator== (const DSRCodedEntryValue &codedEntryValue) const
 comparison operator. More...
 
virtual void clear ()
 clear all internal variables. More...
 
virtual OFBool isValid () const
 check whether the current code is valid. More...
 
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. More...
 
void print (STD_NAMESPACE ostream &stream, const OFBool printCodeValue=OFTrue, const OFBool printInvalid=OFFalse) const
 print code. More...
 
OFCondition readSequence (DcmItem &dataset, const DcmTagKey &tagKey, const OFString &type)
 read code sequence from dataset. More...
 
OFCondition writeSequence (DcmItem &dataset, const DcmTagKey &tagKey) const
 write code sequence to dataset More...
 
OFCondition readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor)
 read code from XML document. More...
 
OFCondition writeXML (STD_NAMESPACE ostream &stream, const size_t flags) const
 write code in XML format. More...
 
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. More...
 
const DSRCodedEntryValuegetValue () const
 get reference to the code More...
 
OFCondition getValue (DSRCodedEntryValue &codedEntryValue) const
 get copy of the code More...
 
const OFStringgetCodeValue () const
 get code value. More...
 
const OFStringgetCodingSchemeDesignator () const
 get coding scheme designator. More...
 
const OFStringgetCodingSchemeVersion () const
 get coding scheme version. More...
 
const OFStringgetCodeMeaning () const
 get code meaning. More...
 
const OFStringgetContextIdentifier () const
 get context identifier. More...
 
const OFStringgetContextUID () const
 get context UID. More...
 
const OFStringgetMappingResource () const
 get mapping resource. More...
 
const OFStringgetContextGroupVersion () const
 get context group version. More...
 
const OFStringgetContextGroupLocalVersion () const
 get context group local version. More...
 
const OFStringgetContextGroupExtensionCreatorUID () const
 get context group extension creator UID. More...
 
OFCondition setValue (const DSRCodedEntryValue &codedEntryValue, const OFBool check=OFTrue)
 set code. More...
 
OFCondition setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codeMeaning, const OFBool check=OFTrue)
 set code. More...
 
OFCondition setCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning, const OFBool check=OFTrue)
 set code. More...
 
OFBool usesEnhancedEncodingMode () const
 check whether the "Enhanced Encoding Mode" is used for this code. More...
 
void removeEnhancedEncodingMode ()
 remove the "Enhanced Encoding Mode" from this code. More...
 
OFCondition setEnhancedEncodingMode (const OFString &contextUID, const OFBool check=OFTrue)
 specify the "Enhanced Encoding Mode" for this code. More...
 
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. More...
 
OFCondition checkCurrentValue () const
 check the currently stored code for validity. More...
 

Protected Member Functions

DSRCodedEntryValuegetValuePtr ()
 get pointer to this code More...
 
OFCondition readItem (DcmItem &dataset, const char *moduleName=NULL)
 read code from dataset. More...
 
OFCondition writeItem (DcmItem &dataset) const
 write code to dataset. More...
 
OFCondition checkCode (const OFString &codeValue, const OFString &codingSchemeDesignator, const OFString &codingSchemeVersion, const OFString &codeMeaning) const
 check the specified code for validity. More...
 

Private Attributes

OFString CodeValue
 Code Value (VR=SH, type 1)
 
OFString CodingSchemeDesignator
 Coding Scheme Designator (VR=SH, type 1)
 
OFString CodingSchemeVersion
 Coding Scheme Version (VR=SH, 1C)
 
OFString CodeMeaning
 Code Meaning (VR=LO, type 1)
 
OFString ContextIdentifier
 Context Identifier (VR=CS, type 3)
 
OFString ContextUID
 Context UID (VR=UI, type 2)
 
OFString MappingResource
 Mapping Resource (VR=CS, type 1C)
 
OFString ContextGroupVersion
 Context Group Version (VR=DT, type 1C)
 
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 coded entry values.

Constructor & Destructor Documentation

DSRCodedEntryValue::DSRCodedEntryValue ( const OFString codeValue,
const OFString codingSchemeDesignator,
const OFString codeMeaning,
const OFBool  check = OFTrue 
)

constructor

Parameters
codeValueidentifier of the code to be set that is unambiguous within the coding scheme. (VR=SH, mandatory)
codingSchemeDesignatoridentifier of the coding scheme in which the code for a term is defined. (VR=SH, mandatory)
codeMeaninghuman-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
checkif enabled, check code for validity before setting it. See checkCode() for details. Empty values are never accepted.
DSRCodedEntryValue::DSRCodedEntryValue ( const OFString codeValue,
const OFString codingSchemeDesignator,
const OFString codingSchemeVersion,
const OFString codeMeaning,
const OFBool  check = OFTrue 
)

constructor

Parameters
codeValueidentifier of the code to be set that is unambiguous within the coding scheme. (VR=SH, mandatory)
codingSchemeDesignatoridentifier of the coding scheme in which the code for a term is defined. (VR=SH, mandatory)
codingSchemeVersionversion 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)
codeMeaninghuman-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
checkif enabled, check code for validity before setting it. See checkCode() for details. Empty values are only accepted for non-mandatory attributes.
DSRCodedEntryValue::DSRCodedEntryValue ( const DSRCodedEntryValue codedEntryValue)

copy constructor

Parameters
codedEntryValuecode to be copied (not checked !)

Member Function Documentation

OFCondition DSRCodedEntryValue::checkCode ( const OFString codeValue,
const OFString codingSchemeDesignator,
const OFString codingSchemeVersion,
const OFString codeMeaning 
) const
protected

check the specified code for validity.

Currently, the only checks performed are that the three 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
codeValuecode value to be checked
codingSchemeDesignatorcoding scheme designator to be checked
codingSchemeVersioncoding scheme version to be checked (might be empty)
codeMeaningcode meaning to be checked
Returns
status, EC_Normal if code is valid, an error code otherwise
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
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.

Returns
current code meaning (might be invalid or an empty string)
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)
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)
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)
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)
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)
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)
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)
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)
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)
const DSRCodedEntryValue& DSRCodedEntryValue::getValue ( ) const
inline

get reference to the code

Returns
reference to the code
OFCondition DSRCodedEntryValue::getValue ( DSRCodedEntryValue codedEntryValue) const

get copy of the code

Parameters
codedEntryValuereference to variable in which the code should be stored
Returns
status, EC_Normal if successful, an error code otherwise
DSRCodedEntryValue* DSRCodedEntryValue::getValuePtr ( )
inlineprotected

get pointer to this code

Returns
pointer to this code (never NULL)
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
virtual OFBool DSRCodedEntryValue::isValid ( ) const
virtual

check whether the current code is valid.

This check only covers the "Basic Coded Entry Attributes". See checkCode() for details.

Returns
OFTrue if code is valid, OFFalse otherwise

Reimplemented in DSRCodeTreeNode.

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

assignment operator

Parameters
codedEntryValuecode to be copied (not checked !)
Returns
reference to this code after 'codedEntryValue' has been copied
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.

Parameters
codedEntryValuecode which should be compared to the current one
Returns
OFTrue if both codes are equal, OFFalse otherwise
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.

Parameters
streamoutput stream to which the code should be printed
printCodeValueflag indicating whether the code value and coding scheme designator should be printed (default) or not. If OFFalse the output looks like this: (,,"Code Meaning")
printInvalidflag 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".

Parameters
datasetDICOM dataset from which the code should be read
moduleNameoptional module name (sequence) from which the item is read
Returns
status, EC_Normal if successful, an error code otherwise
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. The latter is a limitation of the current implementation, knowing that there are code sequences for which more than one item is allowed.

Parameters
datasetDICOM dataset from which the code sequence should be read
tagKeyDICOM tag specifying the attribute (= sequence) which should be read
typevalue type of the sequence (valid value: "1", "2", something else). This parameter is used for checking purpose, any difference is reported.
Returns
status, EC_Normal if successful, an error code otherwise
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.

Parameters
docdocument containing the XML file content
cursorcursor pointing to the starting node
Returns
status, EC_Normal if successful, an error code otherwise
void DSRCodedEntryValue::removeEnhancedEncodingMode ( )

remove the "Enhanced Encoding Mode" from this code.

Internally, all elements 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.

Parameters
streamoutput stream to which the HTML/XHTML document is written
flagsflag used to customize the output (see DSRTypes::HF_xxx)
fullCodeoptional flag indicating whether to render the full code tuple or the code value/meaning only
valueFirstoptional flag indicating whether to render the code value or meaning first (outside the brackets)
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRCodedEntryValue::setCode ( const OFString codeValue,
const OFString codingSchemeDesignator,
const OFString codeMeaning,
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. Additional information on the coding scheme can be provided via the DSRDocument::getCodingSchemeIdentification() method (highly recommended for private coding schemes).

Parameters
codeValueidentifier of the code to be set that is unambiguous within the coding scheme. (VR=SH, mandatory)
codingSchemeDesignatoridentifier 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.
codeMeaninghuman-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
checkif 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
OFCondition DSRCodedEntryValue::setCode ( const OFString codeValue,
const OFString codingSchemeDesignator,
const OFString codingSchemeVersion,
const OFString codeMeaning,
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. Additional information on the coding scheme can be provided via the DSRDocument::getCodingSchemeIdentification() method (highly recommended for private coding schemes).

Parameters
codeValueidentifier of the code to be set that is unambiguous within the coding scheme. (VR=SH, mandatory)
codingSchemeDesignatoridentifier 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.
codingSchemeVersionversion 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)
codeMeaninghuman-readable translation of the 'codeValue'. Can be used for display when code dictionary is not available. (VR=LO, mandatory)
checkif 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
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. Before setting the code, it is usually checked. If the code is invalid, the current code is not replaced and remains unchanged.

Parameters
contextUIDuniquely identifies the context group. (VR=UI, mandatory)
checkif 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
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
contextIdentifieridentifier 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)
mappingResourcemessage/terminology mapping resource that specifies the context group with the given identifier. (VR=CS, mandatory)
contextGroupVersionversion of the context group. (VR=DT, mandatory)
contextUIDuniquely identifies the context group. (VR=UI, optional)
localVersionimplementation-specific version of a context group that contains private extensions. (VR=DT, conditional)
extensionCreatorUIDidentifies the person or organization who created the extension to the context group. (VR=UI, conditional) Should be specified if 'localVersion' is non-empty.
checkif 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
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. The attributes from the "Enhanced Encoding Mode" are set by one of the setEnhancedEncodingMode() methods.

Parameters
codedEntryValuecode to be set
checkif 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
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
OFCondition DSRCodedEntryValue::writeItem ( DcmItem dataset) const
protected

write code to dataset.

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

Parameters
datasetDICOM dataset to which the code should be written
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRCodedEntryValue::writeSequence ( DcmItem dataset,
const DcmTagKey tagKey 
) const

write code sequence to dataset

Parameters
datasetDICOM dataset to which the code sequence should be written
tagKeyDICOM tag specifying the attribute (= sequence) which should be written
Returns
status, EC_Normal if successful, an error code otherwise
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
streamoutput stream to which the XML document is written
flagsflag used to customize the output (see DSRTypes::XF_xxx)
Returns
status, EC_Normal if successful, an error code otherwise

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


Generated on Wed Sep 4 2013 for DCMTK Version 3.6.1 20121102 by Doxygen 1.8.4