Class FileMedVision

java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.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:
  • Field Details

    • BIT8

      public static final short BIT8
      DOCUMENT ME!
      See Also:
    • BIT16

      public static final short BIT16
      DOCUMENT ME!
      See Also:
    • SIGNED

      public static final short SIGNED
      DOCUMENT ME!
      See Also:
    • UNSIGNED

      public static final short UNSIGNED
      DOCUMENT ME!
      See Also:
    • S8BIT

      public static final short S8BIT
      DOCUMENT ME!
      See Also:
    • U8BIT

      public static final short U8BIT
      DOCUMENT ME!
      See Also:
    • S16BIT

      public static final short S16BIT
      DOCUMENT ME!
      See Also:
    • U16BIT

      public static final short U16BIT
      DOCUMENT ME!
      See Also:
    • file

      private File file
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoMedVision fileInfo
      DOCUMENT ME!
    • fileInfoCom

      private FileInfoMedVision fileInfoCom
      DOCUMENT ME!
    • fileName

      private String fileName
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • progressBar

      private ViewJProgressBar progressBar
      DOCUMENT ME!
    • resolutions

      private float[] resolutions
      DOCUMENT ME!
    • slicePosition

      private double[] slicePosition
      DOCUMENT ME!
    • sliceResolutions

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

    • FileMedVision

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

    • readImage

      public ModelImage readImage() throws 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:
      IOException - if there is an error reading the file
      See Also:
    • 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 IOException
      readFileHeader - reader image file header that encodes info about image.
      Parameters:
      endianess - boolean describing byte order
      Returns:
      boolean indicating successful read
      Throws:
      IOException - if there is an error reading the file
      See Also:
    • decodeResourceFooter

      private void decodeResourceFooter(boolean endianess) throws 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:
      IOException - if there is an error reading the file
    • decodeSliceHeader

      private boolean decodeSliceHeader(long start, FileInfoMedVision fileInfo, boolean endianess) throws 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:
      IOException - if there is an error reading the file
    • getMedVisionDouble

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