Package gov.nih.mipav.model.file
Class FileBMP
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileBMP
-
public class FileBMP extends FileBase
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BI_BITFIELDS
private static int
BI_RGB
private static int
BI_RLE4
private static int
BI_RLE8
private static long
CALIBRATED_RGB
private static long
DEVICE_DEPENDENT_CMYK
private static long
DEVICE_DEPENDENT_RGB
private java.io.File
file
DOCUMENT ME!private java.lang.String
fileDir
DOCUMENT ME!private FileInfoBMP
fileInfo
DOCUMENT ME!private java.lang.String
fileName
DOCUMENT ME!private ModelImage
image
DOCUMENT ME!private int[]
imageExtents
DOCUMENT ME!private java.lang.Number[]
imgBuffer
DOCUMENT ME!private float[]
imgResols
DOCUMENT ME!private ModelLUT
LUT
DOCUMENT ME!private int[]
unitsOfMeasure
-
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 FileBMP(java.lang.String fileName, java.lang.String fileDir)
BMP reader/writer constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for cleanup.FileInfoBase
getFileInfo()
Accessor that returns the file info.java.lang.Number[]
getImageBuffer()
Accessor that returns the image buffer.ModelLUT
getModelLUT()
Rreturns LUT if defined.private java.lang.String
readCString()
ModelImage
readImage(boolean multiFile, boolean one)
Reads the BMP header which indicates endianess, the TIFF magic number, and the offset in bytes of the first IFD.void
setFileName(java.lang.String fName)
Accessor to set the file name (used for reading COR multiFile).-
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
-
BI_RGB
private static final int BI_RGB
- See Also:
- Constant Field Values
-
BI_RLE8
private static final int BI_RLE8
- See Also:
- Constant Field Values
-
BI_RLE4
private static final int BI_RLE4
- See Also:
- Constant Field Values
-
BI_BITFIELDS
private static final int BI_BITFIELDS
- See Also:
- Constant Field Values
-
CALIBRATED_RGB
private static final long CALIBRATED_RGB
- See Also:
- Constant Field Values
-
DEVICE_DEPENDENT_RGB
private static final long DEVICE_DEPENDENT_RGB
- See Also:
- Constant Field Values
-
DEVICE_DEPENDENT_CMYK
private static final long DEVICE_DEPENDENT_CMYK
- See Also:
- Constant Field Values
-
file
private java.io.File file
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
DOCUMENT ME!
-
fileInfo
private FileInfoBMP fileInfo
DOCUMENT ME!
-
fileName
private java.lang.String fileName
DOCUMENT ME!
-
image
private ModelImage image
DOCUMENT ME!
-
imageExtents
private int[] imageExtents
DOCUMENT ME!
-
imgBuffer
private java.lang.Number[] imgBuffer
DOCUMENT ME!
-
imgResols
private float[] imgResols
DOCUMENT ME!
-
unitsOfMeasure
private int[] unitsOfMeasure
-
LUT
private ModelLUT LUT
DOCUMENT ME!
-
-
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
.
-
getFileInfo
public FileInfoBase getFileInfo()
Accessor that returns the file info.- Returns:
- FileInfoBase containing the file info
-
getImageBuffer
public java.lang.Number[] 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
-
readImage
public ModelImage readImage(boolean multiFile, boolean one) throws java.io.IOException
Reads the BMP header which indicates endianess, the TIFF magic number, and the offset in bytes of the first IFD. It then reads all the IFDs. This method then opens a Model of an image and imports the the images one slice at a time. Image slices are separated by an IFD.- Parameters:
multiFile
-true
if a set of files each containing a separate 2D image is presentfalse
if one file with either a 2D image or a stack of 2D imagesone
-true
if 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.
-
-