Class FileSiemensText


  • public class FileSiemensText
    extends FileBase
    Version:
    0.1 May 27, 2009
    Author:
    Andrew Morse
    See Also:
    FileIO
    • Field Detail

      • EXTENSIONS

        public static final java.lang.String[] EXTENSIONS
        The extensions of SiemensText file.
      • DT_UNKNOWN

        public static final short DT_UNKNOWN
        SiemensText file format define use to indicate undefined image data type.
        See Also:
        Constant Field Values
      • DT_BYTE

        public static final short DT_BYTE
        SiemensText file format define use to indicate Byte (8-bits) data type
        See Also:
        Constant Field Values
      • DT_2INTEGERI

        public static final short DT_2INTEGERI
        SiemensText file format define use to indicate 2-byte integer - Intel style.
        See Also:
        Constant Field Values
      • DT_4INTEGERI

        public static final short DT_4INTEGERI
        SiemensText file format define use to indicate 4-byte integer - Intel style.
        See Also:
        Constant Field Values
      • DT_2FLOAT

        public static final short DT_2FLOAT
        SiemensText file format define use to indicate 2-byte float - Intel style.
        See Also:
        Constant Field Values
      • DT_4FLOAT

        public static final short DT_4FLOAT
        SiemensText file format define use to indicate 4-byte float - Sun style.
        See Also:
        Constant Field Values
      • DT_2INTEGERS

        public static final short DT_2INTEGERS
        SiemensText file format define use to indicate 2-byte integer - Sun style.
        See Also:
        Constant Field Values
      • DT_4INTEGERS

        public static final short DT_4INTEGERS
        SiemensText file format define use to indicate 4-byte integer - Sun style.
        See Also:
        Constant Field Values
      • storage

        java.util.Hashtable<java.lang.String,​java.lang.String> storage
      • fileDir

        private java.lang.String fileDir
        File directory of the image.
      • fileHeader

        private java.io.File fileHeader
        Reference to the header file (*.hdr).
      • fileName

        private java.lang.String fileName
        File name of the image.
      • fileInfo

        private FileInfoSiemensText fileInfo
        Reference to the file info. for an SiemensText header
      • image

        private ModelImage image
        The image read in from the file.
    • Constructor Detail

      • FileSiemensText

        public FileSiemensText​(java.lang.String fName,
                               java.lang.String fDir)
        Constructs new file object.
        Parameters:
        fName - File name.
        fDir - File directory.
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for cleanup. Calls the finalize method for existing elements, closes any open files and sets other elements to null.
        Overrides:
        finalize in class FileBase
      • getCompleteFileNameList

        public static java.lang.String[] getCompleteFileNameList​(java.lang.String absolutePath)
        Returns the complete list of file names according to given file name.
        Parameters:
        absolutePath - one file name of SiemensText.
        Returns:
        the complete list of file names.
      • getHeaderFile

        public static java.lang.String getHeaderFile​(java.lang.String[] fileNames)
        Returns the header file (ends in .hdr) as a string.
        Parameters:
        fileNames - DOCUMENT ME!
        Returns:
        The header file (ends in .hdr)
      • getImageFiles

        public static java.lang.String[] getImageFiles​(java.lang.String[] fileNames)
        Returns the image file list.
        Parameters:
        fileNames - DOCUMENT ME!
        Returns:
        the image file list.
      • isHeaderFile

        public static boolean isHeaderFile​(java.lang.String absolutePath)
        Return true if the file specified by absolutePath is header file of SiemensText.
        Parameters:
        absolutePath - the file name including path information.
        Returns:
        true if the specified file is header file.
      • isImageFile

        public static boolean isImageFile​(java.lang.String absolutePath)
        Return true if the file specified by absolutePath is image file of SiemensText.
        Parameters:
        absolutePath - the file name including path information.
        Returns:
        true if the specified file is image file.
      • isSiemensText

        public static boolean isSiemensText​(java.lang.String absolutePath)
      • getFileInfo

        public FileInfoSiemensText getFileInfo()
        Returns the FileInfoSiemensText read from the file.
        Returns:
        File info read from file, or null if it has not been read.
      • getHeaderFile

        public java.lang.String getHeaderFile()
        Returns the header file.
        Returns:
        DOCUMENT ME!
      • getImageFiles

        public java.lang.String[] getImageFiles()
        Returns the image file list.
        Returns:
        the image file list.
      • readHeader

        public boolean readHeader​(java.lang.String imageFileName,
                                  java.lang.String fileDir)
                           throws java.io.IOException
        Reads the SiemensText header and stores the information in fileInfo.
        Parameters:
        imageFileName - File name of image.
        fileDir - Directory.
        Returns:
        Flag to confirm a successful read.
        Throws:
        java.io.IOException - if there is an error reading the header
        See Also:
        FileInfoSiemensText
      • readImage

        public ModelImage readImage​(boolean one)
                             throws java.io.IOException,
                                    java.lang.OutOfMemoryError
        Reads an SiemensText image file by reading the header then making a FileRaw to read the image for all filenames in the file list. Only the one file directory (currently) supported.
        Parameters:
        one - flag indicating one image of a 3D dataset should be read in.
        Returns:
        The image.
        Throws:
        java.io.IOException - if there is an error reading the file
        java.lang.OutOfMemoryError
        See Also:
        FileRaw
      • readImage

        public void readImage​(float[] buffer)
                       throws java.io.IOException,
                              java.lang.OutOfMemoryError
        Reads an SiemensText image file by reading the header then making a FileRaw to read the file. Image data is left in buffer. If the fileInfo cannot be found, the header will be located and read first. Image is not 'flipped', and neither units of measure nor orientation are set.
        Parameters:
        buffer - Image buffer to store image data into.
        Throws:
        java.io.IOException - if there is an error reading the file
        java.lang.OutOfMemoryError
        See Also:
        FileRaw