Class FileMedVision


  • public class FileMedVision
    extends FileBase
    The class reads MedVision files that have been saved as MAC bin files. The MAC files have needed image resolutions encoded in the in the resource section at the end of the file. MedVision also has method of saving images to the Intel world but pixel resolutions are not stored. Here I decode MAC MedVision files. It is easy to write a Intel MedVision reader or one could directly read in the file using using MIPA because they have a fixed offset and can be read in using the RAW file reader.
    Version:
    0.1 June 25, 1998
    Author:
    Matthew J. McAuliffe, Ph.D.
    See Also:
    FileIO, FileInfoMedVision, FileRaw, FileRawChunk
    • Field Detail

      • file

        private java.io.File file
        DOCUMENT ME!
      • fileDir

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

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

        private float[] resolutions
        DOCUMENT ME!
      • slicePosition

        private double[] slicePosition
        DOCUMENT ME!
      • sliceResolutions

        private double[][] sliceResolutions
        DOCUMENT ME!
    • Constructor Detail

      • FileMedVision

        public FileMedVision​(java.lang.String fName,
                             java.lang.String fDir)
        FileMedVision - MedVision reader/writer constructor.
        Parameters:
        fName - file name
        fDir - file directory
    • Method Detail

      • readImage

        public ModelImage readImage()
                             throws java.io.IOException
        readImage - reads a MedVision file in MAC format (i.e., decodes resource info).
        Returns:
        image model of the data read in from the file
        Throws:
        java.io.IOException - if there is an error reading the file
        See Also:
        FileRawChunk
      • copyFileInfoCommon

        private void copyFileInfoCommon()
        copyFileInfoCommon - copy common file info into new header Better must exist but this works.
      • decodeFileHeader

        private boolean decodeFileHeader​(boolean endianess)
                                  throws java.io.IOException
        readFileHeader - reader image file header that encodes info about image.
        Parameters:
        endianess - boolean describing byte order
        Returns:
        boolean indicating successful read
        Throws:
        java.io.IOException - if there is an error reading the file
        See Also:
        FileInfoMedVision
      • decodeResourceFooter

        private void decodeResourceFooter​(boolean endianess)
                                   throws java.io.IOException
        decodeResourceFooter - This is the tricky function that decodes the the resource footer at the end of the MAC file The data is coded is very odd manner. I was unable to find MAC documentation and decoded it by "hand"
        Parameters:
        endianess - boolean describing byte order
        Throws:
        java.io.IOException - if there is an error reading the file
      • decodeSliceHeader

        private boolean decodeSliceHeader​(long start,
                                          FileInfoMedVision fileInfo,
                                          boolean endianess)
                                   throws java.io.IOException
        decodeSliceHeader - reads image slice header that encodes info about specific image slice.
        Parameters:
        start - start of file information
        fileInfo - file information
        endianess - boolean describing byte order
        Returns:
        boolean indicating successful decoding
        Throws:
        java.io.IOException - if there is an error reading the file
      • getMedVisionDouble

        private double getMedVisionDouble​(boolean endianess)
                                   throws java.io.IOException
        getMedVisionDouble - extracts double value from MedVision MAC resource fork.
        Parameters:
        endianess - describes byte ordering of data
        Returns:
        returns extracted double
        Throws:
        java.io.IOException - if there is an error reading the file