Class AttributeTag

java.lang.Object
com.pixelmed.dicom.AttributeTag
All Implemented Interfaces:
Comparable

public class AttributeTag extends Object implements Comparable

An individual DICOM data element (attribute) tag that includes a group and element (each a 16 bit unsigned binary).

Implements Comparable in order to facilitate sorting (e.g. in lists which are indexed by AttributeTag).

Safe to use in hashed collections such as Hashtable and HashMap (i.e. it takes care to implement hashCode() and equals() consistently).

  • Constructor Details

    • AttributeTag

      public AttributeTag(int group, int element)

      Construct a DICOM data element (attribute) tag.

      Parameters:
      group - the 16 bit unsigned binary group
      element - the 16 bit unsigned binary element
    • AttributeTag

      public AttributeTag(String s) throws DicomException

      Construct a DICOM data element (attribute) tag from its string representation.

      Parameters:
      s - a String of the form returned by toString(), i.e., "(0xgggg,0xeeee)" where gggg and eeee are the zero-padded hexadecimal representations of the group and element respectively
      Throws:
      DicomException - if String is not a valid representation of a DICOM tag
  • Method Details

    • getGroup

      public int getGroup()

      Get the group value.

      Returns:
      the 16 bit unsigned binary group
    • getElement

      public int getElement()

      Get the element value.

      Returns:
      the 16 bit unsigned binary element
    • isPrivate

      public boolean isPrivate()

      Is the tag a private tag ?

      Private tags are those with odd-numbered groups.

      Returns:
      true if private
    • isPrivateCreator

      public boolean isPrivateCreator()

      Is the tag a private creator tag ?

      Private creator tags are those with odd-numbered groups with elements between 0x0001 and 0x00ff.

      Returns:
      true if private creator
    • isGroupLength

      public boolean isGroupLength()

      Is the tag a group length tag ?

      Group length tags are those with a zero element number.

      Returns:
      true if group length
    • isFileMetaInformationGroup

      public boolean isFileMetaInformationGroup()

      Is the tag a File Meta Information tag ?

      Group length tags are those with a group of 0x0002.

      Returns:
      true if is File Meta Information tag
    • isOverlayGroup

      public boolean isOverlayGroup()

      Is the tag a member of an overlay group ?

      Overlay groups are even 6000-601e (overlays).

      Returns:
      true if overlay group
    • isCurveGroup

      public boolean isCurveGroup()

      Is the tag a member of a curve group ?

      Curve groups are even 5000-501e (curves) groups.

      Returns:
      true if curve group
    • isRepeatingGroup

      public boolean isRepeatingGroup()

      Is the tag a member of a repeating group ?

      Repeating groups are even 6000-601e (overlays) and 5000-501e (curves) groups.

      Returns:
      true if repeating group
    • getTagWithRepeatingGroupBase

      public AttributeTag getTagWithRepeatingGroupBase()

      Make a new tag with the same element but with the base group of the repeating group.

      Helps with dictionary lookup of VR, etc.

      E.g., any group 6000-601e would be converted to 6000

      Returns:
      true if repeating group
    • toString

      public String toString(DicomDictionary dictionary)

      Get a human-readable rendering of the tag.

      This takes the form "(0xgggg,0xeeee) Name" where gggg and eeee are the zero-padded hexadecimal representations of the group and element respectively.

      Parameters:
      dictionary - the dictionary to use to look up the name
      Returns:
      the string rendering of the tag
    • toString

      public String toString()

      Get a human-readable rendering of the tag.

      This takes the form "(0xgggg,0xeeee)" where gggg and eeee are the zero-padded hexadecimal representations of the group and element respectively.

      Overrides:
      toString in class Object
      Returns:
      the string rendering of the tag
    • toString

      public static String toString(int group, int element)

      Get a human-readable rendering of the tag.

      This takes the form "(0xgggg,0xeeee)" where gggg and eeee are the zero-padded hexadecimal representations of the group and element respectively.

      Parameters:
      group - the 16 bit unsigned binary group
      element - the 16 bit unsigned binary element
      Returns:
      the string rendering of the tag
    • compareTo

      public int compareTo(Object o)

      Compare tags based on the numeric order of their group and then element values.

      Specified by:
      compareTo in interface Comparable
      Parameters:
      o - the AttributeTag to compare this AttributeTag against
      Returns:
      the value 0 if the argument tag is equal to this object; a value less than 0 if this tag is less than the argument tag; and a value greater than 0 if this tag is greater than the argument tag
    • equals

      public boolean equals(Object o)

      Compare tags based on their group and element values.

      Overrides:
      equals in class Object
      Parameters:
      o - the AttributeTag to compare this AttributeTag against
      Returns:
      true if the same group and element number
    • hashCode

      public int hashCode()

      Get a hash value which represents the tag.

      This method is implemented to override java.lang.Object.hashCode() so as to comply with the contract that two tags that return true for equals() will return the same value for hashCode(), which would not be the case unless overridden (i.e. two allocations of a tag with the same group and element would be equal but the default implementation would return different hash values).

      Overrides:
      hashCode in class Object
      Returns:
      a hash value representing the tag
    • main

      public static void main(String[] arg)