Package gov.nih.mipav.model.file
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 Summary
Fields Modifier and Type Field Description private java.lang.String
fileDir
File directory of the image.private FileInfoSPAR
fileInfo
Reference fileinfoprivate java.lang.String
fileName
File name of the image.static java.lang.String[]
hdrEXTENSIONS
The extensions of ANALYZE file.private ModelImage
image
The image read in from the file.private ModelImage
imageA
private FileInfoBase
imageAInfo
imageA file infostatic java.lang.String[]
imgEXTENSIONS
private FileInfoSPAR
outInfo
file info-
Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE
-
-
Constructor Summary
Constructors Constructor Description FileSpar(ModelImage imageA, FileInfoBase imageAInfo, java.lang.String fileName, java.lang.String fileDir)
FileSpar(java.lang.String fileName, java.lang.String fileDir)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getCompleteFileNameList(java.lang.String absolutePath)
Returns the complete list of file names according to given file name.FileInfoSPAR
getFileInfo()
static java.lang.String
getHeaderFile(java.lang.String[] fileNames)
======= Returns the header file.static boolean
isHeaderFile(java.lang.String absolutePath)
Return true if the file specified by absolutePath is header file of ANALYZE.static boolean
isImageFile(java.lang.String absolutePath)
Return true if the file specified by absolutePath is image file of ANALYZE.private static double
parseDouble(java.lang.String nextLine)
private static int
parseInt(java.lang.String nextLine)
boolean
readHeader(java.lang.String imageFileName, java.lang.String fileDir)
Reads the spar header and stores the information in fileInfo.ModelImage
readImage(boolean one)
Constructs a SPAR image mask based on the parameters defined in FileInfoSPARprivate int
setLowerExtents(int index)
private int
setUpperExtents(int index)
private ModelImage
updateTransformMatrix(ModelImage image)
-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
-
-
-
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.
-
outInfo
private FileInfoSPAR outInfo
file info
-
imageAInfo
private FileInfoBase imageAInfo
imageA file info
-
imageA
private ModelImage imageA
-
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 filejava.lang.OutOfMemoryError
- See Also:
FileRaw
-
getFileInfo
public FileInfoSPAR getFileInfo()
-
updateTransformMatrix
private ModelImage updateTransformMatrix(ModelImage image)
-
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.
-
-