Class FileInfoDicom

All Implemented Interfaces:
Serializable, Cloneable

public class FileInfoDicom extends FileInfoBase

This class contains DICOM header information. It uses a table to store all the information about the tags. The FileDicomTagTable listing all known tags with empty values is in DicomDictionary. Also stored here is the offset of the image, the image number, the resolutions, some pixel data, the bytes allocated, and the dimensions of the image.

This file also contains a table used for displaying the tag information. There is an option to display just the standard tags or both the standard and the private tags.

Version:
1.0 Aug 1, 1999
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • UNDEFINED_PIXEL_REP

      public static final int UNDEFINED_PIXEL_REP
      (0028,0103) Pixel Representations
      See Also:
    • UNSIGNED_PIXEL_REP

      public static final int UNSIGNED_PIXEL_REP
      (0028,0103) Pixel Representations
      See Also:
    • SIGNED_PIXEL_REP

      public static final int SIGNED_PIXEL_REP
      (0028,0103) Pixel Representations
      See Also:
    • RLETAMARencapsulatedOffset

      private int RLETAMARencapsulatedOffset
    • anonymizeTagIDs

      public static final String[] anonymizeTagIDs
      these are the DICOM tag ID numbers corresponding to the tags which are anonymized. They are kept here for simplicity of updating (when it is decided that other tags are must be anonymized) and to the advantage of calling objects.
    • bitsAllocated

      public short bitsAllocated
      Bits allocated per pixel.
    • bitsStored

      public short bitsStored
      Bits stored per pixel>
    • highBit

      public short highBit
    • bytesPerPixel

      public short bytesPerPixel
      Number of bytes per pixel.
    • originalDataType

      public int originalDataType
    • containsDICM

      public boolean containsDICM
      True if the DICOM file has the ID DICM at beginning at file pointer 128.
    • displayType

      public int displayType
      Data type.
    • instanceNumber

      public int instanceNumber
      DICOM instance number.
    • isCurrentTagSQ

      public boolean isCurrentTagSQ
      Whether the tag currently being processed and read in is a sequence tag.
    • multiFrame

      public boolean multiFrame
      True indicates image has multiple image planes in a single file.
    • olderVersion

      public boolean olderVersion
      True is image format invalid input: '<' DICOM 3.0.
    • orientation

      public String orientation
      Orientation - SAGITTAL, CORONAL, AXIAL.
    • photometricInterp

      public String photometricInterp
      Type of image - color, monochrome etc.
    • pixelPaddingValue

      public Short pixelPaddingValue
      Pixel Padding Value (0028, 0120). Value of pixels added to non-rectangular image to pad to rectangular format.
    • pixelRepresentation

      public short pixelRepresentation
      DICOM tag (0028, 0103) -1 = undefined 0 = unsigned 1 = signed
    • planarConfig

      public short planarConfig
      0 = RGB, RGB, 1 = R R R, G G G, B B B.
    • sliceLocation

      public float sliceLocation
      DICOM slice location.
    • vr_type

      private FileInfoDicom.VRtype vr_type
      VR type can be IMPLICIT or EXPLICIT.
    • xLocation

      public float xLocation
      DICOM x coordianate of the slice location.
    • yLocation

      public float yLocation
      DICOM y coordianate of the slice location.
    • zLocation

      public float zLocation
      DICOM z coordianate of the slice location.
    • tagTable

      private FileDicomTagTable tagTable
      Stores all the information about the DICOM tags.
    • isEnhancedDicom

      private boolean isEnhancedDicom
      whether it is enhanced dicom or not
    • lut

      private ModelLUT lut
      LUT for pre-processing of dicom file
  • Constructor Details

    • FileInfoDicom

      public FileInfoDicom(String name, String directory, int format)
      DICOM file information constructor. Used for the file info which contains the reference tag table for an image.
      Parameters:
      name - file name
      directory - file directory
      format - format (in this case, DICOM)
    • FileInfoDicom

      public FileInfoDicom(String name, String directory, int format, FileInfoDicom refInfo)
      DICOM file information constructor. Used for the file info which does NOT contain the reference tag table for an image.
      Parameters:
      name - file name
      directory - file directory
      format - format (in this case, DICOM)
      refInfo - The reference file info, containing the reference tag table.
  • Method Details

    • setRLETAMARencapsulatedOffset

      public void setRLETAMARencapsulatedOffset(int offset)
    • getRLETAMARencapsulatedOffset

      public int getRLETAMARencapsulatedOffset()
    • anonymize

      public final void anonymize(boolean[] list, boolean removeValue)
      removes any and all personal information in the info that a doctor, patient, researcher may want to have deleted from the image, such as patient name or patient ID number--from this slice given by this fileInfoDicom.

      In addition, it allows the change or removal of a whole list of information, such as: ("0010,0010") Patient name; ("0010,0020") patient ID number; ("0010,0050") patient Insurance plan code sequence; ("0010,1000") other patient IDs; ("0010,1001") other patient names; ("0010,1040") patient address; ("0010,1060") patient mother's birth name; ("0010,2154") patient telephone numbers; ("0010,2160") patient ethnic group; ("0010,21D0") patient's last menstrual date; ("0010,21F0") patient religious preference; and ("0010,4000") patient comments.

      Parameters:
      list - the list of tags to remove; it MUST correspond to anonymizeTagIDs list (or spurious errors result), and it must be of the same length, or this will throw an IllegalArgumentException.
      Throws:
      IllegalArgumentException - DOCUMENT ME!
    • anonymizeSequenceTags

      public void anonymizeSequenceTags(boolean[] list, Vector<FileDicomSQItem> seqs, boolean removeValue)
      Method to anonymize the tags found in the DICOM supplement 55 that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
    • removePrivateTags

      public final void removePrivateTags(FileDicomKey[] keys)
      Method to remove private tags from the file. No option is given to anonymize the values. Requires an array of DICOM keys.
    • removePrivateTagsWhite

      public final void removePrivateTagsWhite(FileDicomKey[] keys)
    • removePrivateSequenceTags

      public final void removePrivateSequenceTags(FileDicomKey[] keys, Vector<FileDicomSQItem> seqs)
      Method to anonymize private tags that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
    • removePrivateSequenceTagsWhite

      public final void removePrivateSequenceTagsWhite(FileDicomKey[] keys, Vector<FileDicomSQItem> seqs)
    • anonymizePublicTags

      public final void anonymizePublicTags(FileDicomKey[] keys, boolean removeValue)
      Method to anonymize public tags that do not appear in the DICOM Supplement 55. Like in the other anonymize methods, you may instead choose to replace the value with a blank string.
    • anonymizePublicSequenceTags

      public final void anonymizePublicSequenceTags(FileDicomKey[] keys, Vector<FileDicomSQItem> seqs, boolean removeValue)
      Method to anonymize public tags not in the DICOM Supplement 55 that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
    • generateNewTagValue

      public Object generateNewTagValue(String key, boolean remove)
      Generates a new version of a particular tag that is DICOM compatible
      Parameters:
      key -
      Returns:
    • getLUT

      public final ModelLUT getLUT()
      returns the ModelLUT, if there, which might be specified by the 0028,1201, 0028,1202, 0028,1203 tags.
      Overrides:
      getLUT in class FileInfoBase
      Returns:
      DOCUMENT ME!
    • generateNewTagValue

      public static Object generateNewTagValue(String key, FileDicomTagTable tagTable, boolean remove)
      Generates a new version of a particular tag in the given tag table with same length that is DICOM compatible
      Parameters:
      key -
      Returns:
    • generateNewTagValue

      public static Object generateNewTagValue(String key, String strValue)
      Generates a new version of a particular tag in the standard DICOM tag table with same length that is DICOM compatible
      Parameters:
      key -
      Returns:
    • generateNewTagValue

      public static Object generateNewTagValue(String key, String strValue, FileDicomTagInfo.VR vr)
      Generates a new version of a particular tag given an arbitrary value and returns a DICOM compatible result
      Parameters:
      key -
      Returns:
    • generateNewTagValue

      public static Object generateNewTagValue(String key, String strValue, FileDicomTagInfo.VR vr, boolean remove)
    • displayAboutInfo

      public final void displayAboutInfo(JDialogBase dialog, TransMatrix matrix)
      Super requires displayAboutInfo to be defined display of this class is held by JDialogFileInfoDICOM. Should never be called.
      Specified by:
      displayAboutInfo in class FileInfoBase
      Parameters:
      dialog -
      matrix -
      See Also:
    • finalize

      public void finalize()
      Prepares this class for cleanup.
      Overrides:
      finalize in class FileInfoBase
    • setOriginalDataType

      public void setOriginalDataType(int originalDataType)
    • getOriginalDataType

      public int getOriginalDataType()
    • getPatientOrientation

      public final TransMatrix getPatientOrientation()
      This method extracts directional cosines from the DICOM image header (tag = "0020, 0037"). Since the third row of transformation matrix is not given in the tag but can be derived by taking the cross product. The result is then put into a MIPAV transformation matrix object and returned.
      Returns:
      the transformation object extracted from the DICOM header. If this tag is null then the class returns null.
    • getTagTable

      public final FileDicomTagTable getTagTable()
      Returns a reference to the tag table for this dicom file info.
      Returns:
      A reference to the tag table.
    • setTagTable

      public final void setTagTable(FileDicomTagTable tagTable)
      Parameters:
      tagTable - the tagTable to set, useful when a tag table has been populated from an enhanced DICOM series.
    • isMultiFrame

      public final boolean isMultiFrame()
      Accessor for the status of this dicom info.
      Returns:
      boolean true for images that think they are multi-frame.
    • setMultiFrame

      public final void setMultiFrame(boolean multiFrame)
      Sets whether the DICOM image is a multiFrame image.
    • parseTagValue

      public final String[] parseTagValue(String tagName)
      Parse the string for Objects seperated by "\". Uses the local method getValue to look at the Object held in the tag and decipher it for the user class into an array of strings.

      parseTagValue has not been updated for the newer versions of DicomTag

      Parameters:
      tagName - The name given as the key to search the Hashtable for.
      Returns:
      the array of Strings that were coded into the tag; a single string is given if the string in the tag has no "\" seporators. Each String in the array is a single value, and there are value multiplicity number of Strings in the array. NOTE: user class must convert this list to the correct type; (which does indicate user class knows what returned string is) If null then there were zero tokens in the tag
    • removeStampSecondaryCapture

      public void removeStampSecondaryCapture()
      In anonymization cases it may be necessary to hide the fact that MIPAV has processed this image (to remove any NIH affiliation). This method removes those tags that identify any secondary capture device information contained within the image, to make it appear as if the image has not been processed.
      Parameters:
      fileInfo - File info structure to set.
    • setInfoFromTags

      public final void setInfoFromTags()
      Public method for populating ModelImage data fields.
    • setInfoFromTags

      private final void setInfoFromTags(FileDicomTagTable tagTable, boolean insideSequenceTag)
      After the tag table is filled, check for a number of tags to set up some fields in this file info object.
    • updateLengthTags

      private void updateLengthTags(HashMap<Integer,FileInfoDicom.LengthStorageUnit> lengthComp)
    • appendLengthTag

      private void appendLengthTag(FileDicomTag tag, HashMap<Integer,FileInfoDicom.LengthStorageUnit> lengthComp)
    • setSecondaryCaptureTags

      public void setSecondaryCaptureTags(boolean isMultiFrame, int dataType)
      Changes a few dicom tags associated with a secondary capture image (marking it as having been created with mipav). This is often used after a new image is created as the result of an algorithm and the source image's file infos are copied over to the new image.
    • getModalityFromDicomStr

      protected static final int getModalityFromDicomStr(String value)
      Returns the MIPAV modality constant for a given DICOM modality string.
      Parameters:
      value - The DICOM modality tag value.
      Returns:
      The equivalent MIPAV modality constant (or UNKNOWN_MODALITY if there is no equivalent found).
    • setInfoFromTag

      protected final void setInfoFromTag(FileDicomTag tag)
      Sets fields in this file info based on a given tag's key and value.
      Parameters:
      tag - The tag to use to update the file info fields (not all tags cause field changes).
    • isEnhancedDicom

      public boolean isEnhancedDicom()
    • setIsEnhancedDicom

      public void setIsEnhancedDicom(boolean isEnhancedDicom)
    • setModalityFromDicomStr

      protected final void setModalityFromDicomStr(String value)
      Uses the DICOM tag value to set the Image modality field.
      Parameters:
      value - Object used is the value of DICOM tag (0008,0060)
    • getVr_type

      public FileInfoDicom.VRtype getVr_type()
    • setVr_type

      public void setVr_type(FileInfoDicom.VRtype vr_type)