Class FileJP2

java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileJP2
All Implemented Interfaces:
ActionListener, EventListener

public class FileJP2 extends FileBase implements ActionListener
Jpeg2K reader/ writer for 3D images.
Version:
0.1, Mar 2007
Author:
Dzung Nguyen, Nam Nguyen
See Also:
  • Field Details

  • Constructor Details

    • FileJP2

      public FileJP2(String fileName, String fileDir, ViewJProgressBar progressBar) throws IOException
      Tiff reader/writer constructor.
      Parameters:
      fileName - file name
      fileDir - file directory
      Throws:
      IOException - if there is an error making the file
    • FileJP2

      public FileJP2() throws IOException
      Tiff reader/writer 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
    • getFileInfo

      public FileInfoBase getFileInfo()
      Accessor that returns the file info.
      Returns:
      FileInfoBase containing the file info
    • getImageBuffer

      public int[] getImageBuffer()
      Accessor that returns the image buffer.
      Returns:
      buffer of image.
    • decodeImageData

      public int[] decodeImageData(byte[] imageData, int imageType)
    • readImage

      public ModelImage readImage(boolean multiFile, boolean one) throws IOException
      Reads the JP2 header which indicates the number of slices and each slice's size. It then reads all the encoded slice. This method then opens a Model of an image and imports the the images one slice at a time. Image slices are separated by an IFD.
      Parameters:
      multiFile - true if a set of files each containing a separate 2D image is present false if one file with either a 2D image or a stack of 2D images
      one - true if only want to read in one image of the 3D set
      Returns:
      returns the image
      Throws:
      IOException - if there is an error reading the file
    • setFileDir

      public void setFileDir(String fDir)
      Accessor to set the file dir (used when reading TIFF multiFile).
      Parameters:
      fDir - file dir of image to read.
    • setFileName

      public void setFileName(String fName)
      Accessor to set 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
      Throws:
      IOException
    • writeHeader

      private void writeHeader() throws IOException
      This function is not used. Instead, use the RAWJP2Header class. Writes JP2 starting file header.
      Throws:
      IOException - DOCUMENT ME!
    • getModelLUT

      public ModelLUT getModelLUT()
    • createDecGui

      private void createDecGui()
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener