GDCM 3.2.1

Public Member Functions | Friends | List of all members
gdcm::Tag Class Reference

Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). More...

`#include <gdcmTag.h>`

Inheritance diagram for gdcm::Tag:
[legend]

## Public Member Functions
| Tag (const Tag &_val)
| Tag (uint16_t group, uint16_t element)
| Constructor with 2*uint16_t.
| Tag (uint32_t tag=0)
| Constructor with 1*uint32_t Prefer the cstor that takes two uint16_t.
uint16_t | GetElement () const
| Returns the 'Element number' of the given Tag.
uint32_t | GetElementTag () const
| Returns the full tag value of the given Tag.
uint16_t | GetGroup () const
| Returns the 'Group number' of the given Tag.
uint32_t | GetLength () const
| return the length of tag (read: size on disk)
Tag | GetPrivateCreator () const
| Return the Private Creator Data Element tag of a private data element.
bool | IsGroupLength () const
| return whether the tag correspond to a group length tag:
bool | IsGroupXX (const Tag &t) const
| e.g 6002,3000 belong to groupXX: 6000,3000
bool | IsIllegal () const
| return if the tag is considered to be an illegal tag
bool | IsPrivate () const
bool | IsPrivateCreator () const
bool | IsPublic () const
bool | operator!= (const Tag &_val) const
bool | operator< (const Tag &_val) const
bool | operator<= (const Tag &t2) const
Tag & | operator= (const Tag &_val)
bool | operator== (const Tag &_val) const
uint16_t & | operator[] (const unsigned int &_id)
| Returns the Group or Element of the given Tag, depending on id (0/1)
const uint16_t & | operator[] (const unsigned int &_id) const
| Returns the Group or Element of the given Tag, depending on id (0/1)
std::string | PrintAsContinuousString () const
std::string | PrintAsContinuousUpperCaseString () const
| Same as PrintAsContinuousString, but hexadecimal [a-f] are printed using upper case.
std::string | PrintAsPipeSeparatedString () const
template<typename TSwap>
std::istream & | Read (std::istream &is)
| Read a tag from binary representation.
bool | ReadFromCommaSeparatedString (const char *str)
bool | ReadFromContinuousString (const char *str)
bool | ReadFromPipeSeparatedString (const char *str)
void | SetElement (uint16_t element)
| Sets the 'Element number' of the given Tag.
void | SetElementTag (uint16_t group, uint16_t element)
| Sets the 'Group number' & 'Element number' of the given Tag.
void | SetElementTag (uint32_t tag)
| Sets the full tag value of the given Tag.
void | SetGroup (uint16_t group)
| Sets the 'Group number' of the given Tag.
void | SetPrivateCreator (Tag const &t)
| Set private creator:
template<typename TSwap>
const std::ostream & | Write (std::ostream &os) const
| Write a tag in binary rep.

## Friends
std::ostream & | operator<< (std::ostream &_os, const Tag &_val)
std::istream & | operator>> (std::istream &_is, Tag &_val)

## Detailed Description

Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).

Basically an uint32_t which can also be expressed as two uint16_t (group and element)

Note
  DATA ELEMENT TAG: A unique identifier for a Data Element composed of an ordered pair of numbers (a Group Number followed by an Element Number). GROUP NUMBER: The first number in the ordered pair of numbers that makes up a Data Element Tag. ELEMENT NUMBER: The second number in the ordered pair of numbers that makes up a Data Element Tag.

