Class FileSiemensText

java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileSiemensText

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

    • EXTENSIONS

      public static final 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:
    • DT_BYTE

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

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

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

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

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

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

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

    • fileDir

      private String fileDir
      File directory of the image.
    • fileHeader

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

      private 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 Details

    • FileSiemensText

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

    • 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 String[] getCompleteFileNameList(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 String getHeaderFile(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 String[] getImageFiles(String[] fileNames)
      Returns the image file list.
      Parameters:
      fileNames - DOCUMENT ME!
      Returns:
      the image file list.
    • isHeaderFile

      public static boolean isHeaderFile(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(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(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 String getHeaderFile()
      Returns the header file.
      Returns:
      DOCUMENT ME!
    • getImageFiles

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

      public boolean readHeader(String imageFileName, String fileDir) throws 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:
      IOException - if there is an error reading the header
      See Also:
    • readImage

      public ModelImage readImage(boolean one) throws IOException, 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:
      IOException - if there is an error reading the file
      OutOfMemoryError
      See Also:
    • readImage

      public void readImage(float[] buffer) throws IOException, 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:
      IOException - if there is an error reading the file
      OutOfMemoryError
      See Also: