Class FileMicroCat

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

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

    • file

      private File file
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileName

      private String fileName
      DOCUMENT ME!
  • Constructor Details

    • FileMicroCat

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

      public static String trimmer(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 String[] getFileList(String fileDir, 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 IOException
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readImage

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

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

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

      private String getKeyString(String str)
      DOCUMENT ME!
      Parameters:
      str - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getValString

      private String getValString(String str)
      DOCUMENT ME!
      Parameters:
      str - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • readLine

      private String readLine() throws 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:
      IOException - if there is an error reading the file