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 Details

    • SHORT

      private static final int SHORT
      Different encoded data types used in DM3 files.
      See Also:
    • LONG

      private static final int LONG
      DOCUMENT ME!
      See Also:
    • USHORT

      private static final int USHORT
      DOCUMENT ME!
      See Also:
    • ULONG

      private static final int ULONG
      DOCUMENT ME!
      See Also:
    • FLOAT

      private static final int FLOAT
      DOCUMENT ME!
      See Also:
    • DOUBLE

      private static final int DOUBLE
      DOCUMENT ME!
      See Also:
    • BOOLEAN

      private static final int BOOLEAN
      DOCUMENT ME!
      See Also:
    • CHAR

      private static final int CHAR
      DOCUMENT ME!
      See Also:
    • OCTET

      private static final int OCTET
      DOCUMENT ME!
      See Also:
    • STRUCT

      private static final int STRUCT
      DOCUMENT ME!
      See Also:
    • STRING

      private static final int STRING
      DOCUMENT ME!
      See Also:
    • ARRAY

      private static final int ARRAY
      DOCUMENT ME!
      See Also:
    • 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 String[] desiredPixelUnitsArray
      DOCUMENT ME!
    • dimArray

      private int[][] dimArray
      DOCUMENT ME!
    • endianess

      private boolean endianess
      DOCUMENT ME!
    • file

      private File file
      DOCUMENT ME!
    • fileBytes

      private int fileBytes
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoDM3 fileInfo
      DOCUMENT ME!
    • fileInfoCopy

      private FileInfoDM3 fileInfoCopy
    • fileName

      private 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 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!
  • Constructor Details

    • FileDM3

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

    • 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 IOException
      reads the DM3 file header and data.
      Parameters:
      one - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - if there is an error reading the file
    • readArray

      private void readArray() throws IOException
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readArrayTypes

      private int[] readArrayTypes() throws IOException
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readBuffer

      private void readBuffer(int slice, float[] buffer) throws 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:
      IOException - if there is an error reading the file
    • readComplexBuffer

      private void readComplexBuffer(int slice, float[] bufferR, float[] bufferI) throws 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:
      IOException - if there is an error reading the file
    • readDBuffer

      private void readDBuffer(int slice, double[] buffer) throws 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:
      IOException - if there is an error reading the file
    • readDComplexBuffer

      private void readDComplexBuffer(int slice, double[] bufferR, double[] bufferI) throws 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:
      IOException - if there is an error reading the file
    • readLBuffer

      private void readLBuffer(int slice, long[] buffer) throws 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:
      IOException - if there is an error reading the file
    • readSimpleData

      private void readSimpleData(int index, int encodedType) throws IOException
      DOCUMENT ME!
      Parameters:
      index - DOCUMENT ME!
      encodedType - DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readString

      private void readString() throws IOException
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readStruct

      private void readStruct() throws IOException
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readStructTypes

      private int[] readStructTypes() throws IOException
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readTagEntry

      private void readTagEntry(int index) throws IOException
      DOCUMENT ME!
      Parameters:
      index - DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readTagGroup

      private void readTagGroup() throws IOException
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
    • readTagType

      private void readTagType(int index) throws IOException
      DOCUMENT ME!
      Parameters:
      index - DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!