Class FileInterfile

java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileInterfile

public class FileInterfile extends FileBase
Author:
William Gandler
See Also:
  • Field Details

    • SIGNED_INTEGER

      private static final int SIGNED_INTEGER
      DOCUMENT ME!
      See Also:
    • UNSIGNED_INTEGER

      private static final int UNSIGNED_INTEGER
      DOCUMENT ME!
      See Also:
    • LONG_FLOAT

      private static final int LONG_FLOAT
      DOCUMENT ME!
      See Also:
    • SHORT_FLOAT

      private static final int SHORT_FLOAT
      DOCUMENT ME!
      See Also:
    • BIT

      private static final int BIT
      DOCUMENT ME!
      See Also:
    • ASCII

      private static final int ASCII
      DOCUMENT ME!
      See Also:
    • bufferSize

      private int bufferSize
      DOCUMENT ME!
    • bytesPerPixel

      private int bytesPerPixel
      DOCUMENT ME!
    • dataByteOffset

      private long dataByteOffset
      DOCUMENT ME!
    • dataFile

      private File dataFile
      DOCUMENT ME!
    • dataFileName

      private String dataFileName
      DOCUMENT ME!
    • headerFileName

      private String headerFileName
    • dataStartingBlock

      private int dataStartingBlock
      DOCUMENT ME!
    • endianess

      private boolean endianess
      DOCUMENT ME!
    • file

      private File file
      DOCUMENT ME!
    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoInterfile fileInfo
      DOCUMENT ME!
    • fileInfoCopy

      private FileInfoInterfile fileInfoCopy
    • fileLength

      private long fileLength
      DOCUMENT ME!
    • fileName

      private String fileName
      DOCUMENT ME!
    • fileRW

      private FileRawChunk fileRW
      DOCUMENT ME!
    • foundEOF

      private boolean foundEOF
      DOCUMENT ME!
    • haveBytesPerPixel

      private boolean haveBytesPerPixel
      DOCUMENT ME!
    • haveDataByteOffset

      private boolean haveDataByteOffset
      DOCUMENT ME!
    • haveDataStartingBlock

      private boolean haveDataStartingBlock
      DOCUMENT ME!
    • haveDecayCorrected

      private boolean haveDecayCorrected
      DOCUMENT ME!
    • haveDetectorHeadNumber

      private boolean haveDetectorHeadNumber
      DOCUMENT ME!
    • haveEndianess

      private boolean haveEndianess
      DOCUMENT ME!
    • haveEnergyWindowsNumber

      private boolean haveEnergyWindowsNumber
      DOCUMENT ME!
    • haveFileName

      private boolean haveFileName
      DOCUMENT ME!
    • haveFloodCorrected

      private boolean haveFloodCorrected
      DOCUMENT ME!
    • haveImagesPerEWindow

      private boolean haveImagesPerEWindow
      DOCUMENT ME!
    • haveNumberFormat

      private boolean haveNumberFormat
      DOCUMENT ME!
    • haveOrientation

      private boolean haveOrientation
      DOCUMENT ME!
    • haveReconstructed

      private boolean haveReconstructed
      DOCUMENT ME!
    • haveReferenceFrameNumber

      private boolean haveReferenceFrameNumber
      DOCUMENT ME!
    • haveResolsT

      private boolean haveResolsT
      DOCUMENT ME!
    • haveResolsX

      private boolean haveResolsX
      DOCUMENT ME!
    • haveResolsY

      private boolean haveResolsY
      DOCUMENT ME!
    • haveResolsZ

      private boolean haveResolsZ
      DOCUMENT ME!
    • haveSliceThickness

      private boolean haveSliceThickness
      DOCUMENT ME!
    • haveTDim

      private boolean haveTDim
    • haveTomographic

      private boolean haveTomographic
      DOCUMENT ME!
    • haveTotalImageNumber

      private boolean haveTotalImageNumber
      DOCUMENT ME!
    • haveXDim

      private boolean haveXDim
      DOCUMENT ME!
    • haveYDim

      private boolean haveYDim
      DOCUMENT ME!
    • haveZDim

      private boolean haveZDim
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • imageOrientation

      private int imageOrientation
      DOCUMENT ME!
    • imgBuffer

      private float[] imgBuffer
      DOCUMENT ME!
    • imgDBuffer

      private double[] imgDBuffer
      DOCUMENT ME!
    • imgExtents

      private int[] imgExtents
      DOCUMENT ME!
    • imgLBuffer

      private long[] imgLBuffer
      DOCUMENT ME!
    • imgResols

      private float[] imgResols
      DOCUMENT ME!
    • isotopeNumber

      private String isotopeNumber
      DOCUMENT ME!
    • LUT

      private ModelLUT LUT
      DOCUMENT ME!
    • numberFormat

      private int numberFormat
      DOCUMENT ME!
    • numberSlices

      private int numberSlices
      DOCUMENT ME!
    • orientation

      private int orientation
      DOCUMENT ME!
    • originalFileName

      private String originalFileName
      DOCUMENT ME!
    • resXUnit

      private int resXUnit
      DOCUMENT ME!
    • resYUnit

      private int resYUnit
      DOCUMENT ME!
    • resZUnit

      private int resZUnit
      DOCUMENT ME!
    • scalingFactor1

      private float scalingFactor1
      DOCUMENT ME!
    • scalingFactor2

      private float scalingFactor2
      DOCUMENT ME!
    • scalingFactor3

      private float scalingFactor3
      DOCUMENT ME!
    • scalingFactor4

      private float scalingFactor4
      DOCUMENT ME!
    • tDim

      private int tDim
      DOCUMENT ME!
    • timeFrame

      private String timeFrame
      DOCUMENT ME!
    • totalImageNumber

      private int totalImageNumber
      DOCUMENT ME!
    • type

      private int type
      DOCUMENT ME!
    • windowNumber

      private String windowNumber
      DOCUMENT ME!
    • xDim

      private int xDim
      DOCUMENT ME!
    • xResol

      private float xResol
      DOCUMENT ME!
    • yResol

      private float yResol
      DOCUMENT ME!
    • zResol

      private float zResol
      DOCUMENT ME!
    • yDim

      private int yDim
      DOCUMENT ME!
    • zDim

      private int zDim
      DOCUMENT ME!
    • haveStaticStudy

      private boolean haveStaticStudy
  • Constructor Details

    • FileInterfile

      public FileInterfile(String originalFileName, String fileDir) throws IOException
      Interfile reader/writer constructor.
      Parameters:
      originalFileName - 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
    • isInterfile

      public static String isInterfile(String fName, String fDir)
      Method to test to determine if the image format is Cheshire, so appropriate read method may be called.
      Parameters:
      fName - File name of image.
      fDir - Directory.
      Returns:
      true if Cheshire file, false otherwise.
    • getFileInfo

      public FileInfoInterfile getFileInfo()
      Returns the file info.
      Returns:
      FileInfoBase containing the file info
    • getImageBuffer

      public float[] getImageBuffer()
      Returns the image buffer.
      Returns:
      buffer of image.
    • getModelLUT

      public ModelLUT getModelLUT()
      Returns LUT if defined.
      Returns:
      the LUT if defined else it is null
    • readImage

      public ModelImage readImage(boolean one, boolean readData) throws IOException
      Reads the image.
      Parameters:
      one - Flag for only reading one image of dataset.
      readData -
      Returns:
      returns the image
      Throws:
      IOException - if there is an error reading the file
    • setFileName

      public void setFileName(String fName)
      Sets the file name (used when reading TIFF multiFile).
      Parameters:
      fName - file name of image to read.
    • writeImage

      public void writeImage(ModelImage image, FileWriteOptions options) throws IOException
      Writes an Interfile format type image.
      Parameters:
      image - Image model of data to write.
      options - options such as starting and ending slices and times
      Throws:
      IOException - if there is an error writing the file
    • removeChars

      private static String removeChars(String inString)
      Removes white space and exclamation marks.
      Parameters:
      inString - String to remove characters from.
      Returns:
      new String with removed white space.
    • returnKey

      private static String returnKey(String inString)
      Returns the key found in the string.
      Parameters:
      inString - String to search for key in.
      Returns:
      Key, or null if not found
    • readBBuffer

      private void readBBuffer(int slice, float[] buffer) throws IOException
      DOCUMENT ME!
      Parameters:
      slice - DOCUMENT ME!
      buffer - 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
    • 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
    • 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
    • readLine

      private String readLine() throws IOException
      Reads lines of the file and strips comments indicated by the ; symbol until a nonnull String results or the end of the file is reached.
      Returns:
      the line read in
      Throws:
      IOException - if there is an error reading the file
    • returnValue

      private String returnValue(String inString)
      Returns the value found in the string.
      Parameters:
      inString - String to search for value in.
      Returns:
      Value, or null if not found