Class FileMetaImage

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

public class FileMetaImage extends FileBase
  • Field Details

    • fileDir

      private String fileDir
      DOCUMENT ME!
    • fileInfo

      private FileInfoMetaImage fileInfo
      DOCUMENT ME!
    • fileName

      private String fileName
      DOCUMENT ME!
    • headerSize

      private long headerSize
    • currentLocation

      private long currentLocation
    • file

      private File file
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • origin

      private float[] origin
      DOCUMENT ME!
    • resolutions

      private float[] resolutions
    • numValues

      private int numValues
    • fieldSeparator

      private String fieldSeparator
      DOCUMENT ME!
    • category

      private String category
    • baseName

      private String baseName
    • values

      private String[] values
    • nDims

      private int nDims
    • defaultFileDataName

      private String defaultFileDataName
    • defaultFileData

      private File defaultFileData
    • defaultFileDataExists

      private boolean defaultFileDataExists
    • asciiFormat

      private boolean asciiFormat
    • compressedData

      private boolean compressedData
    • extents

      private int[] extents
    • matrix

      private TransMatrix matrix
    • compressedDataSize

      private int compressedDataSize
    • sepFound

      private boolean sepFound
    • zlibDecompresser

      private Inflater zlibDecompresser
    • oneFile

      private boolean oneFile
      If true, header and data both stored in .mha file. If false, header stored in filename.mhd and data stored in filename.raw.
    • fileHeader

      private File fileHeader
  • Constructor Details

    • FileMetaImage

      public FileMetaImage(String fName, String fDir)
      Constructs new file object.
      Parameters:
      fName - File name.
      fDir - File directory.
  • Method Details

    • readImage

      public ModelImage readImage(boolean one) throws IOException
      reads the MetaImatge file header and data.
      Parameters:
      one - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - if there is an error reading the file
    • updateorigins

      private void updateorigins(FileInfoBase[] fileInfo)
      Updates the start locations. Each image has a fileinfo where the start locations are stored. Note that the start location for the Z (3rd) dimension change with the change is the slice. The origin is in the upper left corner and we are using the right hand rule. + x -> left to right; + y -> top to bottom and + z -> into screen.
      Parameters:
      fileInfo - DOCUMENT ME!
    • readLine

      private void readLine() throws IOException
      readLine() - reads a line of the file header separate into category, subcategory, and values.
      Throws:
      IOException - if there is an error reading the file
    • writeImage

      public void writeImage(ModelImage image, FileWriteOptions options) throws IOException
      Writes an MetaImage format type image.
      Parameters:
      image - Image model of data to write.
      Throws:
      IOException - if there is an error writing the file
      See Also:
      • invalid reference
        FileInfoMeta
      • FileRaw
    • writeHeader

      public boolean writeHeader(ModelImage image, int nImagesSaved, int nTimeSaved, String fileName, String fileDir, boolean oneFile, int headerIndex, long[] finalHeaderPosition) throws IOException
      Writes a MetaImage header to a separate file.
      Parameters:
      image - Image model of data to write.
      fileName - File name.
      fileDir - File directory.
      Returns:
      Flag to confirm a successful read.
      Throws:
      IOException - if there is an error
      See Also:
    • writeHeader3DTo2D

      private void writeHeader3DTo2D(ModelImage image, String fileName, String fileDir, FileWriteOptions options, boolean oneFile, long[] finalHeaderPosition) throws IOException
      This method is used when saving a 3D image in an array of 2D files. The file name has numbers appended to correctly order the images.
      Parameters:
      image - the image dataset to be saved
      fileName - the file name
      fileDir - the file directory
      options - file options indicate how to save the image
      Throws:
      IOException - DOCUMENT ME!
    • writeHeader4DTo3D

      private void writeHeader4DTo3D(ModelImage image, String fileName, String fileDir, FileWriteOptions options, boolean oneFile, long[] finalHeaderPosition) throws IOException
      This method is used when saving a 4D image in an array of 3D files. The file name has numbers appended to correctly order the images.
      Parameters:
      image - the image dataset to be saved
      fileName - the file name
      fileDir - the file directory
      options - file options indicate how to save the image
      Throws:
      IOException - DOCUMENT ME!