Trispark JDT
2.50.13

com.archimed.dicom
Class DataElement

java.lang.Object
  extended by com.archimed.dicom.TagValue
      extended by com.archimed.dicom.DataElement

public class DataElement
extends TagValue

The DataElement class represents a single data element in a DicomObject. The DataElement contains all the values that are present in the data element and stores them internally in an array. This class also has a number of setters/getters to retrieve and set values in data elements.


Field Summary
 
Fields inherited from class com.archimed.dicom.TagValue
dataLen, dcm, dcm_type, element, group, val
 
Constructor Summary
DataElement()
           
 
Method Summary
 void addATValue(ATValue atValue)
          adds a value to this data element as an ATValue object

Supported value representations:AT
 void addBigDecimal(java.math.BigDecimal bd)
          adds a value to this data element as a BigDecimal object.
 void addBytes(byte[] bytes)
          adds a value to this data element as a byte array

Supported value representations:AE,AS,CS,DA,DS,DT,IS,LO,OB,OW,PN,SH,ST,TM,UI,UN,UT,OB_OW
 void addDouble(java.lang.Double d)
          adds a value to this data element as a Double

Supported value representations:FD
 void addFloat(java.lang.Float f)
          adds a value to this data element as a Float

Supported value representations:FL
 void addFloats(float[] floats)
          adds a value to this data element at the specified index as a float array

Supported value representations:OF
 void addInteger(java.lang.Integer i)
          adds a value to this data element as a Integer

Supported value representations:UL,SL,US,SS,IS
 void addLong(java.lang.Long l)
          adds a value to this data element as a Long

