org.dicom4j.data
Class DataSet

java.lang.Object
  extended by org.dicom4j.data.DataSet
Direct Known Subclasses:
AbstractModule, CommandSet, FileMetaInformation

public class DataSet
extends Object

DICOM DataSet (a list ofDataElements )

a dataset is used to manage a list of elements, a dataset can be read or write on a file system using DicomFileReader or DicomFileWriter. or send over a network.

this class offer specific getter of setter to get/set elements depending of their type. A cast error will be raised if you try to get an element of a wrong type.

Since:
0.0.0
Author:
Laurent Lecomte

Constructor Summary
DataSet()
           
DataSet(DataSet aDataSet)
           
 
Method Summary
 ApplicationEntity addApplicationEntity(ApplicationEntity element, String singleValue)
          add a new ApplicationEntity element, and set the single sting value
 CodeString addCodeString(CodeString element, String singleValue)
           
 DataSet addDataSet(DataSet aDataSet)
          add all data contains in the DataSet into this (NOT A COPY)
 DataElement addElement(DataElement aDataElement)
          Add a new DataElement
 IntegerString addIntegerString(IntegerString element, String singleValue)
          add an IntegerString, and set the supplied value
 AbstractModule addModule(AbstractModule aModule)
          Add a new module to the DataSet
 PersonName addPersonName(PersonName personNameElement)
          add a new PersonName element
 PersonName addPersonName(PersonName element, String aSingleValue)
          add an PersonName, and set the supplied value
 ShortString addShortString(ShortString element, String singleValue)
           
 UniqueIdentifier addUniqueIdentifier(UniqueIdentifier element, String singleValue)
          add an UniqueIdentifier, and set the supplied value
 void clear()
          call clear method for all element.
 int count()
          Return the number of Elements in the DataSet
 ApplicationEntity getApplicationEntity(DicomTag aDataElementTag)
           
 ApplicationEntity getApplicationEntityOrNull(DicomTag aDataElementTag)
          get an ApplicationEntity element
 DataElement getAttribute(int aIndex)
          Deprecated. use iterator
 CodeString getCodeString(DicomTag tag)
           
 DataSet getDataElementsOfSameGroup(int aGroup)
          Return all Attribute of the same group
 DateElement getDate(DicomTag tag)
           
static double[] getDoubleValues(DataSet aDataSet, DicomTag tag)
           Get the values of a named attribute in an attribute list, as an array of double.
 DataElement getElement(DicomTag aAttributeTag)
          Return the DataElement associated whith aAttributeTag
 DataElement getElementOrNull(DicomTag aAttributeTag)
          Retrun the DataElement associated whith aAttributeTa
 IntegerString getIntegerString(DicomTag tag)
          Return a IntegerString element depending of the supplied DicomTag
 Iterator<DataElement> getIterator()
          Return an Iterator for this DataSet
 LongString getLongString(DicomTag tag)
           
 LongString getLongStringOrNull(DicomTag aDataElementTag)
           
 LongText getLongText(DicomTag aDataElementTag)
           
 LongText getLongTextOrNull(DicomTag aDataElementTag)
           
 OtherByteString getOtherByteString(DicomTag aDataElementTag)
           
 OtherByteString getOtherByteStringOrNull(DicomTag aDataElementTag)
           
 PersonName getPersonName(DicomTag tag)
           
 PersonName getPersonNameOrNull(DicomTag aDataElementTag)
           
 SequenceOfItems getSequenceOfItems(DicomTag tag)
          get a SequenceOfItems element
 SequenceOfItems getSequenceOfItemsOrNull(DicomTag aDataElementTag)
          get a SequenceOfItems element or Null
 ShortString getShortString(DicomTag aTag)
           
 Time getTime(DicomTag tag)
           
 UniqueIdentifier getUniqueIdentifier(DicomTag aDataElementTag)
           
 UniqueIdentifier getUniqueIdentifierOrNull(DicomTag aDataElementTag)
           
 UnsignedLong getUnsignedLong(DicomTag tag)
           
 UnsignedLong getUnsignedLongOrNull(DicomTag aDataElementTag)
           
 UnsignedShort getUnsignedShort(DicomTag aDataElementTag)
           
 boolean hasElement(DicomTag aAttributeTag)
           
 void read(byte[] aBytes, TransferSyntax aTransferSyntax)
          Deprecated. use reader instead
 void read(InputStream aStream, TransferSyntax aTransferSyntax)
          Deprecated. use reader instead
 void removeAll()
          Remove all elements
 DataElement removeElement(DataElement element)
          remove the supplied element from the Dataset
 DataElement removeElement(DicomTag tag)
          remove an element depending of his tag
 Object[] toArray()
          get all elements as an array of objects
 byte[] toBytes(TransferSyntax aTransferSyntax)
          Deprecated.  
 String toString()
           
 void write(OutputStream aStream, TransferSyntax aTransferSyntax)
          Deprecated. use reader instead
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSet

