org.dicom4j.dicom
Class DicomTag

java.lang.Object
  extended by org.dicom4j.dicom.DicomTag
All Implemented Interfaces:
Comparable<DicomTag>
Direct Known Subclasses:
DictionaryTag

public class DicomTag
extends Object
implements Comparable<DicomTag>

a DICOM Tag (a Group and a Element)

An instance is immutable

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

Version:
0.0.4: adding isGroupLength
Author:
Laurent Lecomte

Constructor Summary
DicomTag(int group, int element)
           Construct a DICOM data element (attribute) tag.
DicomTag(int aGroup, int aElement, String aName)
           Creates a new DICOM Tag
DicomTag(int aGroup, int aElement, String aName, ValueRepresentation aVR)
           Creates a new DICOM Tag
 
Method Summary
 int compareTo(DicomTag o)
           Compare tags based on the numeric order of their group and then element values.
 boolean equals(Object aObject)
           
 int getElement()
           Return the element value.
 String getElementAsString()
           
 int getGroup()
           Get the group value.
 String getGroupAsString()
           
 String getName()
          Return the name of this Tag
 ValueRepresentation getValueRepresentation()
           
 int hashCode()
           Get a hash value which represents the tag.
 boolean isGroupLength()
           Is the tag a group length tag ?
 boolean isPrivate()
           Is the tag a private tag ?
 String toString()
           Get a human-readable rendering of the tag.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DicomTag

public DicomTag(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

DicomTag

public DicomTag(int aGroup,
                int aElement,
                String aName)

Creates a new DICOM Tag

Parameters:
aGroup - the 16 bit unsigned binary group
aElement - the 16 bit unsigned binary element
aName - the name of this tag

DicomTag

public DicomTag(int aGroup,
                int aElement,
                String aName,
                ValueRepresentation aVR)

Creates a new DICOM Tag

Parameters:
aGroup - the 16 bit unsigned binary group
aElement - the 16 bit unsigned binary element
aName - the name of this tag
aVR - the ValueRepresentation
Method Detail

compareTo

public int compareTo(DicomTag o)

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

Specified by:
compareTo in interface Comparable<DicomTag>
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 aObject)
Overrides:
equals in class Object
Parameters:
aObject - the AttributeTag to compare this AttributeTag against
Returns:
true if the same group and element number

getElement

public int getElement()

Return the element value.

Returns:
the 16 bit unsigned binary element

getElementAsString

public String getElementAsString()

getGroup

public int getGroup()

Get the group value.

Returns:
the 16 bit unsigned binary group

getGroupAsString

public String getGroupAsString()

getName

public String getName()
Return the name of this Tag

Returns:
the name

getValueRepresentation

public ValueRepresentation getValueRepresentation()

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

isGroupLength

public boolean isGroupLength()

Is the tag a group length tag ?

Group Length tags are those with Element equals to 0.

Returns:

isPrivate

public boolean isPrivate()

Is the tag a private tag ?

Private tags are those with odd-numbered groups.

Returns:
true if private

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


Copyright © 2009 dicom4j. All Rights Reserved.