Trispark JDT
2.50.13

com.archimed.dicom
Class DicomObject

java.lang.Object
  extended by com.archimed.dicom.GroupList
      extended by com.archimed.dicom.DicomObject
Direct Known Subclasses:
Command, DicomImage

public class DicomObject
extends GroupList

A DicomObject represents a DICOM dataset and is essentially a collection of DataElements. DicomObjects can be initialized from a DICOM File or Dicom stream by using DicomReader and can be written to a DICOM file or stream with a DicomWriter.

The DicomObject class provides a number of setters/getters for creating new DataElements and for manipulating and quering the values of DataElementS. There are setters/getters that accept the DDict constants for identifying tag and there are corresponding setters/getters that take a group,element pair as arguments. New implementations that make use of this class should use the typesafe getters/setters like setString,addString,getString,setShort,addShort,getShort, ... .

getString is supported for all DICOM types.

Padding to even length is taken care of internally by JDT and when setting/manipulating values of DataElements.

The Java type for the DICOM type OF is a float[] array. The OF type must always have a multiplicity of one, which means that maximum one float[] array of arbitrary length can be set in a tag of type OF.

The conversion table below shows for every setter/adder, the supported DICOM types.

Java TypeDICOM Type
setShort/addShortUL,SL,US,SS,IS
setATValue/addATValueAT
setInteger/addIntegerUL,SL,US,SS,IS
setLong/addLongUL,SL,US,SS,IS
setFloat/addFloatFL
setDouble/addDoubleFD
setBigDecimal/addBigDecimalDS
setBytes/addBytesAE,AS,CS,DA,DS,DT,IS,LO,OB,OW,PN,SH,ST,TM,UI,UN,UT,OB_OW
setFloats/addFloatsOF
setString/addStringLT,ST,UT,LO,SH,AE,CT,DT,TM,UI,AS,PN,DA,DS,FL,IS,SS,US,US_SS,SL,UL,FD,OB,OW,OB_OW,UN
setPersonName/addPersonNamePN
setSequenceItem/addSequenceItemSQ


The conversion table below shows for every getter the supported DICOM types.

Java TypeDICOM Type
getShortSS
getATValueAT
getIntegerSL,US,SS,IS
getLongUL,SL,US,SS,IS
getFloatFL
getDoubleFD
getBigDecimalDS
getBytesAE,AS,CS,DA,DS,DT,IS,LO,LT,OB,OW,PN,SH,ST,TM,UI,UN,UT
getFloatsOF
getStringall DICOM Value Representations except SQ
getPersonNamePN
getSequenceItemSQ

Since:
1.0

Field Summary
protected  JdtLogger log
           
 
Constructor Summary
DicomObject()
          Constructs an empty DicomObject
 
Method Summary
 void addATValue_ge(int group, int element, ATValue atValue)
           
 void addATValue(int dname, ATValue atValue)
           
 void addBigDecimal_ge(int group, int element, java.math.BigDecimal bd)
           
 void addBigDecimal(int dname, java.math.BigDecimal bd)
           
 void addBytes_ge(int group, int element, byte[] bytes)
           
 void addBytes(int dname, byte[] bytes)
           
 void addDouble_ge(int group, int element, java.lang.Double d)
           
 void addDouble(int dname, java.lang.Double d)
           
 void addFloat_ge(int group, int element, java.lang.Float f)
           
 void addFloat(int dname, java.lang.Float f)
           
 void addFloats_ge(int group, int element, float[] floats)
           
 void addFloats(int dname, float[] floats)
           
 void addInteger_ge(int group, int element, java.lang.Integer i)
           
 void addInteger(int dname, java.lang.Integer i)
           
 void addLong_ge(int group, int element, java.lang.Long l)
           
 void addLong(int dname, java.lang.Long l)
           
 void addPersonName_ge(int group, int element, Person person)
           
 void addPersonName_ge(int group, int element, Person person, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          adds a Person value to a PN data element.
 void addPersonName(int dname, Person person)
           
 void addPersonName(int dname, Person person, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          adds a Person value to a PN data element.
 void addSequenceItem_ge(int group, int element, DicomObject dicomObject)
           
 void addSequenceItem(int dname, DicomObject item)
           
 void addShort_ge(int group, int element, java.lang.Short sh)
           
 void addShort(int dname, java.lang.Short sh)
           
 void addString_ge(int group, int element, java.lang.String s)
           
 void addString(int dname, java.lang.String s)
           
 void append_ge(int g, int e, java.lang.Object o)
          Does the same as append(dname, o) using a (group, element) - pair instead of 'dname'
 void append(int dname, java.lang.Object o)
          This methods takes an Object 'o', converts it to the appropriate Java type and appends it after the last value of the data element with name 'dname'.
 long calculateOffset(int seq, int i, int transferSyntax, boolean sequenceUndefined, boolean grouplens)
          This method calculates the offset of the 'i'th item of sequence 'seq', starting from the very first byte of the Dicom file.
 java.util.Vector deleteItem_ge(int g, int e)
          Does the same as deleteItem(dname) using a (group, element) - pair instead of 'dname'
 java.lang.Object deleteItem_ge(int g, int e, int i)
          Does the same as deleteItem(dname, i) using a (group, element) - pair instead of 'dname'
 java.util.Vector deleteItem(int dname)
          Deletes the data element named 'dname' from this DicomObject and returns the values of that data element as a Vector.
 java.lang.Object deleteItem(int dname, int i)
          Deletes the value at index 'i' from the data element called 'dname' The elements with a higher index are all shifted downwards.
 DicomCharset[] dicomCharsets()
          returns the specific character sets specified in the SpecificCharacterSet data element as an array of DicomCharset objects.
 void dumpVRs(java.io.OutputStream os)
          prints all data elements in this DicomObject to an OutputStream in a nice, orderly fashion.
 void dumpVRs(java.io.OutputStream os, boolean metainfo)
          prints all data elements in this DicomObject to an OutputStream in a nice, orderly fashion.
 java.lang.Object get_ge(int g, int e)
          Does the same as get(dname) using a (group, element) - pair instead of 'dname'.
 java.lang.Object get_ge(int g, int e, int i)
          Does the same as get(dname, i) using a (group, element) - pair instead of 'dname'
 java.lang.Object get(int dname)
          This method finds the first value of the data element named 'dname' and returns it as its default Java type.
 java.lang.Object get(int dname, int i)
          This method finds the value at index 'i' of the data element named 'dname' and returns it as its default Java type.
 ATValue getATValue_ge(int group, int element, int index)
           
 ATValue getATValue(int dname, int index)
           
 java.math.BigDecimal getBigDecimal_ge(int group, int element, int index)
           
 java.math.BigDecimal getBigDecimal(int dname, int index)
           
 byte[] getBytes_ge(int group, int element, int index)
           
 byte[] getBytes(int dname, int index)
           
 DataElement getDataElement(int dname)
          returns the tag value as a DataElement for the specified DDict constant or null if this object does not contain such a DataElement.
 DataElement getDataElement(int group, int element)
          returns the tag value as a DataElement for the specified group and element number or null if this object does not contain such a DataElement.
 java.lang.Double getDouble_ge(int group, int element, int index)
           
 java.lang.Double getDouble(int dname, int index)
           
 DicomObject getFileMetaInformation()
          File Meta Information is stored in a separate DicomObject.
 java.lang.Float getFloat_ge(int group, int element, int index)
           
 java.lang.Float getFloat(int dname, int index)
           
 float[] getFloats_ge(int group, int element, int index)
           
 float[] getFloats(int dname, int index)
           
 int getI_ge(int g, int e)
          Does the same as getI(dname) using a (group, element) - pair instead of 'dname'
 int getI_ge(int g, int e, int i)
          Does the same as getI(dname, i) using a (group, element) - pair instead of 'dname'
 int getI(int dname)
          Gets the same value as in get(dname) and, if possible, returns it as an int.
 int getI(int dname, int i)
          Gets the same value as in get(dname, i) and, if possible, returns it as an int.
 java.lang.Integer getInteger_ge(int group, int element, int index)
           
 java.lang.Integer getInteger(int dname, int index)
           
 java.lang.Long getLong_ge(int group, int element, int index)
           
 java.lang.Long getLong(int dname, int index)
           
 long getOffset(int seq, int i)
          returns the offset of the 'i'th SequenceItem 'seq'.
 DicomObject getParent()
          returns the parent DicomObject.
 Person getPersonName_ge(int group, int element, int index)
           
 Person getPersonName(int dname, int index)
           
 byte[] getPreamble()
          returns the 128 byte preamble or null if the preamble is not set in a new DicomObject.
 java.lang.String getS_ge(int g, int e)
          Does the same as getS(dname) using a (group, element) - pair instead of 'dname'
 java.lang.String getS_ge(int g, int e, int i)
          Gets the same value as in get_ge(g, e, i) and, if possible, returns it as a String.
 java.lang.String getS(int dname)
          Gets the same value as in get(dname) and, if possible, returns it as a String.
 java.lang.String getS(int dname, int i)
          Gets the same value as in get(dname, i) and, if possible, returns it as a String.
 int getSeqItemLenState()
          returns the length encoding of this DicomObject in case it is a sequence item in a sequence.
 int getSeqLenState_ge(int group, int element)
          returns the length encoding of a sequence with specified group and element number.
 int getSeqLenState(int tag)
          returns the length encoding of a sequence with specified tag.
 DicomObject getSequenceItem_ge(int group, int element, int index)
           
 DicomObject getSequenceItem(int dname, int index)
           
 java.lang.Short getShort_ge(int group, int element, int index)
           
 java.lang.Short getShort(int dname, int index)
           
 int getSize_ge(int g, int e)
          Does the same as getSize(dname) using a (group, element) - pair instead of 'dname'
 int getSize(int dname)
          Method returns the number of values in the data element with name 'dname'.
 java.lang.String getString_ge(int group, int element, int index)
           
 java.lang.String getString_ge(int group, int element, int index, boolean trim)
           
 java.lang.String getString(int dname, int index)
           
 java.lang.String getString(int dname, int index, boolean trim)
           
 int getType_ge(int group, int element)
          Returns the VR type of a tag in this DicomObject.
 int getType(int dname)
          Returns the VR type of a tag in this DicomObject.
 DataElement newDataElement_ge(int group, int element)
          creates a new DataElement for the specified group and element and adds it to the DicomObject.
 DataElement newDataElement(int dname)
          creates a new DataElement for the specified DDict constant and adds it to the DicomObject.
 void read(java.io.InputStream in)
          Does the same as read(in, readpixels), with the 'readpixels' boolean set to true.
 void read(java.io.InputStream in, boolean readpixels)
          reads a DICOM dataset from an InputStream and stores the data elements in this DicomObject.
 void read(java.io.InputStream in, int transfersyntax, boolean readpixels)
          reads a DICOM Dataset from an InputStream.
 void remove_ge(int group, int element)
           
 void remove(int dname)
           
 void set_ge(int g, int e, java.lang.Object o)
          Does the same as set(dname, o) using a (group, element) - pair instead of 'dname'
 void set_ge(int g, int e, java.lang.Object o, int i)
          Does the same as set(dname, o, i) using a (group, element) - pair instead of 'dname'
 void set(int dname, java.lang.Object o)
          This methods takes an Object 'o', converts it to the approprate Java type and replaces the data element with name 'dname' with it.
 void set(int dname, java.lang.Object o, int i)
          This methods takes an Object 'o', converts it to the approprate Java type and Overwrites the value at index 'i' of the data element named 'dname' with it.
 void setATValue_ge(int group, int element, ATValue atValue, int index)
           
 void setATValue(int dname, ATValue atValue, int index)
           
 void setBigDecimal_ge(int group, int element, java.math.BigDecimal bd, int index)
           
 void setBigDecimal(int dname, java.math.BigDecimal bd, int index)
           
 void setBytes_ge(int group, int element, byte[] bytes, int index)
           
 void setBytes(int dname, byte[] bytes, int index)
           
 void setDouble_ge(int group, int element, java.lang.Double d, int index)
           
 void setDouble(int dname, java.lang.Double d, int index)
           
 DicomObject setFileMetaInformation(DicomObject fmi)
          Use this method to specify a new file meta information object that will be used when writing to a Dicom file.
 void setFloat_ge(int group, int element, java.lang.Float f, int index)
           
 void setFloat(int dname, java.lang.Float f, int index)
           
 void setFloats_ge(int group, int element, float[] floats, int index)
           
 void setFloats(int dname, float[] floats, int index)
           
 void setInteger_ge(int group, int element, java.lang.Integer i, int index)
           
 void setInteger(int dname, java.lang.Integer i, int index)
           
 void setLong_ge(int group, int element, java.lang.Long l, int index)
           
 void setLong(int dname, java.lang.Long l, int index)
           
 void setPersonName_ge(int group, int element, Person person, int index)
           
 void setPersonName_ge(int group, int element, Person person, int index, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          sets a value of a PN element at the specified tag and index.
 void setPersonName(int dname, Person person, int index)
           
 void setPersonName(int dname, Person person, int index, DicomCharset singleByteCharset, DicomCharset ideographicCharset, DicomCharset phoneticCharset)
          sets a value of a PN data element at the specified tag and index.
 void setPreamble(byte[] preamble)
          sets the 128 byte preamble.
 void setSeqItemLenState(int state)
          sets the length encoding of this DicomObject in case it is a sequence item
 void setSeqLenState_ge(int group, int element, int seqLenState)
          sets the length encoding of a sequence.
 void setSeqLenState(int tag, int seqLenState)
          sets the length encoding of a sequence.
 void setSequenceItem_ge(int group, int element, DicomObject item, int index)
           
 void setSequenceItem(int dname, DicomObject item, int index)
           
 void setShort_ge(int group, int element, java.lang.Short sh, int index)
           
 void setShort(int dname, java.lang.Short sh, int index)
           
 void setString_ge(int group, int element, java.lang.String s, int index)
           
 void setString(int dname, java.lang.String s, int index)
           
 void setType_ge(int group, int element, int vrtype)
          Use this method to further specify the type for tags which the type is currently tUS_US or tOW_OB.Only these VR type changes are allowed: tUS_US -> tUS or tSS tOW_OB -> tOW or tOB
 void setType(int dname, int vrtype)
          Use this method to further specify the type for tags which type is currently tUS_US or tOW_OB.
 void write(java.io.OutputStream out, boolean dicomfile)
          writes this DICOM data set to an OutputStream as a DICOM file or DICOM stream.
 void write(java.io.OutputStream out, boolean dicomfile, int transfersyntax, boolean seq_undef)
          writes this DICOM data set to an OutputStream as a DICOM file or DICOM stream.
 void write(java.io.OutputStream out, boolean dicomfile, int transfersyntax, boolean seq_undef, boolean grouplens)
          Does the same as write(out, f, ts, seq_undef) and, in addition, lets you specify whether to write grouplengths.
 
Methods inherited from class com.archimed.dicom.GroupList
addGroups, clear, containsGroup, copyGroup, enumerateVRs, enumerateVRs, isEmpty, numberOfElements, numberOfGroups, removeGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected JdtLogger log
Constructor Detail

DicomObject

public DicomObject()
Constructs an empty DicomObject

Method Detail

getParent

public DicomObject getParent()
returns the parent DicomObject. If this DicomObject is a sequence item the returned object will be the DicomObject one level up in the nesting hierarchy and containing this sequence item. Otherwise this method will return null.

Returns:
DicomObject
Since:
1.6

dicomCharsets

public DicomCharset[] dicomCharsets()
returns the specific character sets specified in the SpecificCharacterSet data element as an array of DicomCharset objects. If this DicomObject does not have a specific character set specified or if the SpecificCharacterSet data element contains an illegal or unknown value, this method will return an array wich contains the default charset (US-ASCII) as a single element.

Returns:
DicomCharset[]

setSeqItemLenState

public void setSeqItemLenState(int state)
sets the length encoding of this DicomObject in case it is a sequence item

Parameters:
state - int one of DicomObject.SEQITEM_NEW,DicomObject.SEQITEM_UNDEFLEN,DicomObject.SEQITEM_DEFLEN

getSeqItemLenState

public int getSeqItemLenState()
returns the length encoding of this DicomObject in case it is a sequence item in a sequence.

Returns:
int one of DicomObject.SEQITEM_NEW,DicomObject.SEQITEM_UNDEFLEN,DicomObject.SEQITEM_DEFLEN

setPreamble

public void setPreamble(byte[] preamble)
sets the 128 byte preamble.

Parameters:
preamble -

getPreamble

public byte[] getPreamble()
returns the 128 byte preamble or null if the preamble is not set in a new DicomObject.

Returns:

newDataElement

public DataElement newDataElement(int dname)
creates a new DataElement for the specified DDict constant and adds it to the DicomObject. This method calls newDataElement_ge.

Parameters:
dname -
Returns:
the newly created DataElement

newDataElement_ge

public DataElement newDataElement_ge(int group,
                                     int element)
creates a new DataElement for the specified group and element and adds it to the DicomObject. Calling this method repeatingly for the same group and element will replace the DataElement created with the first call to newDataElement_ge.

Parameters:
group -
element -
Returns:
the newly created DataElement

set

public void set(int dname,
                java.lang.Object o)
         throws DicomException
This methods takes an Object 'o', converts it to the approprate Java type and replaces the data element with name 'dname' with it. If the data element didn't already exist, this method creates a new one. If the given value is null, a empty data element is created.

Parameters:
o - if 'null' is given, the data element becomes empty
Throws:
DicomException

set_ge

public void set_ge(int g,
                   int e,
                   java.lang.Object o)
            throws DicomException
Does the same as set(dname, o) using a (group, element) - pair instead of 'dname'

Throws:
DicomException

append

public void append(int dname,
                   java.lang.Object o)
            throws DicomException
This methods takes an Object 'o', converts it to the appropriate Java type and appends it after the last value of the data element with name 'dname'. If the data element didn't already exist, this method creates a new one.

Parameters:
o - if 'null' is given, nothing will happen.
Throws:
DicomException

append_ge

public void append_ge(int g,
                      int e,
                      java.lang.Object o)
               throws DicomException
Does the same as append(dname, o) using a (group, element) - pair instead of 'dname'

Parameters:
o - - if 'null' is given, nothing will happen.
Throws:
DicomException

set

public void set(int dname,
                java.lang.Object o,
                int i)
         throws DicomException
This methods takes an Object 'o', converts it to the approprate Java type and Overwrites the value at index 'i' of the data element named 'dname' with it. (data elements are arrays of values to support multiplicity) If the data element didn't already exist, this method creates a new one (then make sure that the index is 0).

Parameters:
o - if 'null' is given, nothing will happen.
Throws:
DicomException

set_ge

public void set_ge(int g,
                   int e,
                   java.lang.Object o,
                   int i)
            throws DicomException
Does the same as set(dname, o, i) using a (group, element) - pair instead of 'dname'

Throws:
DicomException

getType

public int getType(int dname)
            throws DicomException
Returns the VR type of a tag in this DicomObject.

Parameters:
dname - one of the DDict constants representing a tag
Returns:
one of the DDict constants such as tST,tUL, ...
Throws:
DicomException - if no tag is found in this DicomObject

getType_ge

public int getType_ge(int group,
                      int element)
               throws DicomException
Returns the VR type of a tag in this DicomObject.

Parameters:
group - group
element - element
Returns:
one of the DDict constants such as tST,tUL, ...
Throws:
DicomException - if no tag is found in this DicomObject

setType

public void setType(int dname,
                    int vrtype)
             throws DicomException
Use this method to further specify the type for tags which type is currently tUS_US or tOW_OB.

Parameters:
dname - one of the DDict constants representing a tag
vrtype - one of the DDict constants such as tST,tUL, ...
Throws:
DicomException - if the tag is not found or the type conversion is illegal

setType_ge

public void setType_ge(int group,
                       int element,
                       int vrtype)
                throws DicomException
Use this method to further specify the type for tags which the type is currently tUS_US or tOW_OB.Only these VR type changes are allowed: tUS_US -> tUS or tSS tOW_OB -> tOW or tOB

Parameters:
group -
element -
vrtype - one of the DDict constants such as tST,tUL, ...
Throws:
DicomException - if the tag is not found or the type conversion is illegal

setSeqLenState_ge

public void setSeqLenState_ge(int group,
                              int element,
                              int seqLenState)
                       throws DicomException
sets the length encoding of a sequence. This will only effect data elements with specified group and element number that are sequences.

Parameters:
group -
element -
seqLenState - one of VR.SEQ_NEW,VR.SEQ_UNDEFLEN,VR.SEQ_DEFLEN
Throws:
DicomException

setSeqLenState

public void setSeqLenState(int tag,
                           int seqLenState)
                    throws DicomException
sets the length encoding of a sequence. This will only effect data elements with specified tag that are sequences.

Parameters:
tag -
seqLenState - one of VR.SEQ_NEW,VR.SEQ_UNDEFLEN,VR.SEQ_DEFLEN
Throws:
DicomException

getSeqLenState_ge

public int getSeqLenState_ge(int group,
                             int element)
                      throws DicomException
returns the length encoding of a sequence with specified group and element number.

Parameters:
group -
element -
Returns:
one of VR.SEQ_NEW,VR.SEQ_UNDEFLEN,VR.SEQ_DEFLEN
Throws:
DicomException

getSeqLenState

public int getSeqLenState(int tag)
                   throws DicomException
returns the length encoding of a sequence with specified tag.

Parameters:
tag -
Returns:
one of VR.SEQ_NEW,VR.SEQ_UNDEFLEN,VR.SEQ_DEFLEN
Throws:
DicomException

getSize

public int getSize(int dname)
Method returns the number of values in the data element with name 'dname'. If it doesn't exist, the method returns -1. If it is empty, the method returns 0.


getSize_ge

public int getSize_ge(int g,
                      int e)
Does the same as getSize(dname) using a (group, element) - pair instead of 'dname'


calculateOffset

public long calculateOffset(int seq,
                            int i,
                            int transferSyntax,
                            boolean sequenceUndefined,
                            boolean grouplens)
This method calculates the offset of the 'i'th item of sequence 'seq', starting from the very first byte of the Dicom file. To calculate this correctly, this method must know what parameters will be used for writing.
Note: in future releases, this method will be deprecated because of a new class Offsets

Parameters:
seq - the name of the sequence the item is in
i - the number of the item
transferSyntax - the transfer syntax that will be used for writing this DicomObject
sequenceUndefined - what kind of sequence encoding will be used when writing this DicomObject
grouplens - boolean indicating whether grouplengths will be written

getOffset

public long getOffset(int seq,
                      int i)
returns the offset of the 'i'th SequenceItem 'seq'. Counting of Sequence Items starts with 0. No getOffset_ge is specified because unknown VRs always have DDict.tUNKNOWN. If the sequence or item aren't found, 0 is returned.
Note: the returned offset is only correct when a Dataset just has been parsed. If this is not the case, use calculateOffset(seq, item, ts, su, grouplen).


getString

public java.lang.String getString(int dname,
                                  int index)
                           throws DicomException
Throws:
DicomException

getString

public java.lang.String getString(int dname,
                                  int index,
                                  boolean trim)
                           throws DicomException
Throws:
DicomException

getString_ge

public java.lang.String getString_ge(int group,
                                     int element,
                                     int index)
                              throws DicomException
Throws:
DicomException

getString_ge

public java.lang.String getString_ge(int group,
                                     int element,
                                     int index,
                                     boolean trim)
                              throws DicomException
Throws:
DicomException

setString

public void setString(int dname,
                      java.lang.String s,
                      int index)
               throws DicomException
Throws:
DicomException

setString_ge

public void setString_ge(int group,
                         int element,
                         java.lang.String s,
                         int index)
                  throws DicomException
Throws:
DicomException

addString

public void addString(int dname,
                      java.lang.String s)
               throws DicomException
Throws:
DicomException

addString_ge

public void addString_ge(int group,
                         int element,
                         java.lang.String s)
                  throws DicomException
Throws:
DicomException

getBigDecimal

public java.math.BigDecimal getBigDecimal(int dname,
                                          int index)
                                   throws DicomException
Throws:
DicomException

getBigDecimal_ge

public java.math.BigDecimal getBigDecimal_ge(int group,
                                             int element,
                                             int index)
                                      throws DicomException
Throws:
DicomException

setBigDecimal

public void setBigDecimal(int dname,
                          java.math.BigDecimal bd,
                          int index)
                   throws DicomException
Throws:
DicomException

setBigDecimal_ge

public void setBigDecimal_ge(int group,
                             int element,
                             java.math.BigDecimal bd,
                             int index)
                      throws DicomException
Throws:
DicomException

addBigDecimal

public void addBigDecimal(int dname,
                          java.math.BigDecimal bd)
                   throws DicomException
Throws:
DicomException

addBigDecimal_ge

public void addBigDecimal_ge(int group,
                             int element,
                             java.math.BigDecimal bd)
                      throws DicomException
Throws:
DicomException

getShort

public java.lang.Short getShort(int dname,
                                int index)
                         throws DicomException
Throws:
DicomException

getShort_ge

public java.lang.Short getShort_ge(int group,
                                   int element,
                                   int index)
                            throws DicomException
Throws:
DicomException

setShort

public void setShort(int dname,
                     java.lang.Short sh,
                     int index)
              throws DicomException
Throws:
DicomException

setShort_ge

public void setShort_ge(int group,
                        int element,
                        java.lang.Short sh,
                        int index)
                 throws DicomException
Throws:
DicomException

addShort

public void addShort(int dname,
                     java.lang.Short sh)
              throws DicomException
Throws:
DicomException

addShort_ge

public void addShort_ge(int group,
                        int element,
                        java.lang.Short sh)
                 throws DicomException
Throws:
DicomException

getInteger

public java.lang.Integer getInteger(int dname,
                                    int index)
                             throws DicomException
Throws:
DicomException

getInteger_ge

public java.lang.Integer getInteger_ge(int group,
                                       int element,
                                       int index)
                                throws DicomException
Throws:
DicomException

setInteger

public void setInteger(int dname,
                       java.lang.Integer i,
                       int index)
                throws DicomException
Throws:
DicomException

setInteger_ge

public void setInteger_ge(int group,
                          int element,
                          java.lang.Integer i,
                          int index)
                   throws DicomException
Throws:
DicomException

addInteger

public void addInteger(int dname,
                       java.lang.Integer i)
                throws DicomException
Throws:
DicomException

addInteger_ge

public void addInteger_ge(int group,
                          int element,
                          java.lang.Integer i)
                   throws DicomException
Throws:
DicomException

getLong

public java.lang.Long getLong(int dname,
                              int index)
                       throws DicomException
Throws:
DicomException

getLong_ge

public java.lang.Long getLong_ge(int group,
                                 int element,
                                 int index)
                          throws DicomException
Throws:
DicomException

setLong

public void setLong(int dname,
                    java.lang.Long l,
                    int index)
             throws DicomException
Throws:
DicomException

setLong_ge

public void setLong_ge(int group,
                       int element,
                       java.lang.Long l,
                       int index)
                throws DicomException
Throws:
DicomException

addLong

public void addLong(int dname,
                    java.lang.Long l)
             throws DicomException
Throws:
DicomException

addLong_ge

public void addLong_ge(int group,
                       int element,
                       java.lang.Long l)
                throws DicomException
Throws:
DicomException

getFloat

public java.lang.Float getFloat(int dname,
                                int index)
                         throws DicomException
Throws:
DicomException

getFloat_ge

public java.lang.Float getFloat_ge(int group,
                                   int element,
                                   int index)
                            throws DicomException
Throws:
DicomException

setFloat

public void setFloat(int dname,
                     java.lang.Float f,
                     int index)
              throws DicomException
Throws:
DicomException

setFloat_ge

public void setFloat_ge(int group,
                        int element,
                        java.lang.Float f,
                        int index)
                 throws DicomException
Throws:
DicomException

addFloat

public void addFloat(int dname,
                     java.lang.Float f)
              throws DicomException
Throws:
DicomException

addFloat_ge

public void addFloat_ge(int group,
                        int element,
                        java.lang.Float f)
                 throws DicomException
Throws:
DicomException

getDouble

public java.lang.Double getDouble(int dname,
                                  int index)
                           throws DicomException
Throws:
DicomException

getDouble_ge

public java.lang.Double getDouble_ge(int group,
                                     int element,
                                     int index)
                              throws DicomException
Throws:
DicomException

setDouble

public void setDouble(int dname,
                      java.lang.Double d,
                      int index)
               throws DicomException
Throws:
DicomException

setDouble_ge

public void setDouble_ge(int group,
                         int element,
                         java.lang.Double d,
                         int index)
                  throws DicomException
Throws:
DicomException

addDouble

public void addDouble(int dname,
                      java.lang.Double d)
               throws DicomException
Throws:
DicomException

addDouble_ge

public void addDouble_ge(int group,
                         int element,
                         java.lang.Double d)
                  throws DicomException
Throws:
DicomException

getFloats

public float[] getFloats(int dname,
                         int index)
                  throws DicomException
Throws:
DicomException

getFloats_ge

public float[] getFloats_ge(int group,
                            int element,
                            int index)
                     throws DicomException
Throws:
DicomException

setFloats

public void setFloats(int dname,
                      float[] floats,
                      int index)
               throws DicomException
Throws:
DicomException

setFloats_ge

public void setFloats_ge(int group,
                         int element,
                         float[] floats,
                         int index)
                  throws DicomException
Throws:
DicomException

addFloats

public void addFloats(int dname,
                      float[] floats)
               throws DicomException
Throws:
DicomException

addFloats_ge

public void addFloats_ge(int group,
                         int element,
                         float[] floats)
                  throws DicomException
Throws:
DicomException

getATValue

public ATValue getATValue(int dname,
                          int index)
                   throws DicomException
Throws:
DicomException

getATValue_ge

public ATValue getATValue_ge(int group,
                             int element,
                             int index)
                      throws DicomException
Throws:
DicomException

setATValue

public void setATValue(int dname,
                       ATValue atValue,
                       int index)
                throws DicomException
Throws:
DicomException

setATValue_ge

public void setATValue_ge(int group,
                          int element,
                          ATValue atValue,
                          int index)
                   throws DicomException
Throws:
DicomException

addATValue

public void addATValue(int dname,
                       ATValue atValue)
                throws DicomException
Throws:
DicomException

addATValue_ge

public void addATValue_ge(int group,
                          int element,
                          ATValue atValue)
                   throws DicomException
Throws:
DicomException

getSequenceItem

public DicomObject getSequenceItem(int dname,
                                   int index)
                            throws DicomException
Throws:
DicomException

getSequenceItem_ge

public DicomObject getSequenceItem_ge(int group,
                                      int element,
                                      int index)
                               throws DicomException
Throws:
DicomException

setSequenceItem

public void setSequenceItem(int dname,
                            DicomObject item,
                            int index)
                     throws DicomException
Throws:
DicomException

setSequenceItem_ge

public void setSequenceItem_ge(int group,
                               int element,
                               DicomObject item,
                               int index)
                        throws DicomException
Throws:
DicomException

addSequenceItem

public void addSequenceItem(int dname,
                            DicomObject item)
                     throws DicomException
Throws:
DicomException

addSequenceItem_ge

public void addSequenceItem_ge(int group,
                               int element,
                               DicomObject dicomObject)
                        throws DicomException
Throws:
DicomException

getPersonName

public Person getPersonName(int dname,
                            int index)
                     throws DicomException
Throws:
DicomException

getPersonName_ge

public Person getPersonName_ge(int group,
                               int element,
                               int index)
                        throws DicomException
Throws:
DicomException

setPersonName

public void setPersonName(int dname,
                          Person person,
                          int index)
                   throws DicomException
Throws:
DicomException

setPersonName

public void setPersonName(int dname,
                          Person person,
                          int index,
                          DicomCharset singleByteCharset,
                          DicomCharset ideographicCharset,
                          DicomCharset phoneticCharset)
                   throws DicomException
sets a value of a PN data element at the specified tag and index. See setPersonName_ge(int,Person,index,DicomCharset,DicomCharset,DicomCharset) for an explanation of the use of the different charsets

Throws:
DicomException

setPersonName_ge

public void setPersonName_ge(int group,
                             int element,
                             Person person,
                             int index)
                      throws DicomException
Throws:
DicomException

setPersonName_ge

public void setPersonName_ge(int group,
                             int element,
                             Person person,
                             int index,
                             DicomCharset singleByteCharset,
                             DicomCharset ideographicCharset,
                             DicomCharset phoneticCharset)
                      throws DicomException
sets a value of a PN element at the specified tag and index. For every component group (single-byte,ideographic and phonetic) of the Person object a charset must be specified in which the component group must be encoded, unless the component group is completely absent in which case null can be specified.
Note: In order to produce a correct DICOM file or stream,the singleByteCharset must be the same as the first value of the SpecificCharset tag (0008,0005). If this tag is absent or the first value of this tag is empty ,the singleByteCharset must be DicomCharset.DEFAULT.

Parameters:
group -
element -
person -
index -
singleByteCharset -
ideographicCharset -
phoneticCharset -
Throws:
DicomException

addPersonName

public void addPersonName(int dname,
                          Person person)
                   throws DicomException
Throws:
DicomException

addPersonName

public void addPersonName(int dname,
                          Person person,
                          DicomCharset singleByteCharset,
                          DicomCharset ideographicCharset,
                          DicomCharset phoneticCharset)
                   throws DicomException
adds a Person value to a PN data element. See setPersonName_ge(int,Person,index,DicomCharset,DicomCharset,DicomCharset) for an explanation of the use of the different charsets

Parameters:
dname -
person -
singleByteCharset -
ideographicCharset -
phoneticCharset -
Throws:
DicomException

addPersonName_ge

public void addPersonName_ge(int group,
                             int element,
                             Person person)
                      throws DicomException
Throws:
DicomException

addPersonName_ge

public void addPersonName_ge(int group,
                             int element,
                             Person person,
                             DicomCharset singleByteCharset,
                             DicomCharset ideographicCharset,
                             DicomCharset phoneticCharset)
                      throws DicomException
adds a Person value to a PN data element. See setPersonName_ge(int,Person,index,DicomCharset,DicomCharset,DicomCharset) for an explanation of the use of the different charsets

Parameters:
group -
element -
person -
singleByteCharset -
ideographicCharset -
phoneticCharset -
Throws:
DicomException

getBytes

public byte[] getBytes(int dname,
                       int index)
                throws DicomException
Throws:
DicomException

getBytes_ge

public byte[] getBytes_ge(int group,
                          int element,
                          int index)
                   throws DicomException
Throws:
DicomException

setBytes

public void setBytes(int dname,
                     byte[] bytes,
                     int index)
              throws DicomException
Throws:
DicomException

setBytes_ge

public void setBytes_ge(int group,
                        int element,
                        byte[] bytes,
                        int index)
                 throws DicomException
Throws:
DicomException

addBytes

public void addBytes(int dname,
                     byte[] bytes)
              throws DicomException
Throws:
DicomException

addBytes_ge

public void addBytes_ge(int group,
                        int element,
                        byte[] bytes)
                 throws DicomException
Throws:
DicomException

getDataElement

public DataElement getDataElement(int dname)
returns the tag value as a DataElement for the specified DDict constant or null if this object does not contain such a DataElement.

Parameters:
dname - a DDict constant

getDataElement

public DataElement getDataElement(int group,
                                  int element)
returns the tag value as a DataElement for the specified group and element number or null if this object does not contain such a DataElement.

Parameters:
group -
element -
Returns:

get

public java.lang.Object get(int dname)
This method finds the first value of the data element named 'dname' and returns it as its default Java type. If the data element does'nt exist or is empty, the method returns null.


get_ge

public java.lang.Object get_ge(int g,
                               int e)
Does the same as get(dname) using a (group, element) - pair instead of 'dname'.


get

public java.lang.Object get(int dname,
                            int i)
This method finds the value at index 'i' of the data element named 'dname' and returns it as its default Java type. If the data element does'nt exist, the method returns 'null'.


get_ge

public java.lang.Object get_ge(int g,
                               int e,
                               int i)
Does the same as get(dname, i) using a (group, element) - pair instead of 'dname'


getS

public java.lang.String getS(int dname)
                      throws DicomException
Gets the same value as in get(dname) and, if possible, returns it as a String. If the data element does'nt exist or is empty, the method returns null.

Throws:
DicomException

getS_ge

public java.lang.String getS_ge(int g,
                                int e)
                         throws DicomException
Does the same as getS(dname) using a (group, element) - pair instead of 'dname'

Throws:
DicomException

getS

public java.lang.String getS(int dname,
                             int i)
                      throws DicomException
Gets the same value as in get(dname, i) and, if possible, returns it as a String. If the data element doesn't exist, the method returns 'null'.

Throws:
DicomException

getS_ge

public java.lang.String getS_ge(int g,
                                int e,
                                int i)
                         throws DicomException
Gets the same value as in get_ge(g, e, i) and, if possible, returns it as a String. If the data element doesn't exist, the method returns 'null'.

Throws:
DicomException

getI

public int getI(int dname)
         throws DicomException
Gets the same value as in get(dname) and, if possible, returns it as an int. If the Data Element is not present, this method returns Integer.MAX_VALUE. An exception is thrown if the requested value cannot be converted to int.

Throws:
DicomException

getI_ge

public int getI_ge(int g,
                   int e)
            throws DicomException
Does the same as getI(dname) using a (group, element) - pair instead of 'dname'

Throws:
DicomException

getI

public int getI(int dname,
                int i)
         throws DicomException
Gets the same value as in get(dname, i) and, if possible, returns it as an int. If the Data Element is not present, this method returns Integer.MAX_VALUE. An exception is thrown if the requested value cannot be converted to int.

Throws:
DicomException

getI_ge

public int getI_ge(int g,
                   int e,
                   int i)
            throws DicomException
Does the same as getI(dname, i) using a (group, element) - pair instead of 'dname'

Throws:
DicomException

remove

public void remove(int dname)

remove_ge

public void remove_ge(int group,
                      int element)

deleteItem

public java.util.Vector deleteItem(int dname)
Deletes the data element named 'dname' from this DicomObject and returns the values of that data element as a Vector.


deleteItem_ge

public java.util.Vector deleteItem_ge(int g,
                                      int e)
Does the same as deleteItem(dname) using a (group, element) - pair instead of 'dname'


deleteItem

public java.lang.Object deleteItem(int dname,
                                   int i)
Deletes the value at index 'i' from the data element called 'dname' The elements with a higher index are all shifted downwards.

Returns:
the deleted value

deleteItem_ge

public java.lang.Object deleteItem_ge(int g,
                                      int e,
                                      int i)
Does the same as deleteItem(dname, i) using a (group, element) - pair instead of 'dname'


read

public void read(java.io.InputStream in)
          throws java.io.IOException,
                 DicomException
Does the same as read(in, readpixels), with the 'readpixels' boolean set to true.

Note:This method is maintained for backwards compatibility only and delegates to the DicomReader class. New implementations should use the DicomReader class.

Throws:
java.io.IOException
DicomException

read

public void read(java.io.InputStream in,
                 boolean readpixels)
          throws java.io.IOException,
                 DicomException
reads a DICOM dataset from an InputStream and stores the data elements in this DicomObject.
The method automatically detects if the InputStream holds a DICOM file or a DICOM stream. If none of the above are the case, an exception is thrown.

Note:This method is maintained for backwards compatibility only and delegates to the DicomReader class. New implementations should use the DicomReader class.

Parameters:
in - the InputStream from which must the DICOM stream must be read.
readpixels - A boolean indicating whether to read pixel data
Throws:
java.io.IOException
DicomException

read

public void read(java.io.InputStream in,
                 int transfersyntax,
                 boolean readpixels)
          throws java.io.IOException,
                 DicomException
reads a DICOM Dataset from an InputStream. The transfer syntax is specified (not detected as with DICOM Files)

Note:This method is maintained for backwards compatibility only and delegates to the DicomReader class. New implementations should use the DicomReader class.

Parameters:
in - the InputStream to a DICOM dataset
transfersyntax - the transfer syntax with which this Dataset is encoded
readpixels - A boolean indicating whether to read pixel data
Throws:
java.io.IOException
DicomException
See Also:
TransferSyntax

write

public void write(java.io.OutputStream out,
                  boolean dicomfile)
           throws DicomException,
                  java.io.IOException
writes this DICOM data set to an OutputStream as a DICOM file or DICOM stream.

Note:This method is maintained for backwards compatibility only and delegates to the DicomWriter class. New implementations should use the DicomWriter.write(DicomObject,OutputStream,boolean) method.

Parameters:
dicomfile - indicates whether the data set should be written as a DICOM file (see Part 3.10)(true) or as a DICOM stream (false)
out -
Throws:
DicomException
java.io.IOException

write

public void write(java.io.OutputStream out,
                  boolean dicomfile,
                  int transfersyntax,
                  boolean seq_undef)
           throws DicomException,
                  java.io.IOException
writes this DICOM data set to an OutputStream as a DICOM file or DICOM stream. The user can specify what transfer syntax and what sequence encoding to use.

Note:This method is maintained for backwards compatibility only and delegates to the DicomWriter class. New implementations should use the DicomWriter class.

Parameters:
out - the outputstream written to
dicomfile - true for writing a DICOM part 10 file, false for a raw dataset
transfersyntax - the transfersyntax to use for writing
seq_undef - true - all sequences and items are encoded using undefined length, false - all sequences and items are encoded using defined length
Throws:
DicomException
java.io.IOException
See Also:
TransferSyntax

write

public void write(java.io.OutputStream out,
                  boolean dicomfile,
                  int transfersyntax,
                  boolean seq_undef,
                  boolean grouplens)
           throws DicomException,
                  java.io.IOException
Does the same as write(out, f, ts, seq_undef) and, in addition, lets you specify whether to write grouplengths.

Note:This method is maintained for backwards compatibility only and delegates to the DicomWriter class. New implementations should use the DicomWriter class.

Parameters:
out - the outputstream written to
dicomfile - true for writing a DICOM part 10 file, false for a raw dataset
transfersyntax - the transfersyntax to use for writing
seq_undef - true - all sequences and items are encoded using undefined length, false - all sequences and items are encoded using defined length
grouplens - set to true to include group length tags
Throws:
DicomException
java.io.IOException

getFileMetaInformation

public DicomObject getFileMetaInformation()
File Meta Information is stored in a separate DicomObject. If a file is read, the meta information is parsed in this separate DicomObject. Prior to writing of a file, the existing meta info is adjusted or created. Use the DicomObject returned by this method to add or change specific Data Elements. Mind not to use any other Data Elements than those specified in Part 3.10


setFileMetaInformation

public DicomObject setFileMetaInformation(DicomObject fmi)
Use this method to specify a new file meta information object that will be used when writing to a Dicom file. Mind not to use any other Data Elements than those specified in Part 3.10


dumpVRs

public void dumpVRs(java.io.OutputStream os)
             throws java.io.IOException
prints all data elements in this DicomObject to an OutputStream in a nice, orderly fashion. Starting from 1.17 this method uses the dump method of DumpUtils

Throws:
java.io.IOException
See Also:
DumpUtils

dumpVRs

public void dumpVRs(java.io.OutputStream os,
                    boolean metainfo)
             throws java.io.IOException
prints all data elements in this DicomObject to an OutputStream in a nice, orderly fashion.
Please use a MonoSpaced Font for visualisation, otherwise the columns will come out wrong. Starting from 1.17 this method uses the dump method of DumpUtils

Parameters:
metainfo - specifies whether to print out the File Meta Information (if present).
Throws:
java.io.IOException
See Also:
DumpUtils

Trispark JDT
2.50.13

Copyright © 1999-2008 Trispark. All Rights Reserved.