Package gov.nih.mipav.model.file
Class FileMicroCat
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileMicroCat
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
file
DOCUMENT ME!private java.lang.String
fileDir
DOCUMENT ME!private java.lang.String
fileName
DOCUMENT ME!-
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 FileMicroCat(java.lang.String fileName, java.lang.String fileDir)
MicroCat reader/writer constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for cleanup.java.lang.String[]
getFileList(java.lang.String fileDir, java.lang.String fileName, boolean quiet)
Looks in the image directory and returns all images with the same suffix asfileName
, sorted in lexicographical order.private java.lang.String
getKeyString(java.lang.String str)
DOCUMENT ME!private java.lang.String
getValString(java.lang.String str)
DOCUMENT ME!FileInfoMicroCat
readHeader()
DOCUMENT ME!ModelImage
readImage(boolean quiet)
Reads the image as a full 3D dataset.ModelImage
readImage(boolean quiet, boolean one, java.lang.String inputName)
Reads the image.private java.lang.String
readLine()
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.void
setFileName(java.lang.String fileName)
Sets the file name.static java.lang.String
trimmer(java.lang.String fName)
Trims the numbers(numerics and some special characters [-, _, .) off the end of a string (file name).-
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
-
-
-
-
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
.
-
trimmer
public static java.lang.String trimmer(java.lang.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 java.lang.String[] getFileList(java.lang.String fileDir, java.lang.String fileName, boolean quiet)
Looks in the image directory and returns all images with the same suffix asfileName
, 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 java.io.IOException
DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException
- DOCUMENT ME!
-
readImage
public ModelImage readImage(boolean quiet) throws java.io.IOException
Reads the image as a full 3D dataset.- Parameters:
quiet
- Flag for printing statements to the screen.- Returns:
- The image.
- Throws:
java.io.IOException
- DOCUMENT ME!
-
readImage
public ModelImage readImage(boolean quiet, boolean one, java.lang.String inputName) throws java.io.IOException
Reads the image.- Parameters:
quiet
- Flag for printing statements to the screen.one
- Flag for reading only 1 image of 3D datasetinputName
- Ifone
istrue
, contains name of image to read.- Returns:
- returns the image
- Throws:
java.io.IOException
- if there is an error reading the file
-
setFileName
public void setFileName(java.lang.String fileName)
Sets the file name.- Parameters:
fileName
- New file name.
-
getKeyString
private java.lang.String getKeyString(java.lang.String str)
DOCUMENT ME!- Parameters:
str
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getValString
private java.lang.String getValString(java.lang.String str)
DOCUMENT ME!- Parameters:
str
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
readLine
private java.lang.String readLine() throws java.io.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:
java.io.IOException
- if there is an error reading the file
-
-