Class FileCOR

java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileCOR

public class FileCOR extends FileBase
FreeSurfer COR files are used to store 3 dimensional unsigned byte data. Suppose the file base name is table. There is a header file named table-.info/and or table-.info~ which has the header information in ascii. A separate unsigned byte file exists for each slice of the 3D image - table-001, table-002, and so on until the last slice. The default is to have xDim = yDim = zDim = 256 and xResolution = yResolution = zResolution = 0.001 meter. Note that all distances in a COR file represent meters.

The header fields are as follows: imnr0 the first slice number imnr1 the last slice number ptype the data type; 2 for unsigned byte x the x dimension y the y dimension fov the field of view thick the z resolution psiz = a common value for both the x and y resolutions locatn location strtx the minimum x value in meters endx the maximum x value in meters strty the minimum y value in meters endy the maximum y value in meters strtz the minimum z value in meters endz the maximum z value in meters tr T_r te T_e ti T_i xform transform file ras_good_file = 1 if the orientation fields are set, 0 otherwise x_ras x axis orientation y_ras y axis orientation z_ras z axis orientation c_ras volume center coordinates If orientation information is missing, the file is assumed to be coronal with z axis = R to L, y axis = S to I, and z axis = P to A. readInfoImage reads in the header information from the set of FreeSurfer COR volume images and then readImage is called once for each slice that must be read from a COR image file set.

  • Field Details

    • file

      private File file
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoCOR fileInfo
      DOCUMENT ME!
    • fileName

      private String fileName
      DOCUMENT ME!
    • foundEOF

      private boolean foundEOF
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • imageExtents

      private int[] imageExtents
      DOCUMENT ME!
    • imageOrientation

      private int imageOrientation
      DOCUMENT ME!
    • imgBuffer

      private float[] imgBuffer
      DOCUMENT ME!
    • imgResols

      private float[] imgResols
      DOCUMENT ME!
    • LUT

      private ModelLUT LUT
      DOCUMENT ME!
    • orient

      private int[] orient
      DOCUMENT ME!
  • Constructor Details

    • FileCOR

      public FileCOR(String fileName, String fileDir) throws IOException
      COR 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
    • getFileInfo

      public FileInfoBase getFileInfo()
      Accessor that returns the file info.
      Returns:
      FileInfoBase containing the file info
    • getImageBuffer

      public float[] getImageBuffer()
      Accessor that returns the image buffer.
      Returns:
      buffer of image.
    • getModelLUT

      public ModelLUT getModelLUT()
      Rreturns LUT if defined.
      Returns:
      the LUT if defined else it is null
    • readImage

      public void readImage(int length) throws IOException
      This method reads one slice from the file into byteBuffer and then transfers into the float array imgBuffer.
      Parameters:
      length - length = imageExtents[0] * imageExtents[1]
      Throws:
      IOException - if there is an error reading the file
    • readInfoImage

      public void readInfoImage() throws IOException
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • setFileName

      public void setFileName(String fName)
      Accessor to set the file name (used for reading COR multiFile).
      Parameters:
      fName - file name of image to read.
    • writeImage

      public void writeImage(ModelImage image, FileWriteOptions options) throws IOException
      Writes a COR 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
    • parse

      private String[] parse(String inString)
      DOCUMENT ME!
      Parameters:
      inString - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • readLine

      private String readLine() throws IOException
      Reads lines of the file until a nonnull String results or the end of the file is reached.
      Returns:
      the line read in
      Throws:
      IOException - if there is an error reading the file