Class AttributeTag

  • All Implemented Interfaces:
    java.lang.Comparable

    public class AttributeTag
    extends java.lang.Object
    implements java.lang.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 Summary

      Constructors 
      Constructor Description
      AttributeTag​(int group, int element)
      Construct a DICOM data element (attribute) tag.
      AttributeTag​(java.lang.String s)
      Construct a DICOM data element (attribute) tag from its string representation.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)
      Compare tags based on the numeric order of their group and then element values.
      boolean equals​(java.lang.Object o)
      Compare tags based on their group and element values.
      int getElement()
      Get the element value.
      int getGroup()
      Get the group value.
      AttributeTag getTagWithRepeatingGroupBase()
      Make a new tag with the same element but with the base group of the repeating group.
      int hashCode()
      Get a hash value which represents the tag.
      boolean isCurveGroup()
      Is the tag a member of a curve group ?
      boolean isFileMetaInformationGroup()
      Is the tag a File Meta Information tag ?
      boolean isGroupLength()
      Is the tag a group length tag ?
      boolean isOverlayGroup()
      Is the tag a member of an overlay group ?
      boolean isPrivate()
      Is the tag a private tag ?
      boolean isPrivateCreator()
      Is the tag a private creator tag ?
      boolean isRepeatingGroup()
      Is the tag a member of a repeating group ?
      static void main​(java.lang.String[] arg)  
      java.lang.String toString()
      Get a human-readable rendering of the tag.
      static java.lang.String toString​(int group, int element)
      Get a human-readable rendering of the tag.
      • Methods inherited from class java.lang.Object

        clone, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • 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​(java.lang.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 Detail

      • 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 java.lang.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 java.lang.Object
        Returns:
        the string rendering of the tag
      • toString

        public static java.lang.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​(java.lang.Object o)

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

        Specified by:
        compareTo in interface java.lang.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​(java.lang.Object o)

        Compare tags based on their group and element values.

        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        a hash value representing the tag
      • main

        public static void main​(java.lang.String[] arg)