Class 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 Detail

      • hdrEXTENSIONS

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

        public static final java.lang.String[] imgEXTENSIONS
      • fileDir

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

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

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

        private FileInfoBase imageAInfo
        imageA file info
      • fileInfo

        private FileInfoSPAR fileInfo
        Reference fileinfo
    • Constructor Detail

      • FileSpar

        public FileSpar​(java.lang.String fileName,
                        java.lang.String fileDir)
      • FileSpar

        public FileSpar​(ModelImage imageA,
                        FileInfoBase imageAInfo,
                        java.lang.String fileName,
                        java.lang.String fileDir)
    • Method Detail

      • parseDouble

        private static double parseDouble​(java.lang.String nextLine)
      • parseInt

        private static int parseInt​(java.lang.String nextLine)
      • readHeader

        public boolean readHeader​(java.lang.String imageFileName,
                                  java.lang.String fileDir)
                           throws java.io.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:
        java.io.IOException - if there is an error reading the header
        See Also:
        FileInfoAnalyze
      • setLowerExtents

        private int setLowerExtents​(int index)
      • setUpperExtents

        private int setUpperExtents​(int index)
      • readImage

        public ModelImage readImage​(boolean one)
                             throws java.io.IOException,
                                    java.lang.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:
        java.io.IOException - if there is an error reading the file
        java.lang.OutOfMemoryError
        See Also:
        FileRaw
      • 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 PARREC.
        Returns:
        the complete list of file names.
      • getHeaderFile

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

        public static boolean isHeaderFile​(java.lang.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​(java.lang.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.