Class AttributeTag
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionAttributeTag
(int group, int element) Construct a DICOM data element (attribute) tag.Construct a DICOM data element (attribute) tag from its string representation. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare tags based on the numeric order of their group and then element values.boolean
Compare tags based on their group and element values.int
Get the element value.int
getGroup()
Get the group value.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
Is the tag a member of a curve group ?boolean
Is the tag a File Meta Information tag ?boolean
Is the tag a group length tag ?boolean
Is the tag a member of an overlay group ?boolean
Is the tag a private tag ?boolean
Is the tag a private creator tag ?boolean
Is the tag a member of a repeating group ?static void
toString()
Get a human-readable rendering of the tag.static String
toString
(int group, int element) Get a human-readable rendering of the tag.toString
(DicomDictionary dictionary) Get a human-readable rendering of the tag.
-
Constructor Details
-
AttributeTag
public AttributeTag(int group, int element) Construct a DICOM data element (attribute) tag.
- Parameters:
group
- the 16 bit unsigned binary groupelement
- the 16 bit unsigned binary element
-
AttributeTag
Construct a DICOM data element (attribute) tag from its string representation.
- Parameters:
s
- a String of the form returned bytoString()
, 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
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
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
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.
-
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.
- Parameters:
group
- the 16 bit unsigned binary groupelement
- the 16 bit unsigned binary element- Returns:
- the string rendering of the tag
-
compareTo
Compare tags based on the numeric order of their group and then element values.
- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- theAttributeTag
to compare thisAttributeTag
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
Compare tags based on their group and element values.
- Overrides:
equals
in classObject
- Parameters:
o
- theAttributeTag
to compare thisAttributeTag
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). -
main
-