public DataSet()

DataSet

public DataSet(DataSet aDataSet)
Method Detail

getDoubleValues

public static double[] getDoubleValues(DataSet aDataSet,
                                       DicomTag tag)

Get the values of a named attribute in an attribute list, as an array of double.

If there is no such attribute, null is returned.

If there is an exception trying to fetch the values, null is returned.

Parameters:
aDataSet - the list of attributes in which to look for the attribute
tag - the tag of the attribute to find
Returns:
the values as an array of double

addDataSet

public DataSet addDataSet(DataSet aDataSet)
add all data contains in the DataSet into this (NOT A COPY)

Parameters:
aDataSet -
Returns:
the added DataSet

addElement

public DataElement addElement(DataElement aDataElement)
Add a new DataElement

Parameters:
aDataElement - the element to add
Returns:
the added element
See Also:
DataElement

addApplicationEntity

public ApplicationEntity addApplicationEntity(ApplicationEntity element,
                                              String singleValue)
add a new ApplicationEntity element, and set the single sting value

Parameters:
element - the element to add
aSingleValue - the single string value to set
Returns:
the added element
Since:
0.0.8

addCodeString

public CodeString addCodeString(CodeString element,
                                String singleValue)

addPersonName

public PersonName addPersonName(PersonName personNameElement)
add a new PersonName element

Parameters:
personNameElement - the element
Returns:
the added element

addPersonName

public PersonName addPersonName(PersonName element,
                                String aSingleValue)
add an PersonName, and set the supplied value

Parameters:
element - the element to add
singleValue - the value to set
Returns:
the added element
Since:
0.0.8

addShortString

public ShortString addShortString(ShortString element,
                                  String singleValue)

addUniqueIdentifier

public UniqueIdentifier addUniqueIdentifier(UniqueIdentifier element,
                                            String singleValue)
add an UniqueIdentifier, and set the supplied value

Parameters:
element - the element to add
singleValue - the value to set
Returns:
the added element

addIntegerString

public IntegerString addIntegerString(IntegerString element,
                                      String singleValue)
add an IntegerString, and set the supplied value

Parameters:
element - the element to add
singleValue - the value to set
Returns:
the added element
Since:
0.0.8

addModule

public AbstractModule addModule(AbstractModule aModule)
Add a new module to the DataSet

Parameters:
aModule - the module to add
Returns:
the added module

clear

public void clear()
call clear method for all element.


count

public int count()
Return the number of Elements in the DataSet

Returns:
number of Elements

getApplicationEntity

public ApplicationEntity getApplicationEntity(DicomTag aDataElementTag)
                                       throws NoSuchElementException,
                                              WrongDataElementTypeException
Parameters:
aDataElementTag -
Returns:
Throws:
NoSuchElementException
WrongDataElementTypeException

getApplicationEntityOrNull

public ApplicationEntity getApplicationEntityOrNull(DicomTag aDataElementTag)
get an ApplicationEntity element

Parameters:
aDataElementTag - the dicom tag
Returns:

getAttribute

@Deprecated
public DataElement getAttribute(int aIndex)
Deprecated. use iterator

Parameters:
aIndex -
Returns:

getCodeString

public CodeString getCodeString(DicomTag tag)

getDataElementsOfSameGroup

public DataSet getDataElementsOfSameGroup(int aGroup)
Return all Attribute of the same group

Parameters:
aGroup - the group
Returns:

getDate

public DateElement getDate(DicomTag tag)

getElement

public DataElement getElement(DicomTag aAttributeTag)
Return the DataElement associated whith aAttributeTag

Parameters:
aAttributeTag - the Tag
Returns:

getElementOrNull

public DataElement getElementOrNull(DicomTag aAttributeTag)
Retrun the DataElement associated whith aAttributeTa

Parameters:
aAttributeTag - the tag
Returns:
the element (can be null)

getIntegerString

