Class FileMicroCat


  • public class FileMicroCat
    extends FileBase
    Author:
    Matthew J. McAuliffe
    See Also:
    FileIO
    • Field Detail

      • file

        private java.io.File file
        DOCUMENT ME!
      • fileDir

        private java.lang.String fileDir
        DOCUMENT ME!
      • fileName

        private java.lang.String fileName
        DOCUMENT ME!
    • Constructor Detail

      • FileMicroCat

        public FileMicroCat​(java.lang.String fileName,
                            java.lang.String fileDir)
                     throws java.io.IOException
        MicroCat reader/writer constructor.
        Parameters:
        fileName - file name
        fileDir - file directory
        Throws:
        java.io.IOException - if there is an error making the file
    • 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
      • trimmer

        public static java.lang.String trimmer​(java.lang.String fName)
        Trims the numbers(numerics and some special characters [-, _, .) off the end of a string (file name).
        Parameters:
        fName - File name where the last characters are alpha-numerics indicating the image number.
        Returns:
        File name without numbers on the end.
      • getFileList

        public java.lang.String[] getFileList​(java.lang.String fileDir,
                                              java.lang.String fileName,
                                              boolean quiet)
        Looks in the image directory and returns all images with the same suffix as fileName, sorted in lexicographical order. Will set the number of images (nImages) for the calling program.
        Parameters:
        fileDir - Directory to looks for images in.
        fileName - File name of the image.
        quiet - DOCUMENT ME!
        Returns:
        An array of the image names to be read in or saved as.
      • readHeader

        public FileInfoMicroCat readHeader()
                                    throws java.io.IOException
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
        Throws:
        java.io.IOException - DOCUMENT ME!
      • readImage

        public ModelImage readImage​(boolean quiet)
                             throws java.io.IOException
        Reads the image as a full 3D dataset.
        Parameters:
        quiet - Flag for printing statements to the screen.
        Returns:
        The image.
        Throws:
        java.io.IOException - DOCUMENT ME!
      • readImage

        public ModelImage readImage​(boolean quiet,
                                    boolean one,
                                    java.lang.String inputName)
                             throws java.io.IOException
        Reads the image.
        Parameters:
        quiet - Flag for printing statements to the screen.
        one - Flag for reading only 1 image of 3D dataset
        inputName - If one is true, contains name of image to read.
        Returns:
        returns the image
        Throws:
        java.io.IOException - if there is an error reading the file
      • setFileName

        public void setFileName​(java.lang.String fileName)
        Sets the file name.
        Parameters:
        fileName - New file name.
      • getKeyString

        private java.lang.String getKeyString​(java.lang.String str)
        DOCUMENT ME!
        Parameters:
        str - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getValString

        private java.lang.String getValString​(java.lang.String str)
        DOCUMENT ME!
        Parameters:
        str - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • readLine

        private java.lang.String readLine()
                                   throws java.io.IOException
        Reads lines of the file and strips comments indicated by the : symbol until a nonnull String results or the end of the file is reached.
        Returns:
        the line read in
        Throws:
        java.io.IOException - if there is an error reading the file