Class FileDicomSQ

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class FileDicomSQ
    extends ModelSerialCloneable
    This is a class for reading in a DICOM sequence tag. For more information about the DICOM sequence tag see the DICOM standard, Part 5, Section 7.5.

    The sequence tag is encoded as follows:

    1. A group and element tag indicating that this is a sequence, followed by a length. The group and element tag are stored in the regular FileInfoDicom object. The length is stored there and also here. Often a sequence will have an undefined length, which is defined in FileDicom.
    2. A series of item tags. Each item tag is read in, the length of the entire item is stored, and the item is read in. The item is simply a series of DICOM tags with data in them. That information is stored in the class DicomItem.
    3. A tag indicating the end of the sequence.

      Given this encoding, the DicomSQ structure is set up as a Vector. The length variable is the length of the sequence as given in the header and NOT the length of the Vector. The Vector is a series of DicomItems. Each DicomItem is a set of tags.

    Author:
    Neva Cherniavsky
    See Also:
    FileDicomItem, FileDicom, FileInfoDicom, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Vector<FileDicomSQItem> sequence
      Sequences are composed of items (DICOM items) and store in a vector object.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private boolean writeAsUnknownLength
      Whether the sequence should be written using an unknown length
    • Constructor Summary

      Constructors 
      Constructor Description
      FileDicomSQ()
      Creates a new DicomSQ object with initial length.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(FileDicomSQItem item)
      Add an item to the sequence vector.
      boolean doWriteAsUnknownLength()
      Whether the sequence should be written using an unknown length, can be set as a preference by user.
      void finalize()
      Prepares this class for cleanup.
      int getDataLength()
      Returns the size of the data held in this sequence in number of bytes, including the number of bytes required to delimit each item.
      FileDicomSQItem getItem​(int index)
      Gets the specified item from the sequence vector.
      java.util.Vector<FileDicomSQItem> getSequence()  
      java.util.Vector<java.lang.String> getSequenceDisplay()
      Gets a series of Strings that are the human readable version of the data.
      int getSequenceLength()
      Gets the length of the sequence vector.
      int getWritableLength()
      Gets the length as read in by the header (possibly undefined).
      void setWriteAsUnknownLength​(boolean writeAsUnknownLength)
      Whether the sequence should be written using an unknown length, this includes adding a sequence delimitation item to the sequence.
      java.lang.String toString()
      Returns the word 'Sequence'.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • sequence

        private java.util.Vector<FileDicomSQItem> sequence
        Sequences are composed of items (DICOM items) and store in a vector object.
      • writeAsUnknownLength

        private boolean writeAsUnknownLength
        Whether the sequence should be written using an unknown length
    • Constructor Detail

      • FileDicomSQ

        public FileDicomSQ()
        Creates a new DicomSQ object with initial length.
    • Method Detail

      • addItem

        public final void addItem​(FileDicomSQItem item)
        Add an item to the sequence vector.
        Parameters:
        item - item to add
      • finalize

        public void finalize()
        Prepares this class for cleanup.
        Overrides:
        finalize in class java.lang.Object
      • getDataLength

        public int getDataLength()
        Returns the size of the data held in this sequence in number of bytes, including the number of bytes required to delimit each item. Always returns the exact number of bytes used for the current state of the sequence.
        Returns:
        the size of the data held in this sequence in number of bytes.
      • getItem

        public final FileDicomSQItem getItem​(int index)
        Gets the specified item from the sequence vector.
        Parameters:
        index - index in the vector
        Returns:
        The specified item from the sequence.
      • getWritableLength

        public final int getWritableLength()
        Gets the length as read in by the header (possibly undefined).
        Returns:
        The length of the sequence as read in by the header
      • getSequenceDisplay

        public java.util.Vector<java.lang.String> getSequenceDisplay()
        Gets a series of Strings that are the human readable version of the data.
        Returns:
        A list that contains the human readable form of the sequence data
      • getSequenceLength

        public final int getSequenceLength()
        Gets the length of the sequence vector.
        Returns:
        the sequence length
      • toString

        public java.lang.String toString()
        Returns the word 'Sequence'.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string 'Sequence' (without the quotes).
      • doWriteAsUnknownLength

        public boolean doWriteAsUnknownLength()
        Whether the sequence should be written using an unknown length, can be set as a preference by user.
      • setWriteAsUnknownLength

        public void setWriteAsUnknownLength​(boolean writeAsUnknownLength)
        Whether the sequence should be written using an unknown length, this includes adding a sequence delimitation item to the sequence.