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 int
dataSize
DOCUMENT ME!private int
destType
DOCUMENT ME!private boolean
endianess
DOCUMENT ME!private java.io.File
file
DOCUMENT ME!private java.lang.String
fileDir
DOCUMENT ME!private FileInfoMRC
fileInfo
DOCUMENT ME!private FileInfoMRC
fileInfoCopy
private java.lang.String
fileName
DOCUMENT ME!private int
fileSize
DOCUMENT ME!private ModelImage
image
DOCUMENT ME!private int[]
imgExtents
DOCUMENT ME!private ModelLUT
LUT
DOCUMENT ME!private int
mode
DOCUMENT ME!private int
mx
DOCUMENT ME!private int
my
DOCUMENT ME!private int
mz
DOCUMENT ME!private int
numberSlices
DOCUMENT ME!private int
nx
DOCUMENT ME!private int
nXStart
private int
ny
DOCUMENT ME!private int
nYStart
private int
nz
DOCUMENT ME!private int
nZStart
-
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 void
finalize()
Prepares this class for cleanup.ModelLUT
getModelLUT()
returns LUT if defined.private void
readBuffer(int slice, float[] buffer)
Reads a slice of data at a time and stores the results in the buffer.private void
readComplexBuffer(int slice, float[] buffer, float[] buffer2)
Reads a slice of data at a time and stores the results in the buffer.ModelImage
readImage()
reads the MRC file header and data.void
writeImage(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 thefinalize
method 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.IOException
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:
java.io.IOException
- if there is an error reading the file
-
readComplexBuffer
private void readComplexBuffer(int slice, float[] buffer, float[] buffer2) throws java.io.IOException
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:
java.io.IOException
- if there is an error reading the file
-
-