Examples
  BasicAnonymizer.cs, BasicImageAnonymizer.cs, ChangeSequenceUltrasound.cxx, Cleaner.cs, ClinicalTrialAnnotate.cxx, ClinicalTrialIdentificationWorkflow.cs, CreateARGBImage.cxx, CreateCMYKImage.cxx, CreateFakeRTDOSE.cxx, CreateJPIPDataSet.cxx, DecompressImage.cs, DeriveSeries.cxx, DiscriminateVolume.cxx, DumpToSQLITE3.cxx, DumpVisusChange.cxx, DuplicatePCDE.cxx, EncapsulateFileInRawData.cxx, ExtractEncapsulatedFile.cs, ExtractEncryptedContent.cxx, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, FileAnonymize.cs, FileChangeTS.cs, FileChangeTSLossy.cs, FixBrokenJ2K.cxx, FixJAIBugJPEGLS.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, GenLongSeqs.cxx, GenSeqs.cxx, GetJPEGSamplePrecision.cxx, GetSequenceUltrasound.cxx, GetSubSequenceData.cxx, LargeVRDSExplicit.cxx, MakeTemplate.cxx, ManipulateFile.cs, MergeTwoFiles.cxx, MpegVideoInfo.cs, PatchFile.cxx, PublicDict.cxx, ReadAndDumpDICOMDIR.cxx, ReadAndDumpDICOMDIR2.cxx, ReadAndPrintAttributes.cxx, ReadExplicitLengthSQIVR.cxx, ScanDirectory.cs, SimpleScanner.cxx, SortImage.cxx, StreamImageReaderTest.cxx, TraverseModules.cxx, VolumeSorter.cxx, gdcmrtionplan.cxx, gdcmrtplan.cxx, iU22tomultisc.cxx, pmsct_rgb1.cxx, and rle2img.cxx.

## Constructor & Destructor Documentation

## ◆ Tag() [1/3]

gdcm::Tag::Tag | ( | uint16_t | group,
|  | uint16_t | element )
| inline

Constructor with 2*uint16_t.

Referenced by gdcm::PrivateTag::PrivateTag(), gdcm::PrivateTag::PrivateTag(), Tag(), GetPrivateCreator(), IsGroupXX(), gdcm::PrivateTag::operator!=(), operator!=(), operator<(), operator<<, operator<=(), operator=(), gdcm::PrivateTag::operator==(), operator==(), operator>>, and SetPrivateCreator().

## ◆ Tag() [2/3]

gdcm::Tag::Tag | ( | uint32_t | tag = 0 | ) |
| inline

Constructor with 1*uint32_t Prefer the cstor that takes two uint16_t.

References SetElementTag(), and tag.

## ◆ Tag() [3/3]

gdcm::Tag::Tag | ( | const Tag & | _val | ) |
| inline

References Tag(), and tag.

## Member Function Documentation

## ◆ GetElement()

uint16_t gdcm::Tag::GetElement | ( |  | ) | const
| inline

Returns the 'Element number' of the given Tag.

Examples
  DuplicatePCDE.cxx, and PublicDict.cxx.

Referenced by gdcm::PrivateTag::PrivateTag(), gdcm::DataSet::ComputeGroupLength(), GetPrivateCreator(), IsGroupLength(), IsGroupXX(), IsIllegal(), IsPrivateCreator(), gdcm::PrivateDict::PrintXML(), gdcm::SequenceOfFragments::ReadValue(), and SetPrivateCreator().

## ◆ GetElementTag()

uint32_t gdcm::Tag::GetElementTag | ( |  | ) | const
| inline

Returns the full tag value of the given Tag.

Referenced by gdcm::PrivateTag::operator!=(), gdcm::PrivateTag::operator!=(), gdcm::PrivateTag::operator=(), gdcm::PrivateTag::operator==(), and gdcm::PrivateTag::operator==().

## ◆ GetGroup()

uint16_t gdcm::Tag::GetGroup | ( |  | ) | const
| inline

Returns the 'Group number' of the given Tag.

Examples
  DuplicatePCDE.cxx, and GenAllVR.cxx.

Referenced by gdcm::DataSet::ComputeGroupLength(), gdcm::CommandDataSet::Insert(), gdcm::DataSet::Insert(), gdcm::FileMetaInformation::Insert(), IsGroupXX(), IsIllegal(), gdcm::PrivateDict::PrintXML(), gdcm::SequenceOfFragments::ReadValue(), and SetPrivateCreator().

## ◆ GetLength()

