Package gov.nih.mipav.model.file
Class FileDM3
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileDM3
-
public class FileDM3 extends FileBase
Some of this code is derived from DM3_Reader.java in ImageJ.
ImageJ disclaimer:
ImageJ is being developed at the National Institutes of Health by an employee of the Federal Government in the course of his official duties. Pursuant to Title 17, Section 105 of the United States Code, this software is not subject to copyright protection and is in the public domain. ImageJ is an experimental system. NIH assumes no responsibility whatsoever for its use by other parties, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ARRAY
DOCUMENT ME!private long[]
arrayLocationArray
DOCUMENT ME!private int[]
arraySizeArray
DOCUMENT ME!private static int
BOOLEAN
DOCUMENT ME!private int
byteOrder
DOCUMENT ME!private static int
CHAR
DOCUMENT ME!private boolean
dataEndianess
DOCUMENT ME!private int[]
dataTypeArray
DOCUMENT ME!private int
desiredArraySize
DOCUMENT ME!private int
desiredImageNumber
DOCUMENT ME!private java.lang.String[]
desiredPixelUnitsArray
DOCUMENT ME!private int[][]
dimArray
DOCUMENT ME!private static int
DOUBLE
DOCUMENT ME!private boolean
endianess
DOCUMENT ME!private java.io.File
file
DOCUMENT ME!private int
fileBytes
DOCUMENT ME!private java.lang.String
fileDir
DOCUMENT ME!private FileInfoDM3
fileInfo
DOCUMENT ME!private FileInfoDM3
fileInfoCopy
private java.lang.String
fileName
DOCUMENT ME!private int
fileVersion
DOCUMENT ME!private static int
FLOAT
DOCUMENT ME!private int
identicalDesiredArraySize
DOCUMENT ME!private ModelImage
image
DOCUMENT ME!private int
imageNum
DOCUMENT ME!private int[]
imgExtents
DOCUMENT ME!private boolean
isCalibrations
DOCUMENT ME!private boolean
isData
DOCUMENT ME!private boolean
isDataType
DOCUMENT ME!private boolean
isDimension
DOCUMENT ME!private boolean
isDimensions
DOCUMENT ME!private boolean
isImageData
DOCUMENT ME!private boolean
isScale
DOCUMENT ME!private boolean
isUnits
DOCUMENT ME!private static int
LONG
DOCUMENT ME!private ModelLUT
LUT
DOCUMENT ME!private int
nDimensions
DOCUMENT ME!private int
numberSlices
DOCUMENT ME!private int[]
numDimArray
DOCUMENT ME!private static int
OCTET
DOCUMENT ME!private float[][]
pixelScaleArray
DOCUMENT ME!private java.lang.String[][]
pixelUnitsArray
DOCUMENT ME!private int[]
pixelUnitsNumber
DOCUMENT ME!private ViewJProgressBar
progressBar
DOCUMENT ME!private int
routineTagEntry
DOCUMENT ME!private int
routineTagGroup
DOCUMENT ME!private int
scaleIndex
DOCUMENT ME!private static int
SHORT
Different encoded data types used in DM3 files.private int
sourceType
DOCUMENT ME!private static int
STRING
DOCUMENT ME!private static int
STRUCT
DOCUMENT ME!private static int
ULONG
DOCUMENT ME!private int
unitsIndex
DOCUMENT ME!private static int
USHORT
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 FileDM3(java.lang.String fileName, java.lang.String fileDir)
DM3 reader constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for cleanup.ModelLUT
getModelLUT()
returns LUT if defined.private void
readArray()
DOCUMENT ME!private int[]
readArrayTypes()
DOCUMENT ME!private void
readBuffer(int slice, float[] buffer)
Reads a slice of data at a time and stores the results in the buffer.private void
readComplexBuffer(int slice, float[] bufferR, float[] bufferI)
Reads a slice of data at a time and stores the results in the buffer.private void
readDBuffer(int slice, double[] buffer)
Reads a slice of data at a time and stores the results in the buffer.private void
readDComplexBuffer(int slice, double[] bufferR, double[] bufferI)
Reads a slice of data at a time and stores the results in the buffer.ModelImage
readImage(boolean one)
reads the DM3 file header and data.private void
readLBuffer(int slice, long[] buffer)
Reads a slice of data at a time and stores the results in the buffer.private void
readSimpleData(int index, int encodedType)
DOCUMENT ME!private void
readString()
DOCUMENT ME!private void
readStruct()
DOCUMENT ME!private int[]
readStructTypes()
DOCUMENT ME!private void
readTagEntry(int index)
DOCUMENT ME!private void
readTagGroup()
DOCUMENT ME!private void
readTagType(int index)
DOCUMENT ME!-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, 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
-
SHORT
private static final int SHORT
Different encoded data types used in DM3 files.- See Also:
- Constant Field Values
-
LONG
private static final int LONG
DOCUMENT ME!- See Also:
- Constant Field Values
-
USHORT
private static final int USHORT
DOCUMENT ME!- See Also:
- Constant Field Values
-
ULONG
private static final int ULONG
DOCUMENT ME!- See Also:
- Constant Field Values
-
FLOAT
private static final int FLOAT
DOCUMENT ME!- See Also:
- Constant Field Values
-
DOUBLE
private static final int DOUBLE
DOCUMENT ME!- See Also:
- Constant Field Values
-
BOOLEAN
private static final int BOOLEAN
DOCUMENT ME!- See Also:
- Constant Field Values
-
CHAR
private static final int CHAR
DOCUMENT ME!- See Also:
- Constant Field Values
-
OCTET
private static final int OCTET
DOCUMENT ME!- See Also:
- Constant Field Values
-
STRUCT
private static final int STRUCT
DOCUMENT ME!- See Also:
- Constant Field Values
-
STRING
private static final int STRING
DOCUMENT ME!- See Also:
- Constant Field Values
-
ARRAY
private static final int ARRAY
DOCUMENT ME!- See Also:
- Constant Field Values
-
arrayLocationArray
private long[] arrayLocationArray
DOCUMENT ME!
-
arraySizeArray
private int[] arraySizeArray
DOCUMENT ME!
-
byteOrder
private int byteOrder
DOCUMENT ME!
-
dataEndianess
private boolean dataEndianess
DOCUMENT ME!
-
dataTypeArray
private int[] dataTypeArray
DOCUMENT ME!
-
desiredArraySize
private int desiredArraySize
DOCUMENT ME!
-
desiredImageNumber
private int desiredImageNumber
DOCUMENT ME!
-
desiredPixelUnitsArray
private java.lang.String[] desiredPixelUnitsArray
DOCUMENT ME!
-
dimArray
private int[][] dimArray
DOCUMENT ME!
-
endianess
private boolean endianess
DOCUMENT ME!
-
file
private java.io.File file
DOCUMENT ME!
-
fileBytes
private int fileBytes
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
DOCUMENT ME!
-
fileInfo
private FileInfoDM3 fileInfo
DOCUMENT ME!
-
fileInfoCopy
private FileInfoDM3 fileInfoCopy
-
fileName
private java.lang.String fileName
DOCUMENT ME!
-
fileVersion
private int fileVersion
DOCUMENT ME!
-
identicalDesiredArraySize
private int identicalDesiredArraySize
DOCUMENT ME!
-
image
private ModelImage image
DOCUMENT ME!
-
imageNum
private int imageNum
DOCUMENT ME!
-
imgExtents
private int[] imgExtents
DOCUMENT ME!
-
isCalibrations
private boolean isCalibrations
DOCUMENT ME!
-
isData
private boolean isData
DOCUMENT ME!
-
isDataType
private boolean isDataType
DOCUMENT ME!
-
isDimension
private boolean isDimension
DOCUMENT ME!
-
isDimensions
private boolean isDimensions
DOCUMENT ME!
-
isImageData
private boolean isImageData
DOCUMENT ME!
-
isScale
private boolean isScale
DOCUMENT ME!
-
isUnits
private boolean isUnits
DOCUMENT ME!
-
LUT
private ModelLUT LUT
DOCUMENT ME!
-
nDimensions
private int nDimensions
DOCUMENT ME!
-
numberSlices
private int numberSlices
DOCUMENT ME!
-
numDimArray
private int[] numDimArray
DOCUMENT ME!
-
pixelScaleArray
private float[][] pixelScaleArray
DOCUMENT ME!
-
pixelUnitsArray
private java.lang.String[][] pixelUnitsArray
DOCUMENT ME!
-
pixelUnitsNumber
private int[] pixelUnitsNumber
DOCUMENT ME!
-
progressBar
private ViewJProgressBar progressBar
DOCUMENT ME!
-
routineTagEntry
private int routineTagEntry
DOCUMENT ME!
-
routineTagGroup
private int routineTagGroup
DOCUMENT ME!
-
scaleIndex
private int scaleIndex
DOCUMENT ME!
-
sourceType
private int sourceType
DOCUMENT ME!
-
unitsIndex
private int unitsIndex
DOCUMENT ME!
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for cleanup. Calls thefinalize
method for existing elements, closes any open files and sets other elements tonull
.
-
getModelLUT
public ModelLUT getModelLUT()
returns LUT if defined.- Returns:
- the LUT if defined else it is null
-
readImage
public ModelImage readImage(boolean one) throws java.io.IOException
reads the DM3 file header and data.- Parameters:
one
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException
- if there is an error reading the file
-
readArray
private void readArray() throws java.io.IOException
DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readArrayTypes
private int[] readArrayTypes() throws java.io.IOException
DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException
- DOCUMENT ME!
-
readBuffer
private void readBuffer(int slice, float[] buffer) throws java.io.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 arraybuffer
- buffer where the info is stored- Throws:
java.io.IOException
- if there is an error reading the file
-
readComplexBuffer
private void readComplexBuffer(int slice, float[] bufferR, float[] bufferI) throws java.io.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 arraybufferR
- buffer where the real info is storedbufferI
- buffer where the imaginary info is stored- Throws:
java.io.IOException
- if there is an error reading the file
-
readDBuffer
private void readDBuffer(int slice, double[] buffer) throws java.io.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 arraybuffer
- buffer where the info is stored- Throws:
java.io.IOException
- if there is an error reading the file
-
readDComplexBuffer
private void readDComplexBuffer(int slice, double[] bufferR, double[] bufferI) throws java.io.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 arraybufferR
- buffer where the real info is storedbufferI
- buffer where the imaginary info is stored- Throws:
java.io.IOException
- if there is an error reading the file
-
readLBuffer
private void readLBuffer(int slice, long[] buffer) throws java.io.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 arraybuffer
- buffer where the info is stored- Throws:
java.io.IOException
- if there is an error reading the file
-
readSimpleData
private void readSimpleData(int index, int encodedType) throws java.io.IOException
DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!encodedType
- DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readString
private void readString() throws java.io.IOException
DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readStruct
private void readStruct() throws java.io.IOException
DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readStructTypes
private int[] readStructTypes() throws java.io.IOException
DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException
- DOCUMENT ME!
-
readTagEntry
private void readTagEntry(int index) throws java.io.IOException
DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readTagGroup
private void readTagGroup() throws java.io.IOException
DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
readTagType
private void readTagType(int index) throws java.io.IOException
DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!- Throws:
java.io.IOException
- DOCUMENT ME!
-
-