Package gov.nih.mipav.model.file
Class FileMRC
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileMRC
-
public class FileMRC extends FileBase
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.
-
-
Field Summary
Fields Modifier and Type Field Description private intdataSizeDOCUMENT ME!private intdestTypeDOCUMENT ME!private booleanendianessDOCUMENT ME!private java.io.FilefileDOCUMENT ME!private java.lang.StringfileDirDOCUMENT ME!private FileInfoMRCfileInfoDOCUMENT ME!private FileInfoMRCfileInfoCopyprivate java.lang.StringfileNameDOCUMENT ME!private intfileSizeDOCUMENT ME!private ModelImageimageDOCUMENT ME!private int[]imgExtentsDOCUMENT ME!private ModelLUTLUTDOCUMENT ME!private intmodeDOCUMENT ME!private intmxDOCUMENT ME!private intmyDOCUMENT ME!private intmzDOCUMENT ME!private intnumberSlicesDOCUMENT ME!private intnxDOCUMENT ME!private intnXStartprivate intnyDOCUMENT ME!private intnYStartprivate intnzDOCUMENT ME!private intnZStart-
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 FileMRC(java.lang.String fileName, java.lang.String fileDir)MRC reader/writer constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinalize()Prepares this class for cleanup.ModelLUTgetModelLUT()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.ModelImagereadImage()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 Detail
-
dataSize
private int dataSize
DOCUMENT ME!
-
destType
private int destType
DOCUMENT ME!
-
endianess
private boolean endianess
DOCUMENT ME!
-
file
private java.io.File file
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
DOCUMENT ME!
-
fileInfo
private FileInfoMRC fileInfo
DOCUMENT ME!
-
fileInfoCopy
private FileInfoMRC fileInfoCopy
-
fileName
private java.lang.String fileName
DOCUMENT ME!
-
fileSize
private int fileSize
DOCUMENT ME!
-
image
private ModelImage image
DOCUMENT ME!
-
imgExtents
private int[] imgExtents
DOCUMENT ME!
-
LUT
private ModelLUT LUT
DOCUMENT ME!
-
mode
private int mode
DOCUMENT ME!
-
mx
private int mx
DOCUMENT ME!
-
my
private int my
DOCUMENT ME!
-
mz
private int mz
DOCUMENT ME!
-
numberSlices
private int numberSlices
DOCUMENT ME!
-
nx
private int nx
DOCUMENT ME!
-
ny
private int ny
DOCUMENT ME!
-
nz
private int nz
DOCUMENT ME!
-
nXStart
private int nXStart
-
nYStart
private int nYStart
-
nZStart
private int nZStart
-
-
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.
-
getModelLUT
public ModelLUT getModelLUT()
returns LUT if defined.- Returns:
- the LUT if defined else it is null
-
readImage
public ModelImage readImage() throws java.io.IOException
reads the MRC file header and data.- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException- if there is an error reading the file
-
writeImage
public void writeImage(ModelImage image, FileWriteOptions options) throws java.io.IOException
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:
java.io.IOException- if there is an error writing the file
-
readBuffer
private void readBuffer(int slice, float[] buffer) throws java.io.IOExceptionReads 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:
java.io.IOException- if there is an error reading the file
-
readComplexBuffer
private void readComplexBuffer(int slice, float[] buffer, float[] buffer2) throws java.io.IOExceptionReads 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:
java.io.IOException- if there is an error reading the file
-
-