DCMTK: DcmTag Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

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

this class encapsulates an attribute tag (group, element) and a VR. More...

Inheritance diagram for DcmTag:

## Public Member Functions
| DcmTag ()
| default constructor
| DcmTag (const DcmTagKey &akey, const char *privCreator=NULL)
| constructor.
| DcmTag (Uint16 g, Uint16 e, const char *privCreator=NULL)
| constructor.
| DcmTag (const DcmTagKey &akey, const DcmVR &avr)
| constructor.
| DcmTag (Uint16 g, Uint16 e, const DcmVR &avr)
| constructor.
| DcmTag (const DcmTag &tag)
| copy constructor
| DcmTag (const DcmTag &tag, const DcmVR &avr)
| constructor.
| ~DcmTag ()
| destructor
DcmTag & | operator= (const DcmTag &tag)
| copy assignment operator
OFBool | operator== (const DcmTag &tag) const
| comparison operator.
OFBool | operator!= (const DcmTag &tag) const
| negation operator.
DcmVR | setVR (const DcmVR &avr)
| set specific VR
DcmVR | getVR () const
| returns VR object by value
DcmEVR | getEVR () const
| returns VR code
const char * | getVRName () const
| returns name of VR
Uint16 | getGTag () const
| returns tag group
Uint16 | getETag () const
| returns tag element
DcmTagKey | getXTag () const
| returns a copy of the tag key by value.
const DcmTagKey & | getTagKey () const
| returns tag key as a const reference
const char * | getTagName ()
| returns name of attribute tag.
const char * | getPrivateCreator () const
| returns the current private creator identifier for this object if any, NULL otherwise.
void | setPrivateCreator (const char *privCreator)
| assigns a private creator identifier and deletes a possibly cached attribute name since the attribute name could change if a different private creator identifier is used.
void | lookupVRinDictionary ()
| performs a look-up of the VR for the current tag key in the dictionary, under consideration of the private creator identifier (if defined).
OFBool | isSignable () const
| returns true if a data element with the given tag and VR can be digitally signed, false otherwise
OFBool | isUnknownVR () const
| returns true if the VR used for writing is "UN"
OFCondition | error () const
| returns current status flag
OFBool | operator== (const DcmTagKey &key) const
| comparison operator.
OFBool | operator!= (const DcmTagKey &key) const
| negation operator.
Public Member Functions inherited from DcmTagKey
| DcmTagKey ()
| default constructor
| DcmTagKey (const DcmTagKey &key)
| copy constructor
| DcmTagKey (Uint16 g, Uint16 e)
| constructor
virtual | ~DcmTagKey ()
| destructor
void | set (const DcmTagKey &key)
| set value to given tag key
void | set (Uint16 g, Uint16 e)
| set value to given group and element
void | setGroup (Uint16 g)
| set group to given number
void | setElement (Uint16 e)
| set element to given number
Uint16 | getGroup () const
| returns group number
Uint16 | getElement () const
| returns element number
DcmTagKey | getBaseTag () const
| returns base tag, i.e.
OFBool | isGroupLength () const
| checks whether the tag key is a valid group length element.
OFBool | isPrivate () const
| returns true if the tag key is private, i.e.
OFBool | isPrivateReservation () const
| returns true, if tag is a private reservation tag of the form (gggg,00xx) with "gggg" being odd and "xx" in the range of 10 and FF.
OFBool | hasValidGroup () const
| returns true, if group is valid (permitted in DICOM command or data sets).
Uint32 | hash () const
| generate a simple hash code for this attribute tag.
DcmTagKey & | operator= (const DcmTagKey &key)
| assignment operator for initializing this tag key from an existing one
OFBool | operator== (const DcmTagKey &key) const
| comparison operator.
OFBool | operator!= (const DcmTagKey &key) const
| negation operator.
OFBool | operator< (const DcmTagKey &key) const
| 'less than' operator.
OFBool | operator> (const DcmTagKey &key) const
| 'greater than' operator.
OFBool | operator<= (const DcmTagKey &key) const
| 'less or equal' operator.
OFBool | operator>= (const DcmTagKey &key) const
| 'greater or equal' operator.
OFString | toString () const
| convert tag key to string having the form "(gggg,eeee)".
OFBool | isSignableTag () const
| returns true if a data element with the given tag key can be digitally signed, false otherwise

## Static Public Member Functions
static OFCondition | findTagFromName (const char *name, DcmTag &value)
| convert the given string to a DICOM tag value

