Class FileSpar

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

public class FileSpar extends FileBase
Reads a spar/sdat file. MIPAV only uses the spar information since the sdat is spectroscopy data.
Author:
senseneyj
  • Field Details

    • hdrEXTENSIONS

      public static final String[] hdrEXTENSIONS
      The extensions of ANALYZE file.
    • imgEXTENSIONS

      public static final String[] imgEXTENSIONS
    • fileDir

      private String fileDir
      File directory of the image.
    • fileName

      private String fileName
      File name of the image.
    • image

      private ModelImage image
      The image read in from the file.
    • outInfo

      private FileInfoSPAR outInfo
      file info
    • imageAInfo

      private FileInfoBase imageAInfo
      imageA file info
    • imageA

      private ModelImage imageA
    • fileInfo

      private FileInfoSPAR fileInfo
      Reference fileinfo
  • Constructor Details

  • Method Details

    • parseDouble

      private static double parseDouble(String nextLine)
    • parseInt

      private static int parseInt(String nextLine)
    • readHeader

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

      private int setLowerExtents(int index)
    • setUpperExtents

      private int setUpperExtents(int index)
    • readImage

      public ModelImage readImage(boolean one) throws IOException, OutOfMemoryError
      Constructs a SPAR image mask based on the parameters defined in FileInfoSPAR
      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:
    • getFileInfo

      public FileInfoSPAR getFileInfo()
    • updateTransformMatrix

      private ModelImage updateTransformMatrix(ModelImage image)
    • 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 PARREC.
      Returns:
      the complete list of file names.
    • getHeaderFile

      public static String getHeaderFile(String[] fileNames)
      ======= Returns the header file.
      Parameters:
      fileNames - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • isHeaderFile

      public static boolean isHeaderFile(String absolutePath)
      Return true if the file specified by absolutePath is header file of ANALYZE.
      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 ANALYZE.
      Parameters:
      absolutePath - the file name including path information.
      Returns:
      true if the specified file is image file.