public IntegerString getIntegerString(DicomTag tag)
                               throws NoSuchElementException,
                                      WrongDataElementTypeException
Return a IntegerString element depending of the supplied DicomTag

Parameters:
tag - the element's tag
Returns:
the element
Throws:
NoSuchElementException - if the element isn't not present in the dataset
WrongDataElementTypeException - if the element's type is not IntegerString

getIterator

public Iterator<DataElement> getIterator()
Return an Iterator for this DataSet

Returns:
the Iterator

getLongString

public LongString getLongString(DicomTag tag)

getLongStringOrNull

public LongString getLongStringOrNull(DicomTag aDataElementTag)

getLongText

public LongText getLongText(DicomTag aDataElementTag)
                     throws NoSuchElementException,
                            WrongDataElementTypeException
Throws:
NoSuchElementException
WrongDataElementTypeException

getLongTextOrNull

public LongText getLongTextOrNull(DicomTag aDataElementTag)

getOtherByteString

public OtherByteString getOtherByteString(DicomTag aDataElementTag)

getOtherByteStringOrNull

public OtherByteString getOtherByteStringOrNull(DicomTag aDataElementTag)

getPersonName

public PersonName getPersonName(DicomTag tag)

getPersonNameOrNull

public PersonName getPersonNameOrNull(DicomTag aDataElementTag)

getSequenceOfItems

public SequenceOfItems getSequenceOfItems(DicomTag tag)
get a SequenceOfItems element

Parameters:
tag -
Returns:

getSequenceOfItemsOrNull

public SequenceOfItems getSequenceOfItemsOrNull(DicomTag aDataElementTag)
get a SequenceOfItems element or Null

Parameters:
aDataElementTag -
Returns:

getShortString

public ShortString getShortString(DicomTag aTag)

getTime

public Time getTime(DicomTag tag)

getUniqueIdentifier

public UniqueIdentifier getUniqueIdentifier(DicomTag aDataElementTag)
                                     throws NoSuchElementException,
                                            WrongDataElementTypeException
Throws:
NoSuchElementException
WrongDataElementTypeException

getUniqueIdentifierOrNull

public UniqueIdentifier getUniqueIdentifierOrNull(DicomTag aDataElementTag)

getUnsignedLong

public UnsignedLong getUnsignedLong(DicomTag tag)

getUnsignedLongOrNull

public UnsignedLong getUnsignedLongOrNull(DicomTag aDataElementTag)

getUnsignedShort

public UnsignedShort getUnsignedShort(DicomTag aDataElementTag)

hasElement

public boolean hasElement(DicomTag aAttributeTag)

read

@Deprecated
public void read(byte[] aBytes,
                            TransferSyntax aTransferSyntax)
          throws IOException,
                 DicomException,
                 Exception
Deprecated. use reader instead

populate the DataSet from data readed from bytes

Parameters:
aBytes - the bytes to read
aTransferSyntax - the TransferSyntax to use
Throws:
IOException
DicomException
Exception

read

@Deprecated
public void read(InputStream aStream,
                            TransferSyntax aTransferSyntax)
          throws IOException,
                 DicomException,
                 Exception
Deprecated. use reader instead

populate the DataSet from data readed from a Stream

Parameters:
aStream - the Stream to read
aTransferSyntax - the TransferSyntax to use
Throws:
IOException
DicomException
Exception

removeAll

public void removeAll()
Remove all elements


removeElement

public DataElement removeElement(DataElement element)
remove the supplied element from the Dataset

Parameters:
element - the element to remote
Returns:
the removed element (null is element is null too)

removeElement

public DataElement removeElement(DicomTag tag)
remove an element depending of his tag

Parameters:
tag - the tag
Returns:
the remove element (or null if not present in the Dataset)

toArray

public Object[] toArray()
get all elements as an array of objects

Returns:

toBytes

@Deprecated
public byte[] toBytes(TransferSyntax aTransferSyntax)
               throws IOException,
                      DicomException
Deprecated. 

Throws:
IOException
DicomException

toString

public String toString()
Overrides:
toString in class Object

write

@Deprecated
public void write(OutputStream aStream,
                             TransferSyntax aTransferSyntax)
           throws IOException,
                  DicomException
Deprecated. use reader instead

Write the DataSet into a stream

Parameters:
aStream - the Stream to write
aTransferSyntax - the TransferSyntax to use
Throws:
IOException
DicomException


Copyright © 2009 dicom4j. All Rights Reserved.