Class 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 Detail

      • SHORT

        private static final int SHORT
        Different encoded data types used in DM3 files.
        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!
      • fileName

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

        private int fileVersion
        DOCUMENT ME!
      • identicalDesiredArraySize

        private int identicalDesiredArraySize
        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!
      • 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!
    • Constructor Detail

      • FileDM3

        public FileDM3​(java.lang.String fileName,
                       java.lang.String fileDir)
                throws java.io.IOException
        DM3 reader constructor.
        Parameters:
        fileName - file name
        fileDir - file directory
        Throws:
        java.io.IOException - if there is an error making the file
    • Method Detail

      • 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
      • 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 array
        buffer - 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 array
        bufferR - buffer where the real info is stored
        bufferI - 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 array
        buffer - 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 array
        bufferR - buffer where the real info is stored
        bufferI - 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 array
        buffer - 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!