Package gov.nih.mipav.model.file
Class FileSiemensText
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileSiemensText
-
-
Field Summary
Fields Modifier and Type Field Description static short
DT_2FLOAT
SiemensText file format define use to indicate 2-byte float - Intel style.static short
DT_2INTEGERI
SiemensText file format define use to indicate 2-byte integer - Intel style.static short
DT_2INTEGERS
SiemensText file format define use to indicate 2-byte integer - Sun style.static short
DT_4FLOAT
SiemensText file format define use to indicate 4-byte float - Sun style.static short
DT_4INTEGERI
SiemensText file format define use to indicate 4-byte integer - Intel style.static short
DT_4INTEGERS
SiemensText file format define use to indicate 4-byte integer - Sun style.static short
DT_BYTE
SiemensText file format define use to indicate Byte (8-bits) data typestatic short
DT_UNKNOWN
SiemensText file format define use to indicate undefined image data type.static java.lang.String[]
EXTENSIONS
The extensions of SiemensText file.private java.lang.String
fileDir
File directory of the image.private java.io.File
fileHeader
Reference to the header file (*.hdr).private FileInfoSiemensText
fileInfo
Reference to the file info. for an SiemensText headerprivate java.lang.String
fileName
File name of the image.private ModelImage
image
The image read in from the file.(package private) java.util.Hashtable<java.lang.String,java.lang.String>
storage
-
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 FileSiemensText(java.lang.String fName, java.lang.String fDir)
Constructs new file object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for cleanup.static java.lang.String[]
getCompleteFileNameList(java.lang.String absolutePath)
Returns the complete list of file names according to given file name.FileInfoSiemensText
getFileInfo()
Returns the FileInfoSiemensText read from the file.java.lang.String
getHeaderFile()
Returns the header file.static java.lang.String
getHeaderFile(java.lang.String[] fileNames)
Returns the header file (ends in .hdr) as a string.java.lang.String[]
getImageFiles()
Returns the image file list.static java.lang.String[]
getImageFiles(java.lang.String[] fileNames)
Returns the image file list.static boolean
isHeaderFile(java.lang.String absolutePath)
Return true if the file specified by absolutePath is header file of SiemensText.static boolean
isImageFile(java.lang.String absolutePath)
Return true if the file specified by absolutePath is image file of SiemensText.static boolean
isSiemensText(java.lang.String absolutePath)
boolean
readHeader(java.lang.String imageFileName, java.lang.String fileDir)
Reads the SiemensText header and stores the information in fileInfo.ModelImage
readImage(boolean one)
Reads an SiemensText image file by reading the header then making a FileRaw to read the image for all filenames in the file list.void
readImage(float[] buffer)
Reads an SiemensText image file by reading the header then making a FileRaw to read the file.-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, 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
-
EXTENSIONS
public static final java.lang.String[] EXTENSIONS
The extensions of SiemensText file.
-
DT_UNKNOWN
public static final short DT_UNKNOWN
SiemensText file format define use to indicate undefined image data type.- See Also:
- Constant Field Values
-
DT_BYTE
public static final short DT_BYTE
SiemensText file format define use to indicate Byte (8-bits) data type- See Also:
- Constant Field Values
-
DT_2INTEGERI
public static final short DT_2INTEGERI
SiemensText file format define use to indicate 2-byte integer - Intel style.- See Also:
- Constant Field Values
-
DT_4INTEGERI
public static final short DT_4INTEGERI
SiemensText file format define use to indicate 4-byte integer - Intel style.- See Also:
- Constant Field Values
-
DT_2FLOAT
public static final short DT_2FLOAT
SiemensText file format define use to indicate 2-byte float - Intel style.- See Also:
- Constant Field Values
-
DT_4FLOAT
public static final short DT_4FLOAT
SiemensText file format define use to indicate 4-byte float - Sun style.- See Also:
- Constant Field Values
-
DT_2INTEGERS
public static final short DT_2INTEGERS
SiemensText file format define use to indicate 2-byte integer - Sun style.- See Also:
- Constant Field Values
-
DT_4INTEGERS
public static final short DT_4INTEGERS
SiemensText file format define use to indicate 4-byte integer - Sun style.- See Also:
- Constant Field Values
-
storage
java.util.Hashtable<java.lang.String,java.lang.String> storage
-
fileDir
private java.lang.String fileDir
File directory of the image.
-
fileHeader
private java.io.File fileHeader
Reference to the header file (*.hdr).
-
fileName
private java.lang.String fileName
File name of the image.
-
fileInfo
private FileInfoSiemensText fileInfo
Reference to the file info. for an SiemensText header
-
image
private ModelImage image
The image read in from the file.
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for cleanup. Calls thefinalize
method for existing elements, closes any open files and sets other elements tonull
.
-
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 SiemensText.- Returns:
- the complete list of file names.
-
getHeaderFile
public static java.lang.String getHeaderFile(java.lang.String[] fileNames)
Returns the header file (ends in .hdr) as a string.- Parameters:
fileNames
- DOCUMENT ME!- Returns:
- The header file (ends in .hdr)
-
getImageFiles
public static java.lang.String[] getImageFiles(java.lang.String[] fileNames)
Returns the image file list.- Parameters:
fileNames
- DOCUMENT ME!- Returns:
- the image file list.
-
isHeaderFile
public static boolean isHeaderFile(java.lang.String absolutePath)
Return true if the file specified by absolutePath is header file of SiemensText.- 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 SiemensText.- Parameters:
absolutePath
- the file name including path information.- Returns:
- true if the specified file is image file.
-
isSiemensText
public static boolean isSiemensText(java.lang.String absolutePath)
-
getFileInfo
public FileInfoSiemensText getFileInfo()
Returns the FileInfoSiemensText read from the file.- Returns:
- File info read from file, or null if it has not been read.
-
getHeaderFile
public java.lang.String getHeaderFile()
Returns the header file.- Returns:
- DOCUMENT ME!
-
getImageFiles
public java.lang.String[] getImageFiles()
Returns the image file list.- Returns:
- the image file list.
-
readHeader
public boolean readHeader(java.lang.String imageFileName, java.lang.String fileDir) throws java.io.IOException
Reads the SiemensText header and stores the information in fileInfo.- Parameters:
imageFileName
- File name of image.fileDir
- Directory.- Returns:
- Flag to confirm a successful read.
- Throws:
java.io.IOException
- if there is an error reading the header- See Also:
FileInfoSiemensText
-
readImage
public ModelImage readImage(boolean one) throws java.io.IOException, java.lang.OutOfMemoryError
Reads an SiemensText image file by reading the header then making a FileRaw to read the image for all filenames in the file list. Only the one file directory (currently) supported.- 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
-
readImage
public void readImage(float[] buffer) throws java.io.IOException, java.lang.OutOfMemoryError
Reads an SiemensText image file by reading the header then making a FileRaw to read the file. Image data is left in buffer. If the fileInfo cannot be found, the header will be located and read first. Image is not 'flipped', and neither units of measure nor orientation are set.- Parameters:
buffer
- Image buffer to store image data into.- Throws:
java.io.IOException
- if there is an error reading the filejava.lang.OutOfMemoryError
- See Also:
FileRaw
-
-