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 and 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.
|
Modifier and Type | Method and 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.
|
java.lang.String |
toString(DicomDictionary dictionary)
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.
|
public AttributeTag(int group, int element)
Construct a DICOM data element (attribute) tag.
group
- the 16 bit unsigned binary groupelement
- the 16 bit unsigned binary elementpublic AttributeTag(java.lang.String s) throws DicomException
Construct a DICOM data element (attribute) tag from its string representation.
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 respectivelyDicomException
- if String is not a valid representation of a DICOM tagpublic int compareTo(java.lang.Object o)
Compare tags based on the numeric order of their group and then element values.
compareTo
in interface java.lang.Comparable
o
- the AttributeTag
to compare this AttributeTag
againstpublic boolean equals(java.lang.Object o)
Compare tags based on their group and element values.
equals
in class java.lang.Object
o
- the AttributeTag
to compare this AttributeTag
againstpublic int getElement()
Get the element value.
public int getGroup()
Get the group value.
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
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).
hashCode
in class java.lang.Object
public boolean isCurveGroup()
Is the tag a member of a curve group ?
Curve groups are even 5000-501e (curves) groups.
public boolean isFileMetaInformationGroup()
Is the tag a File Meta Information tag ?
Group length tags are those with a group of 0x0002.
public boolean isGroupLength()
Is the tag a group length tag ?
Group length tags are those with a zero element number.
public boolean isOverlayGroup()
Is the tag a member of an overlay group ?
Overlay groups are even 6000-601e (overlays).
public boolean isPrivate()
Is the tag a private tag ?
Private tags are those with odd-numbered groups.
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.
public boolean isRepeatingGroup()
Is the tag a member of a repeating group ?
Repeating groups are even 6000-601e (overlays) and 5000-501e (curves) groups.
public static void main(java.lang.String[] arg)
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.
toString
in class java.lang.Object
public java.lang.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.
dictionary
- the dictionary to use to look up the namepublic 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.
group
- the 16 bit unsigned binary groupelement
- the 16 bit unsigned binary element