Supported value representations:UL,SL,US,SS,IS
 void addPersonName(Person p)
          adds a value to this data element as Person object.
 void addPersonName(Person p, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          adds a value to this data element as Person object.
 void addSequenceItem(DicomObject item)
          adds a value to this data element as a DicomObject.
 void addShort(java.lang.Short sh)
          adds a value to this data element as a Short

Supported value representations:UL,SL,US,SS,IS
 void addString(java.lang.String s)
          adds a value to the data element.
 void addString(java.lang.String s, DicomCharset dicomCharset)
          adds a value to the data element using the specified charset for encoding into bytes.
 void clear()
          clears the data element.
 java.lang.Object fromATValue(ATValue atValue)
           
 java.lang.Object fromBytes(byte[] bytes)
           
 java.lang.Object fromDicomObject(DicomObject dicomObject)
           
 java.lang.Object fromDouble(java.lang.Double d)
           
 java.lang.Object fromFloat(java.lang.Float f)
           
 java.lang.Object fromFloats(float[] floats)
           
 ATValue getATValue(int index)
          returns an ATValue representation of the value of a data element.

Supported value representations:AT
 java.math.BigDecimal getBigDecimal(int index)
          returns a BigDecimal representation of the value of a data element.

Supported value representations:DS
A BigDecimal will preserve the precision of the value encoded in the decimal string.
 byte[] getBytes(int index)
          returns a byte array representation of the value of a data element.

Supported value representations:
AE,AS,CS,DA,DS,DT,IS,LO,LT,OB,OW,PN,SH,ST,TM,UI,UN,UT
 java.lang.Double getDouble(int index)
          returns a double representation of the value of a data element.

Supported value representations:FD
 int getElement()
          returns the element number of the data element.
 java.lang.Float getFloat(int index)
          returns a float representation of the value of a data element.

Supported value representations: FL
 float[] getFloats(int index)
          returns a double representation of the value of a data element.

Supported value representations:OF
 int getGroup()
          returns the group number of the data element.
 java.lang.Integer getInteger(int index)
          returns an java.lang.Integer representation of the value of a data element.

Supported value representations:
IS,SL,US,SS
 java.lang.Long getLong(int index)
          returns a java.lang.Long representation of the value of a data element.

Supported value representations:
IS,UL,SL,US,SS
 Person getPersonName(int index)
          returns a Person representation of the value of a data element.

Supported value representations:
PN
 DicomObject getSequenceItem(int index)
          returns a DicomObject representation of the value of a data element.
 java.lang.Short getShort(int index)
          returns a java.lang.Short representation of the value of a data element.

Supported value representations:
SS
 java.lang.String getString(int index)
          returns getString(index,true);
 java.lang.String getString(int index, boolean trim)
          returns a String representation of the values of a data element, with the optional trimming of insignificant whitespace.

This method will return a suitable String representation for all value representations except SQ for which null will be returned.
 int getTag()
          returns the DDict constant corresponding to the group,element pair of this data element.
 java.lang.Object getValue()
          returns the value at index 0.
 java.lang.Object getValue(int index)
          returns the value at the specified index for this data element.
 int getValueLength()
          returns the 'Value Length' field of a Data Element.
 int getVR()
          returns the value representation of the data element.
 java.lang.Object removeValue(int index)
          removes the value at the specified index and shift any subsequent values to the left.
 void setATValue(ATValue atValue, int index)
          sets the value in this data element at the specified index as an ATValue object

Supported value representations:AT
 void setBigDecimal(java.math.BigDecimal bd, int index)
          sets the value in this data element at the specified index as a BigDecimal object.
 void setBytes(byte[] bytes, int index)
          sets the value in this data element at the specified index as a byte array

Supported value representations:AE,AS,CS,DA,DS,DT,IS,LO,OB,OW,PN,SH,ST,TM,UI,UN,UT,OB_OW
 void setDouble(java.lang.Double d, int index)
          sets the value in this data element at the specified index as a Double

Supported value representations:FD
 void setFloat(java.lang.Float f, int index)
          sets the value in this data element at the specified index as a Float

Supported value representations:FL
 void setFloats(float[] floats, int index)
          sets the value in this data element at the specified index as a float array

Supported value representations:OF
 void setInteger(java.lang.Integer i, int index)
          sets the value in this data element at the specified index as a Integer

Supported value representations:UL,SL,US,SS,IS
 void setLong(java.lang.Long l, int index)
          sets the value in this data element at the specified index as a Long

Supported value representations:UL,SL,US,SS,IS
 void setPersonName(Person p, int index)
          sets the value at the specified index of this data element as Person object.
 void setPersonName(Person p, int index, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          sets the value at the specified index of this data element as Person object.
 void setSequenceItem(DicomObject item, int index)
          sets the value in this data element as a DicomObject.
 void setShort(java.lang.Short sh, int index)
          sets the value in this data element at the specified index as a Short

Supported value representations:UL,SL,US,SS,IS
 void setString(java.lang.String s, int index)
          sets the value at index using a String representation.
 void setString(java.lang.String s, int index, DicomCharset dicomCharset)
          sets the value at index making use of the specified dicomCharset for encoding into bytes.
 int size()
          returns the size (or multiplicity) of the data element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataElement

public DataElement()
Method Detail

getGroup

public int getGroup()
returns the group number of the data element.

Overrides:
getGroup in class TagValue
Returns:
int

getElement

public int getElement()
returns the element number of the data element.

Overrides:
getElement in class TagValue
Returns:
int

getTag

public int getTag()
returns the DDict constant corresponding to the group,element pair of this data element.

Returns:
int

size

public int size()
returns the size (or multiplicity) of the data element.

Overrides:
size in class TagValue
Returns:
int

getValue

public java.lang.Object getValue(int index)
returns the value at the specified index for this data element. The value is returned in the type as it is stored and is not converted.

Overrides:
getValue in class TagValue
Parameters:
index - int
Returns:
Object

getValue

public java.lang.Object getValue()
returns the value at index 0.

Overrides:
getValue in class TagValue
Returns:
Object

getVR

public int getVR()
returns the value representation of the data element. This will be one of the DDict.tXX constants.

Returns:
int

getValueLength

public int getValueLength()
returns the 'Value Length' field of a Data Element. When data elements are modified, this value may not always reflect the actual length of the value(s) in a Data Element.

Returns:
int

clear

public void clear()
clears the data element. All the values stored in the internal vector are removed.


removeValue

public java.lang.Object removeValue(int index)
removes the value at the specified index and shift any subsequent values to the left.

Parameters:
index - int
Returns:
Object

getString

public java.lang.String getString(int index)
                           throws DicomException
returns getString(index,true);

Parameters:
index - int
Returns:
String
Throws:
DicomException

getString

public java.lang.String getString(int index,
                                  boolean trim)
returns a String representation of the values of a data element, with the optional trimming of insignificant whitespace.

This method will return a suitable String representation for all value representations except SQ for which null will be returned.

Parameters:
index - int the index of the value
trim - boolean
Returns:
String

setString

public void setString(java.lang.String s,
                      int index)
               throws DicomException
sets the value at index using a String representation. The String argument cannot be null.

Parameters:
s - String
index - int
Throws:
DicomException

addString

public void addString(java.lang.String s)
               throws DicomException
adds a value to the data element. See setString(String s,int index) for valid value representations.

Parameters:
s - String
Throws:
DicomException

setString

public void setString(java.lang.String s,
                      int index,
                      DicomCharset dicomCharset)
               throws DicomException
sets the value at index making use of the specified dicomCharset for encoding into bytes.

Parameters:
s - String
index - int
dicomCharset - DicomCharset
Throws:
DicomException

addString

public void addString(java.lang.String s,
                      DicomCharset dicomCharset)
               throws DicomException
adds a value to the data element using the specified charset for encoding into bytes.

Parameters:
s - String
dicomCharset - DicomCharset
Throws:
DicomException

getShort

public java.lang.Short getShort(int index)
                         throws DicomException
returns a java.lang.Short representation of the value of a data element.

Supported value representations:
SS

Parameters:
index - int
Returns:
Short
Throws:
DicomException

setShort

public void setShort(java.lang.Short sh,
                     int index)
              throws DicomException
sets the value in this data element at the specified index as a Short

Supported value representations:UL,SL,US,SS,IS

Parameters:
sh - Short
index - int
Throws:
DicomException

addShort

public void addShort(java.lang.Short sh)
              throws DicomException
adds a value to this data element as a Short

Supported value representations:UL,SL,US,SS,IS

Parameters:
sh - Short
Throws:
DicomException

getInteger

public java.lang.Integer getInteger(int index)
                             throws DicomException
returns an java.lang.Integer representation of the value of a data element.

Supported value representations:
IS,SL,US,SS

Parameters:
index - int
Returns:
Integer
Throws:
DicomException

setInteger

public void setInteger(java.lang.Integer i,
                       int index)
                throws DicomException
sets the value in this data element at the specified index as a Integer

Supported value representations:UL,SL,US,SS,IS

Parameters:
i - Integer
index - int
Throws:
DicomException

addInteger

public void addInteger(java.lang.Integer i)
                throws DicomException
adds a value to this data element as a Integer

Supported value representations:UL,SL,US,SS,IS

Parameters:
i - Integer
Throws:
DicomException

getLong

public java.lang.Long getLong(int index)
                       throws DicomException
returns a java.lang.Long representation of the value of a data element.

Supported value representations:
IS,UL,SL,US,SS

Parameters:
index - int
Returns:
Long
Throws:
DicomException

setLong

public void setLong(java.lang.Long l,
                    int index)
             throws DicomException
sets the value in this data element at the specified index as a Long

Supported value representations:UL,SL,US,SS,IS

Parameters:
l - Long
index - int
Throws:
DicomException

addLong

public void addLong(java.lang.Long l)
             throws DicomException
adds a value to this data element as a Long

Supported value representations:UL,SL,US,SS,IS

Parameters:
l - Long
Throws:
DicomException

getPersonName

public Person getPersonName(int index)
                     throws DicomException
returns a Person representation of the value of a data element.

Supported value representations:
PN

Parameters:
index - int
Returns:
Person
Throws:
DicomException

setPersonName

public void setPersonName(Person p,
                          int index)
                   throws DicomException
sets the value at the specified index of this data element as Person object. The Person object is encoded with the default repertoire.

Supported value representations: PN

Parameters:
p - Person
index - int
Throws:
DicomException

setPersonName

public void setPersonName(Person p,
                          int index,
                          DicomCharset singleByteCharset,
                          DicomCharset ideographicCharset,
                          DicomCharset phoneticCharset)
                   throws DicomException
sets the value at the specified index of this data element as Person object. Different charsets can specified for the encoding of the 3 component groups.

Supported value representations: PN

Parameters:
p - Person
index - int
singleByteCharset - DicomCharset charset for encoding of the single byte component group
ideographicCharset - DicomCharset charset for encoding of the ideographic component group
phoneticCharset - DicomCharset charset for encoding of the phonetic component group
Throws:
DicomException

addPersonName

public void addPersonName(Person p)
                   throws DicomException
adds a value to this data element as Person object. The Person object is byte encoded with the default repertoire.

Supported value representations: PN

Parameters:
p - Person
Throws:
DicomException

addPersonName

public void addPersonName(Person p,
                          DicomCharset singleByteCharset,
                          DicomCharset ideographicCharset,
                          DicomCharset phoneticCharset)
                   throws DicomException
adds a value to this data element as Person object. Different charsets can specified for the encoding of the 3 component groups.

Supported value representations: PN

Parameters:
p - Person
singleByteCharset - DicomCharset
ideographicCharset - DicomCharset
phoneticCharset - DicomCharset
Throws:
DicomException

getBytes

public byte[] getBytes(int index)
                throws DicomException
returns a byte array representation of the value of a data element.

Supported value representations:
AE,AS,CS,DA,DS,DT,IS,LO,LT,OB,OW,PN,SH,ST,TM,UI,UN,UT

Parameters:
index - int
Returns:
byte[]
Throws:
DicomException

setBytes

public void setBytes(byte[] bytes,
                     int index)
              throws DicomException
sets the value in this data element at the specified index as a byte array

Supported value representations:AE,AS,CS,DA,DS,DT,IS,LO,OB,OW,PN,SH,ST,TM,UI,UN,UT,OB_OW

Parameters:
bytes - byte[]
index - int
Throws:
DicomException

addBytes

public void addBytes(byte[] bytes)
              throws DicomException
adds a value to this data element as a byte array

Supported value representations:AE,AS,CS,DA,DS,DT,IS,LO,OB,OW,PN,SH,ST,TM,UI,UN,UT,OB_OW

Parameters:
bytes - byte[]
Throws:
DicomException

fromBytes

public java.lang.Object fromBytes(byte[] bytes)
                           throws DicomException
Throws:
DicomException

getFloat

public java.lang.Float getFloat(int index)
                         throws DicomException
returns a float representation of the value of a data element.

Supported value representations: FL

Parameters:
index - int
Returns:
Float
Throws:
DicomException

setFloat

public void setFloat(java.lang.Float f,
                     int index)
              throws DicomException
sets the value in this data element at the specified index as a Float

Supported value representations:FL

Parameters:
f - Float
index - int
Throws:
DicomException

addFloat

public void addFloat(java.lang.Float f)
              throws DicomException
adds a value to this data element as a Float

Supported value representations:FL

Parameters:
f - Float
Throws:
DicomException

fromFloat

public java.lang.Object fromFloat(java.lang.Float f)
                           throws DicomException
Throws:
DicomException

getDouble

public java.lang.Double getDouble(int index)
                           throws DicomException
returns a double representation of the value of a data element.

Supported value representations:FD

Parameters:
index - int
Returns:
Double
Throws:
DicomException

setDouble

public void setDouble(java.lang.Double d,
                      int index)
               throws DicomException
sets the value in this data element at the specified index as a Double

Supported value representations:FD

Parameters:
d - Double
index - int
Throws:
DicomException

addDouble

public void addDouble(java.lang.Double d)
               throws DicomException
adds a value to this data element as a Double

Supported value representations:FD

Parameters:
d - Double
Throws:
DicomException

fromDouble

public java.lang.Object fromDouble(java.lang.Double d)
                            throws DicomException
Throws:
DicomException

getFloats

public float[] getFloats(int index)
                  throws DicomException
returns a double representation of the value of a data element.

Supported value representations:OF

Parameters:
index - int
Returns:
float[]
Throws:
DicomException

setFloats

public void setFloats(float[] floats,
                      int index)
               throws DicomException
sets the value in this data element at the specified index as a float array

Supported value representations:OF

Parameters:
floats - float[]
index - int
Throws:
DicomException

addFloats

public void addFloats(float[] floats)
               throws DicomException
adds a value to this data element at the specified index as a float array

Supported value representations:OF

Parameters:
floats - Float
Throws:
DicomException

fromFloats

public java.lang.Object fromFloats(float[] floats)
                            throws DicomException
Throws:
DicomException

getSequenceItem

public DicomObject getSequenceItem(int index)
                            throws DicomException
returns a DicomObject representation of the value of a data element. This method should be use to retrieve sequence items as DicomObjects out of a sequence.

Supported value representations:SQ

Parameters:
index - int
Returns:
DicomObject
Throws:
DicomException

setSequenceItem

public void setSequenceItem(DicomObject item,
                            int index)
                     throws DicomException
sets the value in this data element as a DicomObject. Use this method to set sequence items to a sequence.

Supported value representations:SQ

Parameters:
item - DicomObject
index - int
Throws:
DicomException

addSequenceItem

public void addSequenceItem(DicomObject item)
                     throws DicomException
adds a value to this data element as a DicomObject. Use this method to add sequence items to a sequence.

Supported value representations:SQ

Parameters:
item - DicomObject
Throws:
DicomException

fromDicomObject

public java.lang.Object fromDicomObject(DicomObject dicomObject)
                                 throws DicomException
Throws:
DicomException

getATValue

public ATValue getATValue(int index)
                   throws DicomException
returns an ATValue representation of the value of a data element.

Supported value representations:AT

Parameters:
index - int
Returns:
AttributeTag
Throws:
DicomException

setATValue

public void setATValue(ATValue atValue,
                       int index)
                throws DicomException
sets the value in this data element at the specified index as an ATValue object

Supported value representations:AT

Parameters:
atValue - ATValue
index - int
Throws:
DicomException

addATValue

public void addATValue(ATValue atValue)
                throws DicomException
adds a value to this data element as an ATValue object

Supported value representations:AT

Parameters:
atValue - ATValue
Throws:
DicomException

fromATValue

public java.lang.Object fromATValue(ATValue atValue)
                             throws DicomException
Throws:
DicomException

getBigDecimal

public java.math.BigDecimal getBigDecimal(int index)
                                   throws DicomException
returns a BigDecimal representation of the value of a data element.

Supported value representations:DS
A BigDecimal will preserve the precision of the value encoded in the decimal string.

Parameters:
index - int
Returns:
BigDecimal
Throws:
DicomException

setBigDecimal

public void setBigDecimal(java.math.BigDecimal bd,
                          int index)
                   throws DicomException
sets the value in this data element at the specified index as a BigDecimal object. When null is specified, the methods adds an empty value.

Supported value representations:DS

Parameters:
bd - BigDecimal
index - int
Throws:
DicomException

addBigDecimal

public void addBigDecimal(java.math.BigDecimal bd)
                   throws DicomException
adds a value to this data element as a BigDecimal object. When null is specified, the methods adds an empty value.

Supported value representations:DS

Parameters:
bd - BigDecimal
Throws:
DicomException

Trispark JDT
2.50.13

Copyright © 1999-2008 Trispark. All Rights Reserved.