## Protected Member Functions
void | setTag (const DcmTagKey &key, const DcmVR &avr, const char *name, const char *privCreator)
| set the members of this tag
Protected Member Functions inherited from DcmTagKey
int | groupLT (const DcmTagKey &key) const
| less-than operation comparing only group numbers
int | groupGT (const DcmTagKey &key) const
| greater-than operation comparing only group numbers
int | groupEQ (const DcmTagKey &key) const
| comparison operation comparing only group numbers
int | elementLT (const DcmTagKey &key) const
| less-than operation comparing only element numbers
int | elementGT (const DcmTagKey &key) const
| greater-than operation comparing only element numbers
int | elementEQ (const DcmTagKey &key) const
| comparison operation comparing only element numbers

## Private Member Functions
void | updateTagName (const char *c)
| replace tagName with copy of given string
void | updatePrivateCreator (const char *c)
| replace privateCreator with copy of given string

## Private Attributes
DcmVR | vr
| VR of this attribute tag.
char * | tagName
| name of this attribute tag, remains NULL unless getTagName() is called
char * | privateCreator
| private creator identifier, remains NULL unless setPrivateCreator() is called
OFCondition | errorFlag
| current error code, EC_Normal if a valid VR for the tag is known

## Detailed Description

this class encapsulates an attribute tag (group, element) and a VR.

It maintains a private creator identifier for private tags and caches the attribute name, once it is looked up in the data dictionary. This class maintains the interface to the DICOM data dictionary, i.e. performs look-ups of attribute VR and name in the background. Therefore, creation of DcmTag element is significantly more expensive than creation of simple DcmTagKey objects unless the VR is passed in the constructor.

## Constructor & Destructor Documentation

## ◆ DcmTag() [1/6]

DcmTag::DcmTag | ( | const DcmTagKey & | akey,
|  | const char * | privCreator = NULL )

constructor.

Initializes group/element from given tag key and performs a dictionary lookup for the VR. The lookup also considers private tags if the private creator identifier is defined (not NULL).

Parameters

  akey | tag key
  privCreator | private creator identifier (optional)

References DcmTagKey::DcmTagKey().

## ◆ DcmTag() [2/6]

DcmTag::DcmTag | ( | Uint16 | g,
|  | Uint16 | e,
|  | const char * | privCreator = NULL )

constructor.

Initializes group/element from given parameters and performs a dictionary lookup for the VR. The lookup also considers private tags if the private creator identifier is defined (not NULL).

Parameters

  g | tag group
  e | tag element
  privCreator | private creator identifier (optional)

## ◆ DcmTag() [3/6]

DcmTag::DcmTag | ( | const DcmTagKey & | akey,
|  | const DcmVR & | avr )

constructor.

Initializes group/element and VR from given parameters. No dictionary lookup needed/performed.

Parameters

  akey | tag key
  avr | VR

References DcmTagKey::DcmTagKey().

## ◆ DcmTag() [4/6]

DcmTag::DcmTag | ( | Uint16 | g,
|  | Uint16 | e,
|  | const DcmVR & | avr )

constructor.

Initializes group/element and VR from given parameters. No dictionary lookup needed/performed.

Parameters

  g | tag group
  e | tag element
  avr | VR

## ◆ DcmTag() [5/6]

DcmTag::DcmTag | ( | const DcmTag & | tag | ) |

copy constructor

Parameters

  tag | tag to be copied

References DcmTag().

## ◆ DcmTag() [6/6]

DcmTag::DcmTag | ( | const DcmTag & | tag,
|  | const DcmVR & | avr )

constructor.

Initializes tag from given parameter, but uses the specified VR. This constructor is e.g. useful for attributes with multiple VRs. No dictionary lookup needed/performed.

Parameters

  tag | tag to be copied
  avr | VR to be used

References DcmTag().

## Member Function Documentation

## ◆ findTagFromName()

OFCondition DcmTag::findTagFromName | ( | const char * | name,
|  | DcmTag & | value )
| static

convert the given string to a DICOM tag value

Parameters

  name | name or tag of the attribute to be searched for. If the name of the attribute is given, the spelling has to be consistent with the spelling used in the data dictionary (e.g. "PatientName"). If the attribute tag is used, the format is "gggg,eeee" (i.e. two hexadecimal numbers separated by a comma).
  value | variable in which the resulting tag value is stored. If this functions fails to find the specified tag, this variable remains unchanged.

Note
  This method also searches for private tags, but always returns the first entry that matches (if no standard attribute was found), i.e. the private creator identifier is ignored (it cannot be specified for this method).

Returns
  status, EC_Normal upon success, an error code otherwise

References DcmTag().

## ◆ getETag()

Uint16 DcmTag::getETag | ( |  | ) | const
| inline

returns tag element

Returns
  tag element

References DcmTagKey::getElement().

## ◆ getGTag()

Uint16 DcmTag::getGTag | ( |  | ) | const
| inline

returns tag group

Returns
  tag group

References DcmTagKey::getGroup().

## ◆ getPrivateCreator()

const char * DcmTag::getPrivateCreator | ( |  | ) | const

returns the current private creator identifier for this object if any, NULL otherwise.

Returns
  private creator identifier if present, NULL otherwise

## ◆ getTagKey()

const DcmTagKey & DcmTag::getTagKey | ( |  | ) | const
| inline

returns tag key as a const reference

Returns
  tag key

References DcmTagKey::DcmTagKey().

## ◆ getTagName()

const char * DcmTag::getTagName | ( |  | ) |

returns name of attribute tag.

If name has not been accessed before, a dictionary lookup under consideration of the current private creator identifier is performed. If no attribute name is found, a default name is used. Never returns NULL.

Returns
  attribute tag name, never NULL.

Referenced by DcmIODUtil::readSubSequence().

## ◆ getXTag()

DcmTagKey DcmTag::getXTag | ( |  | ) | const
| inline

returns a copy of the tag key by value.

Note
  In most cases, the method getTagKey() should be preferred.

Returns
  copy of tag key, by value

References DcmTagKey::DcmTagKey().

## ◆ isSignable()

OFBool DcmTag::isSignable | ( |  | ) | const

returns true if a data element with the given tag and VR can be digitally signed, false otherwise

Returns
  true if signable, false otherwise

## ◆ lookupVRinDictionary()

void DcmTag::lookupVRinDictionary | ( |  | ) |

performs a look-up of the VR for the current tag key in the dictionary, under consideration of the private creator identifier (if defined).

If a dictionary entry is found, the VR of this object is copied from the dictionary entry, otherwise the VR remains unmodified.

## ◆ operator!=() [1/2]

OFBool DcmTag::operator!= | ( | const DcmTag & | tag | ) | const

negation operator.

Returns true if either group or element number or private creator identifier (if present) are not the same. Please note that the VR is not used for comparison.

Parameters

  tag | tag to compare with

Returns
  true if tags are not the same

References DcmTag().

## ◆ operator!=() [2/2]

OFBool DcmTagKey::operator!= | ( | const DcmTagKey & | key | ) | const
| inline

negation operator.

Returns true if either group or element number are not the same.

Parameters

  key | key to compare with

Returns
  true if tag keys are not the same

References DcmTagKey::DcmTagKey().

## ◆ operator==() [1/2]

OFBool DcmTag::operator== | ( | const DcmTag & | tag | ) | const

comparison operator.

Returns true if both group and element number as well as private creator identifier (if present) are the same. Please note that the VR is not used for comparison.

Parameters

  tag | tag to compare with

Returns
  true if tags are the same

References DcmTag().

## ◆ operator==() [2/2]

OFBool DcmTagKey::operator== | ( | const DcmTagKey & | key | ) | const
| inline

comparison operator.

Returns true if both group and element number are the same.

Parameters

  key | key to compare with

Returns
  true if tag keys are the same

References DcmTagKey::DcmTagKey().

## ◆ setPrivateCreator()

void DcmTag::setPrivateCreator | ( | const char * | privCreator | ) |

assigns a private creator identifier and deletes a possibly cached attribute name since the attribute name could change if a different private creator identifier is used.

Parameters

  privCreator | private creator identifier, may be NULL

## ◆ setTag()

void DcmTag::setTag | ( | const DcmTagKey & | key,
|  | const DcmVR & | avr,
|  | const char * | name,
|  | const char * | privCreator )
| protected

set the members of this tag

Parameters

  key | attribute tag to be set
  avr | value representation (VR) to be set
  name | attribute name to be set
  privCreator | private creator identifier to be set (might be NULL)

References DcmTagKey::DcmTagKey().

## ◆ updatePrivateCreator()

void DcmTag::updatePrivateCreator | ( | const char * | c | ) |
| private

replace privateCreator with copy of given string

Parameters

  c | new private creator identifier

## ◆ updateTagName()

void DcmTag::updateTagName | ( | const char * | c | ) |
| private

replace tagName with copy of given string

Parameters

  c | new tag name

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

- dcmdata/include/dcmtk/dcmdata/dctag.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1