uint32_t gdcm::Tag::GetLength | ( |  | ) | const
| inline

return the length of tag (read: size on disk)

## ◆ GetPrivateCreator()

Tag gdcm::Tag::GetPrivateCreator | ( |  | ) | const
| inline

Return the Private Creator Data Element tag of a private data element.

References Tag(), GetElement(), IsPrivate(), IsPrivateCreator(), and SetElement().

## ◆ IsGroupLength()

bool gdcm::Tag::IsGroupLength | ( |  | ) | const
| inline

return whether the tag correspond to a group length tag:

References GetElement().

## ◆ IsGroupXX()

bool gdcm::Tag::IsGroupXX | ( | const Tag & | t | ) | const
| inline

e.g 6002,3000 belong to groupXX: 6000,3000

References Tag(), GetElement(), GetGroup(), and IsPrivate().

## ◆ IsIllegal()

bool gdcm::Tag::IsIllegal | ( |  | ) | const
| inline

return if the tag is considered to be an illegal tag

References GetElement(), GetGroup(), and IsPrivate().

## ◆ IsPrivate()

bool gdcm::Tag::IsPrivate | ( |  | ) | const
| inline

PRIVATE DATA ELEMENT: Additional Data Element, defined by an implementor, to communicate information that is not contained in Standard Data Elements. Private Data elements have odd Group Numbers.

Examples
  DuplicatePCDE.cxx.

References IsPublic().

Referenced by GetPrivateCreator(), IsGroupXX(), IsIllegal(), IsPrivateCreator(), and SetPrivateCreator().

## ◆ IsPrivateCreator()

bool gdcm::Tag::IsPrivateCreator | ( |  | ) | const
| inline

Returns if tag is a Private Creator (xxxx,00yy), where xxxx is odd number and yy in [0x10,0xFF]

Examples
  DuplicatePCDE.cxx.

References GetElement(), and IsPrivate().

Referenced by GetPrivateCreator().

## ◆ IsPublic()

bool gdcm::Tag::IsPublic | ( |  | ) | const
| inline

STANDARD DATA ELEMENT: A Data Element defined in the DICOM Standard, and therefore listed in the DICOM Data Element Dictionary in PS 3.6. Is the Tag from the Public dict...well the implementation is buggy it does not prove the element is indeed in the dict...

Referenced by IsPrivate().

## ◆ operator!=()

bool gdcm::Tag::operator!= | ( | const Tag & | _val | ) | const
| inline

References Tag(), and tag.

## ◆ operator<()

bool gdcm::Tag::operator< | ( | const Tag & | _val | ) | const
| inline

DICOM Standard expects the Data Element to be sorted by Tags All other comparison can be constructed from this one and operator ==

References Tag(), tag, and tags.

## ◆ operator<=()

bool gdcm::Tag::operator<= | ( | const Tag & | t2 | ) | const
| inline

References Tag().

## ◆ operator=()

Tag & gdcm::Tag::operator= | ( | const Tag & | _val | ) |
| inline

References Tag(), and tag.

## ◆ operator==()

bool gdcm::Tag::operator== | ( | const Tag & | _val | ) | const
| inline

References Tag(), and tag.

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

uint16_t & gdcm::Tag::operator[] | ( | const unsigned int & | _id | ) |
| inline

Returns the Group or Element of the given Tag, depending on id (0/1)

References gdcm_assert.

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

const uint16_t & gdcm::Tag::operator[] | ( | const unsigned int & | _id | ) | const
| inline

Returns the Group or Element of the given Tag, depending on id (0/1)

References gdcm_assert.

## ◆ PrintAsContinuousString()

std::string gdcm::Tag::PrintAsContinuousString | ( |  | ) | const

Print tag value with no separating comma: eg. tag = "12345678" It comes in useful when reading tag values from XML file(in NativeDICOMModel)

## ◆ PrintAsContinuousUpperCaseString()

std::string gdcm::Tag::PrintAsContinuousUpperCaseString | ( |  | ) | const

Same as PrintAsContinuousString, but hexadecimal [a-f] are printed using upper case.

## ◆ PrintAsPipeSeparatedString()

std::string gdcm::Tag::PrintAsPipeSeparatedString | ( |  | ) | const

Print as a pipe separated string (GDCM 1.x compat only). Do not use in newer code

See also
  ReadFromPipeSeparatedString

## ◆ Read()

template<typename TSwap>

std::istream & gdcm::Tag::Read | ( | std::istream & | is | ) |
| inline

Read a tag from binary representation.

## ◆ ReadFromCommaSeparatedString()

bool gdcm::Tag::ReadFromCommaSeparatedString | ( | const char * | str | ) |

Read from a comma separated string. This is a highly user oriented function, the string should be formatted as: 1234,5678 to specify the tag (0x1234,0x5678) The notation comes from the DICOM standard, and is handy to use from a command line program

## ◆ ReadFromContinuousString()

bool gdcm::Tag::ReadFromContinuousString | ( | const char * | str | ) |

Read From XML formatted tag value eg. tag = "12345678" It comes in useful when reading tag values from XML file(in NativeDICOMModel)

## ◆ ReadFromPipeSeparatedString()

bool gdcm::Tag::ReadFromPipeSeparatedString | ( | const char * | str | ) |

Read from a pipe separated string (GDCM 1.x compat only). Do not use in newer code

See also
  ReadFromCommaSeparatedString

## ◆ SetElement()

void gdcm::Tag::SetElement | ( | uint16_t | element | ) |
| inline

Sets the 'Element number' of the given Tag.

Examples
  DuplicatePCDE.cxx, and PublicDict.cxx.

Referenced by gdcm::PrivateTag::PrivateTag(), gdcm::PrivateTag::PrivateTag(), GetPrivateCreator(), operator>>, and SetPrivateCreator().

## ◆ SetElementTag() [1/2]

void gdcm::Tag::SetElementTag | ( | uint16_t | group,
|  | uint16_t | element )
| inline

Sets the 'Group number' & 'Element number' of the given Tag.

Referenced by Tag(), and gdcm::PrivateTag::operator=().

## ◆ SetElementTag() [2/2]

void gdcm::Tag::SetElementTag | ( | uint32_t | tag | ) |
| inline

Sets the full tag value of the given Tag.

References tag.

## ◆ SetGroup()

void gdcm::Tag::SetGroup | ( | uint16_t | group | ) |
| inline

Sets the 'Group number' of the given Tag.

Referenced by operator>>, and SetPrivateCreator().

## ◆ SetPrivateCreator()

void gdcm::Tag::SetPrivateCreator | ( | Tag const & | t | ) |
| inline

Set private creator:

Examples
  DuplicatePCDE.cxx.

References Tag(), gdcm_assert, GetElement(), GetGroup(), IsPrivate(), SetElement(), and SetGroup().

## ◆ Write()

template<typename TSwap>

const std::ostream & gdcm::Tag::Write | ( | std::ostream & | os | ) | const
| inline

Write a tag in binary rep.

Referenced by gdcm::Item::Write(), gdcm::SequenceOfFragments::Write(), and gdcm::SequenceOfItems::Write().

## Friends And Related Symbol Documentation

## ◆ operator<<

std::ostream & operator<< | ( | std::ostream & | _os,
|  | const Tag & | _val )
| friend

References Tag().

## ◆ operator>>

std::istream & operator>> | ( | std::istream & | _is,
|  | Tag & | _val )
| friend

References Tag(), SetElement(), and SetGroup().

## Member Data Documentation

## ◆ bytes

char gdcm::Tag::bytes[4]

## ◆ tag

uint32_t gdcm::Tag::tag

Referenced by Tag(), Tag(), operator!=(), operator<(), operator=(), operator==(), and SetElementTag().

## ◆ tags

uint16_t gdcm::Tag::tags[2]

Referenced by operator<().

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

- gdcmTag.h