Package gov.nih.mipav.model.file
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:
FileIO
,FileInfoMedVision
,FileRaw
,FileRawChunk
-
-
Field Summary
Fields Modifier and Type Field Description static short
BIT16
DOCUMENT ME!static short
BIT8
DOCUMENT ME!private java.io.File
file
DOCUMENT ME!private java.lang.String
fileDir
DOCUMENT ME!private FileInfoMedVision
fileInfo
DOCUMENT ME!private FileInfoMedVision
fileInfoCom
DOCUMENT ME!private java.lang.String
fileName
DOCUMENT ME!private ModelImage
image
DOCUMENT ME!private ViewJProgressBar
progressBar
DOCUMENT ME!private float[]
resolutions
DOCUMENT ME!static short
S16BIT
DOCUMENT ME!static short
S8BIT
DOCUMENT ME!static short
SIGNED
DOCUMENT ME!private double[]
slicePosition
DOCUMENT ME!private double[][]
sliceResolutions
DOCUMENT ME!static short
U16BIT
DOCUMENT ME!static short
U8BIT
DOCUMENT ME!static short
UNSIGNED
DOCUMENT ME!-
Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE
-
-
Constructor Summary
Constructors Constructor Description FileMedVision(java.lang.String fName, java.lang.String fDir)
FileMedVision - MedVision reader/writer constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
copyFileInfoCommon()
copyFileInfoCommon - copy common file info into new header Better must exist but this works.private boolean
decodeFileHeader(boolean endianess)
readFileHeader - reader image file header that encodes info about image.private void
decodeResourceFooter(boolean endianess)
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.private boolean
decodeSliceHeader(long start, FileInfoMedVision fileInfo, boolean endianess)
decodeSliceHeader - reads image slice header that encodes info about specific image slice.private double
getMedVisionDouble(boolean endianess)
getMedVisionDouble - extracts double value from MedVision MAC resource fork.ModelImage
readImage()
readImage - reads a MedVision file in MAC format (i.e., decodes resource info).-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
-
-
-
Field Detail
-
BIT8
public static final short BIT8
DOCUMENT ME!- See Also:
- Constant Field Values
-
BIT16
public static final short BIT16
DOCUMENT ME!- See Also:
- Constant Field Values
-
SIGNED
public static final short SIGNED
DOCUMENT ME!- See Also:
- Constant Field Values
-
UNSIGNED
public static final short UNSIGNED
DOCUMENT ME!- See Also:
- Constant Field Values
-
S8BIT
public static final short S8BIT
DOCUMENT ME!- See Also:
- Constant Field Values
-
U8BIT
public static final short U8BIT
DOCUMENT ME!- See Also:
- Constant Field Values
-
S16BIT
public static final short S16BIT
DOCUMENT ME!- See Also:
- Constant Field Values
-
U16BIT
public static final short U16BIT
DOCUMENT ME!- See Also:
- Constant Field Values
-
file
private java.io.File file
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
DOCUMENT ME!
-
fileInfo
private FileInfoMedVision fileInfo
DOCUMENT ME!
-
fileInfoCom
private FileInfoMedVision fileInfoCom
DOCUMENT ME!
-
fileName
private java.lang.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!
-
-
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 informationfileInfo
- file informationendianess
- 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
-
-