Class FileJP2

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.util.EventListener

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

      • endianess

        private boolean endianess
        DOCUMENT ME!
      • fileDir

        private java.lang.String fileDir
        File directory.
      • fileName

        private java.lang.String fileName
        File name.
      • intBuffer

        private int[] intBuffer
        DOCUMENT ME!
      • advDecOptDialog

        private javax.swing.JDialog advDecOptDialog
        The height of image
      • decRateField

        private javax.swing.JTextField decRateField
      • decOkBut

        public javax.swing.JButton decOkBut
      • decDefBut

        private javax.swing.JButton decDefBut
      • decCancelBut

        private javax.swing.JButton decCancelBut
      • showDecInf

        private javax.swing.JCheckBox showDecInf
      • decResChkBox

        private javax.swing.JCheckBox decResChkBox
      • csIgnoreBox

        private javax.swing.JCheckBox csIgnoreBox
      • decParsOn

        private javax.swing.JRadioButton decParsOn
      • decParsOff

        private javax.swing.JRadioButton decParsOff
      • codeStrInfoOn

        private javax.swing.JRadioButton codeStrInfoOn
      • codeStrInfoOff

        private javax.swing.JRadioButton codeStrInfoOff
      • cerOn

        private javax.swing.JRadioButton cerOn
      • cerOff

        private javax.swing.JRadioButton cerOff
      • cverberOn

        private javax.swing.JRadioButton cverberOn
      • cverberOff

        private javax.swing.JRadioButton cverberOff
      • noRoiOn

        private javax.swing.JRadioButton noRoiOn
      • noRoiOff

        private javax.swing.JRadioButton noRoiOff
      • decResTf

        private javax.swing.JTextField decResTf
      • f

        private java.text.DecimalFormat f
      • nStartFrameDec

        int nStartFrameDec
      • nEndFrameDec

        int nEndFrameDec
      • decFrameStart

        private javax.swing.JTextField decFrameStart
      • decFrameEnd

        private javax.swing.JTextField decFrameEnd
    • Constructor Detail

      • FileJP2

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

        public FileJP2()
                throws java.io.IOException
        Tiff reader/writer 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
      • 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 java.io.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:
        java.io.IOException - if there is an error reading the file
      • setFileDir

        public void setFileDir​(java.lang.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​(java.lang.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 java.io.IOException
        Throws:
        java.io.IOException
      • writeHeader

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

        public ModelLUT getModelLUT()
      • createDecGui

        private void createDecGui()
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener