Package gov.nih.mipav.model.file
Class FileMRC
java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileMRC
Comments from David Mastronarde:
I am not familiar with the latest standards for MRC files, but typically the extra header information has been used to save information about each section in the file. Our own implementation is largely derived from that of the Agard group at UCSF, from which the Deltavision software originates. The Deltavision standard uses two fields called "nreal" and "nint" to describe the number of 4-byte reals and integers stored per section. I deviated from that and used "nint" to hold the number of bytes of data per section, and "nreal" to hold a set of flags describing which kinds of data were present (tilt angle, frame X-Y-Z coordinates for a montage, stage position, magnification, all stored as 2-byte integers.). This information is present only for data acquired on our microscope here.
I am not familiar with the latest standards for MRC files, but typically the extra header information has been used to save information about each section in the file. Our own implementation is largely derived from that of the Agard group at UCSF, from which the Deltavision software originates. The Deltavision standard uses two fields called "nreal" and "nint" to describe the number of 4-byte reals and integers stored per section. I deviated from that and used "nint" to hold the number of bytes of data per section, and "nreal" to hold a set of flags describing which kinds of data were present (tilt angle, frame X-Y-Z coordinates for a montage, stage position, magnification, all stored as 2-byte integers.). This information is present only for data acquired on our microscope here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intDOCUMENT ME!private intDOCUMENT ME!private booleanDOCUMENT ME!private FileDOCUMENT ME!private StringDOCUMENT ME!private FileInfoMRCDOCUMENT ME!private FileInfoMRCprivate StringDOCUMENT ME!private intDOCUMENT ME!private ModelImageDOCUMENT ME!private int[]DOCUMENT ME!private ModelLUTDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intprivate intDOCUMENT ME!private intprivate intDOCUMENT ME!private intFields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfinalize()Prepares this class for cleanup.returns LUT if defined.private voidreadBuffer(int slice, float[] buffer) Reads a slice of data at a time and stores the results in the buffer.private voidreadComplexBuffer(int slice, float[] buffer, float[] buffer2) Reads a slice of data at a time and stores the results in the buffer.reads the MRC file header and data.voidwriteImage(ModelImage image, FileWriteOptions options) Writes a MRC 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 Details
-
dataSize
private int dataSizeDOCUMENT ME! -
destType
private int destTypeDOCUMENT ME! -
endianess
private boolean endianessDOCUMENT ME! -
file
DOCUMENT ME! -
fileDir
DOCUMENT ME! -
fileInfo
DOCUMENT ME! -
fileInfoCopy
-
fileName
DOCUMENT ME! -
fileSize
private int fileSizeDOCUMENT ME! -
image
DOCUMENT ME! -
imgExtents
private int[] imgExtentsDOCUMENT ME! -
LUT
DOCUMENT ME! -
mode
private int modeDOCUMENT ME! -
mx
private int mxDOCUMENT ME! -
my
private int myDOCUMENT ME! -
mz
private int mzDOCUMENT ME! -
numberSlices
private int numberSlicesDOCUMENT ME! -
nx
private int nxDOCUMENT ME! -
ny
private int nyDOCUMENT ME! -
nz
private int nzDOCUMENT ME! -
nXStart
private int nXStart -
nYStart
private int nYStart -
nZStart
private int nZStart
-
-
Constructor Details
-
FileMRC
MRC reader/writer constructor.- Parameters:
fileName- file namefileDir- file directory- Throws:
IOException- if there is an error making the file
-
-
Method Details
-
finalize
public void finalize()Prepares this class for cleanup. Calls thefinalizemethod for existing elements, closes any open files and sets other elements tonull. -
getModelLUT
returns LUT if defined.- Returns:
- the LUT if defined else it is null
-
readImage
reads the MRC file header and data.- Returns:
- DOCUMENT ME!
- Throws:
IOException- if there is an error reading the file
-
writeImage
Writes a MRC format type image.- Parameters:
image- Image model of data to write.options- options such as starting and ending slices and times- Throws:
IOException- if there is an error writing the file
-
readBuffer
Reads a slice of data at a time and stores the results in the buffer.- Parameters:
slice- offset into the file stored in the dataOffset arraybuffer- buffer where the info is stored- Throws:
IOException- if there is an error reading the file
-
readComplexBuffer
Reads a slice of data at a time and stores the results in the buffer.- Parameters:
slice- offset into the file stored in the dataOffset arraybuffer- buffer where the real info is storedbuffer2- buffer where the imaginary info is stored- Throws:
IOException- if there is an error reading the file
-