Class 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 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!
      • fileName

        private java.lang.String fileName
        DOCUMENT ME!
      • fileSize

        private int fileSize
        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
    • Constructor Detail

      • FileMRC

        public FileMRC​(java.lang.String fileName,
                       java.lang.String fileDir)
                throws java.io.IOException
        MRC reader/writer constructor.
        Parameters:
        fileName - file name
        fileDir - file directory
        Throws:
        java.io.IOException - if there is an error making the file
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for cleanup. Calls the finalize method for existing elements, closes any open files and sets other elements to null.
        Overrides:
        finalize in class FileBase
      • 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 array
        buffer - 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 array
        buffer - buffer where the real info is stored
        buffer2 - buffer where the imaginary info is stored
        Throws:
        java.io.IOException - if there is an error reading the file