Class InfoList

All Implemented Interfaces:
Serializable, Cloneable, Iterable<InfoItem>, Collection<InfoItem>, List<InfoItem>, RandomAccess

public class InfoList extends ArrayList<InfoItem>
Representation of a list of information to be associated either with an image as a whole, or with a particular element of a particular dimension of an image.

For example, a 3-D multi-slice image may have different information for each slice. Thus, the information will be different for each element (slice) of dimension 0.

Always use the appropriate methods in the image class to retrieve and manipulate the info fields for an image.

See Also:
  • Constructor Details

    • InfoList

      public InfoList()
      Construct an empty InfoList.
    • InfoList

      public InfoList(DataInputStream s) throws IOException
      Creates a InfoList Object by reading it from a DataInputStream.
      Parameters:
      s - the DataInputStream that will supply the InfoList.
      Throws:
      IOException - if the InfoList cannot be read completely from the stream.
    • InfoList

      public InfoList(String HTMLList) throws InfoListException
      Creates an InfoList from an HTML description of that list. The HTML description will its self have been returned by InfoList.toHTML().
      Parameters:
      HTMLList - a String of HTML that was its self created by InfoList.toHTML().
      Throws:
      InfoListException - if there is an error in the HTML describing the InfoList.
  • Method Details

    • write

      public void write(DataOutputStream s) throws IOException
      Write an InfoList to a DataOutputStream.
      Parameters:
      s - the DataOutputStream to which the InfoList will be written.
      Throws:
      IOException - if the InfoList cannot be written.
    • write

      public void write(RandomAccessFile f) throws IOException
      Write an InfoList to a RandomAccessFile. The file pointer must be positioned at the right point in the file before this call.
      Parameters:
      f - the RandomAccessFile to which the InfoList will be written.
      Throws:
      IOException - if the InfoList cannot be written.
    • getInfo

      public String getInfo(String name) throws InfoNotFoundException
      An InfoList is a list of Strings of the form "name=value". This method returns the value for a given name.
      Parameters:
      name - the name of the information item.
      Returns:
      the value of the information item.
      Throws:
      InfoNotFoundException - if the name is null, or the information item cannot be found.
    • putInfo

      public void putInfo(String name, String value)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If either name or value is null, then this method does nothing.
      Parameters:
      name - the name of the information item.
      value - the value of the information item.
    • putInfo

      public void putInfo(String name, int value)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.
      Parameters:
      name - the name of the information item.
      value - the value of the information item.
    • putInfo

      public void putInfo(String name, long value)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.
      Parameters:
      name - the name of the information item.
      value - the value of the information item.
    • putInfo

      public void putInfo(String name, float value)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.
      Parameters:
      name - the name of the information item.
      value - the value of the information item.
    • putInfo

      public void putInfo(String name, double value)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.
      Parameters:
      name - the name of the information item.
      value - the value of the information item.
    • putInfo

      public void putInfo(String name, Date date)
      Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.
      Parameters:
      name - the name of the information item.
      date - the value of the information item.
    • removeInfo

      public void removeInfo(String name)
      Removes "name=value" from the InfoList.
      Parameters:
      name - the name of the information item to remove.
    • append

      public void append(InfoList extraInfo)
      Appends an InfoList onto the end of an existing one.
      Parameters:
      extraInfo - the InfoList of extra information items to append.
    • anonymise

      public void anonymise(String patientName, String patientID, Date birthDate, boolean patSex, String patAddr, String patInsurancePlanID, String accessionNumber, boolean patOther, String physicianName, String physicianAddr, String institutionName, String institutionAddr, String deptName, String stationName, String telNumber, boolean removePrivateElements)
      Anonymise the items in this InfoList.
      Parameters:
      patientName - if non-null, the patient name to substitute.
      patientID - if non-null, the patient ID to substitute.
      birthDate - if non-null, the birth date to substitute.
      patSex - if true, set the sex to "OTHER".
      patAddr - if non-null, the address to substitute.
      patInsurancePlanID - if non-null, the insurance plan ID to substitute.
      accessionNumber - if non-null, the accession number to substitute.
      patOther - if true, other patient-related items will be anonymised.
      physicianName - if non-null, the physician name to substitute.
      physicianAddr - if non-null, the physician's address to substitute.
      institutionName - if non-null, the institution name to substitute.
      institutionAddr - if non-null, the institution address to substitute.
      deptName - if non-null, the department name to substitute.
      stationName - if non-null, the station name to substitute.
      telNumber - if non-null, the telephone number to substitute for all telephone numbers.
      removePrivateElements - if true, all private DICOM elements will be removed.
    • toString

      public String toString()
      Creates a description of this InfoList.
      Overrides:
      toString in class AbstractCollection<InfoItem>
      Returns:
      a String description of this InfoList.
    • toHTML

      public String toHTML()
      Creates a description of this InfoList in HTML format.
      Returns:
      a String description of this InfoList in HTML format.
    • sortInfo

      public static void sortInfo(InfoList generalInfo, InfoList[] sliceInfo, int slice)
      Sort info from a slice into slice-specific info or general info. The info that applies to the specified slice is sorted into:
      • Information that is already in the general info and has the same value as the general info. This is deleted from the slice-specific info for the specified slice.
      • Information that is already in the general info and has a different value from that in the general info. This is removed from the general info and added to the slice-specific info for all the slices that currently have slice-specific info. The slice-specific info is retain for the currently-considered slice.
      Parameters:
      generalInfo - the current set of general info that applied to the image as a whole and that is not slice-specific.
      sliceInfo - an array of InfoList containing the current sorted slice-specific info. Some of the elements of sliceInfo may be null if they haven't yet been retrieved for the slice.
      slice - the index to the sliceInfo that has just been obtained.
    • getCommonInfo

      public static InfoList getCommonInfo(InfoList[] info)
      Returns an InfoList which contains only those InfoItems that are found in every element of the supplied InfoList[].
      Parameters:
      info - the InfoList[] for which to search for common items in every element.
      Returns:
      an InfoList which contains only those InfoItems that common to all the supplied InfoLists.
    • clone

      public InfoList clone()
      Makes a copy of this InfoList.
      Overrides:
      clone in class ArrayList<InfoItem>
      Returns:
      a copy of this InfoList.