Package gov.nih.mipav.model.file
Class FileMATLAB
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileMATLAB
-
public class FileMATLAB extends FileBase
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]extentsf(package private) int[]extentsv(package private) java.util.Vector<java.lang.Integer>fprivate java.io.FilefileDOCUMENT ME!private java.lang.StringfileDirDOCUMENT ME!private FileInfoMATLABfileInfoDOCUMENT ME!private FileInfoMATLABfileInfo2private java.lang.StringfileNameDOCUMENT ME!private longfilePointerprivate booleanhaveImportedprivate booleanhaveNumericArrayCharacterprivate ModelImageimageDOCUMENT ME!private ModelImageimage2private int[]imageExtentsDOCUMENT ME!private float[]imgBufferDOCUMENT ME!private float[]imgResolsDOCUMENT ME!private ModelLUTLUTDOCUMENT ME!private FileInfoMATLABmaskFileInfoprivate FileInfoMATLABmaskFileInfo2private ModelImagemaskImageprivate ModelImagemaskImage2private intmaximumNonZeroElementsprivate static intmiCOMPRESSEDCompressed Dataprivate static intmiDOUBLEIEEE 754 double formatprivate static intmiINT1616-bit, signedprivate static intmiINT3232-bit signedprivate static intmiINT6464-bit, signedprivate static intmiINT88 bit, signedprivate static intmiMATRIXMATLAB ARRAYprivate static intmiSINGLEIEEE 754 single formatprivate static intmiUINT1616-bit, unsignedprivate static intmiUINT3232-bit, unsignedprivate static intmiUINT6464-bit, unsignedprivate static intmiUINT88 bit, unsignedprivate static intmiUTF16Unicode UTF-16 Encoded Character Dataprivate static intmiUTF32Unicode UTF-32 Encoded Character Dataprivate static intmiUTF8Unicode UTF-8 Encoded Character Dataprivate static bytemxCELL_CLASSCell arrayprivate static bytemxCHAR_CLASSCharacter arrayprivate static bytemxDOUBLE_CLASSDouble precision arrayprivate static bytemxINT16_CLASS16-bit, signed integerprivate static bytemxINT32_CLASS32-bit, signed integerprivate static bytemxINT64_CLASS64-bit, signed integerprivate static bytemxINT8_CLASS8-bit, signed integerprivate static bytemxOBJECT_CLASSObjectprivate static bytemxSINGLE_CLASSSingle precision arrayprivate static bytemxSPARSE_CLASSSparse arrayprivate static bytemxSTRUCT_CLASSStructureprivate static bytemxUINT16_CLASS16-bit, unsigned integerprivate static bytemxUINT32_CLASS32-bit, unsigned integerprivate static bytemxUINT64_CLASS64-bit, unsigned integerprivate static bytemxUINT8_CLASS8-bit, unsigned integerprivate intnumberCharacterClasses(package private) booleanreadf(package private) booleanreadv(package private) java.util.Vector<java.lang.Double>vprivate ViewJFrameImagevFrame2private ViewJFrameImagevmFrameprivate ViewJFrameImagevmFrame2private java.util.zip.InflaterzlibDecompresser-
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 FileMATLAB(java.lang.String fileName, java.lang.String fileDir)LIFF reader/writer constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinalize()Prepares this class for cleanup.FileInfoBasegetFileInfo()Accessor that returns the file info.float[]getImageBuffer()Accessor that returns the image buffer.ModelLUTgetModelLUT()Rreturns LUT if defined.private java.lang.StringreadCString()ModelImagereadImage(boolean multiFile, boolean one)Reads the MATLAB header.voidsetFileName(java.lang.String fName)Accessor to set the file name (used for reading COR multiFile).voidsetfv(java.util.Vector<java.lang.Integer> f, java.util.Vector<java.lang.Double> v, int[] extentsf, int[] extentsv)voidwriteImage(ModelImage image, FileWriteOptions options)Writes a MATLAB format type image.-
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
-
miINT8
private static final int miINT8
8 bit, signed- See Also:
- Constant Field Values
-
miUINT8
private static final int miUINT8
8 bit, unsigned- See Also:
- Constant Field Values
-
miINT16
private static final int miINT16
16-bit, signed- See Also:
- Constant Field Values
-
miUINT16
private static final int miUINT16
16-bit, unsigned- See Also:
- Constant Field Values
-
miINT32
private static final int miINT32
32-bit signed- See Also:
- Constant Field Values
-
miUINT32
private static final int miUINT32
32-bit, unsigned- See Also:
- Constant Field Values
-
miSINGLE
private static final int miSINGLE
IEEE 754 single format- See Also:
- Constant Field Values
-
miDOUBLE
private static final int miDOUBLE
IEEE 754 double format- See Also:
- Constant Field Values
-
miINT64
private static final int miINT64
64-bit, signed- See Also:
- Constant Field Values
-
miUINT64
private static final int miUINT64
64-bit, unsigned- See Also:
- Constant Field Values
-
miMATRIX
private static final int miMATRIX
MATLAB ARRAY- See Also:
- Constant Field Values
-
miCOMPRESSED
private static final int miCOMPRESSED
Compressed Data- See Also:
- Constant Field Values
-
miUTF8
private static final int miUTF8
Unicode UTF-8 Encoded Character Data- See Also:
- Constant Field Values
-
miUTF16
private static final int miUTF16
Unicode UTF-16 Encoded Character Data- See Also:
- Constant Field Values
-
miUTF32
private static final int miUTF32
Unicode UTF-32 Encoded Character Data- See Also:
- Constant Field Values
-
mxCELL_CLASS
private static final byte mxCELL_CLASS
Cell array- See Also:
- Constant Field Values
-
mxSTRUCT_CLASS
private static final byte mxSTRUCT_CLASS
Structure- See Also:
- Constant Field Values
-
mxOBJECT_CLASS
private static final byte mxOBJECT_CLASS
Object- See Also:
- Constant Field Values
-
mxCHAR_CLASS
private static final byte mxCHAR_CLASS
Character array- See Also:
- Constant Field Values
-
mxSPARSE_CLASS
private static final byte mxSPARSE_CLASS
Sparse array- See Also:
- Constant Field Values
-
mxDOUBLE_CLASS
private static final byte mxDOUBLE_CLASS
Double precision array- See Also:
- Constant Field Values
-
mxSINGLE_CLASS
private static final byte mxSINGLE_CLASS
Single precision array- See Also:
- Constant Field Values
-
mxINT8_CLASS
private static final byte mxINT8_CLASS
8-bit, signed integer- See Also:
- Constant Field Values
-
mxUINT8_CLASS
private static final byte mxUINT8_CLASS
8-bit, unsigned integer- See Also:
- Constant Field Values
-
mxINT16_CLASS
private static final byte mxINT16_CLASS
16-bit, signed integer- See Also:
- Constant Field Values
-
mxUINT16_CLASS
private static final byte mxUINT16_CLASS
16-bit, unsigned integer- See Also:
- Constant Field Values
-
mxINT32_CLASS
private static final byte mxINT32_CLASS
32-bit, signed integer- See Also:
- Constant Field Values
-
mxUINT32_CLASS
private static final byte mxUINT32_CLASS
32-bit, unsigned integer- See Also:
- Constant Field Values
-
mxINT64_CLASS
private static final byte mxINT64_CLASS
64-bit, signed integer- See Also:
- Constant Field Values
-
mxUINT64_CLASS
private static final byte mxUINT64_CLASS
64-bit, unsigned integer- See Also:
- Constant Field Values
-
file
private java.io.File file
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
DOCUMENT ME!
-
fileInfo
private FileInfoMATLAB fileInfo
DOCUMENT ME!
-
fileInfo2
private FileInfoMATLAB fileInfo2
-
maskFileInfo
private FileInfoMATLAB maskFileInfo
-
maskFileInfo2
private FileInfoMATLAB maskFileInfo2
-
fileName
private java.lang.String fileName
DOCUMENT ME!
-
image
private ModelImage image
DOCUMENT ME!
-
imageExtents
private int[] imageExtents
DOCUMENT ME!
-
imgBuffer
private float[] imgBuffer
DOCUMENT ME!
-
imgResols
private float[] imgResols
DOCUMENT ME!
-
LUT
private ModelLUT LUT
DOCUMENT ME!
-
zlibDecompresser
private java.util.zip.Inflater zlibDecompresser
-
image2
private ModelImage image2
-
vFrame2
private ViewJFrameImage vFrame2
-
maskImage
private ModelImage maskImage
-
vmFrame
private ViewJFrameImage vmFrame
-
maskImage2
private ModelImage maskImage2
-
vmFrame2
private ViewJFrameImage vmFrame2
-
filePointer
private long filePointer
-
maximumNonZeroElements
private int maximumNonZeroElements
-
haveNumericArrayCharacter
private boolean haveNumericArrayCharacter
-
numberCharacterClasses
private int numberCharacterClasses
-
haveImported
private boolean haveImported
-
f
java.util.Vector<java.lang.Integer> f
-
v
java.util.Vector<java.lang.Double> v
-
extentsf
int[] extentsf
-
extentsv
int[] extentsv
-
readf
boolean readf
-
readv
boolean readv
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for cleanup. Calls thefinalizemethod for existing elements, closes any open files and sets other elements tonull.
-
getFileInfo
public FileInfoBase getFileInfo()
Accessor that returns the file info.- Returns:
- FileInfoBase containing the file info
-
getImageBuffer
public float[] getImageBuffer()
Accessor that returns the image buffer.- Returns:
- buffer of image.
-
getModelLUT
public ModelLUT getModelLUT()
Rreturns LUT if defined.- Returns:
- the LUT if defined else it is null
-
setfv
public void setfv(java.util.Vector<java.lang.Integer> f, java.util.Vector<java.lang.Double> v, int[] extentsf, int[] extentsv)
-
readImage
public ModelImage readImage(boolean multiFile, boolean one) throws java.io.IOException
Reads the MATLAB header.- Parameters:
multiFile-trueif a set of files each containing a separate 2D image is presentfalseif one file with either a 2D image or a stack of 2D imagesone-trueif only want to read in one image of the 3D set- Returns:
- returns the image
- Throws:
java.io.IOException- if there is an error reading the file
-
readCString
private java.lang.String readCString() throws java.io.IOException- Throws:
java.io.IOException
-
setFileName
public void setFileName(java.lang.String fName)
Accessor to set the file name (used for reading COR multiFile).- Parameters:
fName- file name of image to read.
-
writeImage
public void writeImage(ModelImage image, FileWriteOptions options) throws java.io.IOException
Writes a MATLAB format type image.- Parameters:
image- Image model of data to write.options- options such as starting and ending slices and times- Throws:
java.io.IOException- if there is an error writing the file
-
-