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 Details

    • dataSize

      private int dataSize
      DOCUMENT ME!
    • destType

      private int destType
      DOCUMENT ME!
    • endianess

      private boolean endianess
      DOCUMENT ME!
    • file

      private File file
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoMRC fileInfo
      DOCUMENT ME!
    • fileInfoCopy

      private FileInfoMRC fileInfoCopy
    • fileName

      private 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
  • Constructor Details

    • FileMRC

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

    • 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 IOException
      reads the MRC file header and data.
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - if there is an error reading the file
    • writeImage

      public void writeImage(ModelImage image, FileWriteOptions options) throws 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:
      IOException - if there is an error writing the file
    • readBuffer

      private void readBuffer(int slice, float[] buffer) throws 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:
      IOException - if there is an error reading the file
    • readComplexBuffer

      private void readComplexBuffer(int slice, float[] buffer, float[] buffer2) throws 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:
      IOException - if there is an error reading the file