Package gov.nih.mipav.model.file
Class FileJP2
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.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 Summary
Fields Modifier and Type Field Description private javax.swing.JDialog
advDecOptDialog
The height of imageprivate javax.swing.JRadioButton
cerOff
private javax.swing.JRadioButton
cerOn
private javax.swing.JRadioButton
codeStrInfoOff
private javax.swing.JRadioButton
codeStrInfoOn
private javax.swing.JCheckBox
csIgnoreBox
private javax.swing.JRadioButton
cverberOff
private javax.swing.JRadioButton
cverberOn
private javax.swing.JButton
decCancelBut
private javax.swing.JButton
decDefBut
private javax.swing.JTextField
decFrameEnd
private javax.swing.JTextField
decFrameStart
javax.swing.JButton
decOkBut
private javax.swing.JRadioButton
decParsOff
private javax.swing.JRadioButton
decParsOn
private javax.swing.JTextField
decRateField
private javax.swing.JCheckBox
decResChkBox
private javax.swing.JTextField
decResTf
private boolean
endianess
DOCUMENT ME!private java.text.DecimalFormat
f
private java.lang.String
fileDir
File directory.private FileInfoJP2
fileInfo
File Info.private java.lang.String
fileName
File name.private ModelImage
image
Model Image.private int[]
intBuffer
DOCUMENT ME!(package private) int
nEndFrameDec
private javax.swing.JRadioButton
noRoiOff
private javax.swing.JRadioButton
noRoiOn
(package private) int
nStartFrameDec
private ViewJProgressBar
progressBar
private javax.swing.JCheckBox
showDecInf
-
Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE
-
-
Constructor Summary
Constructors Constructor Description FileJP2()
Tiff reader/writer constructor.FileJP2(java.lang.String fileName, java.lang.String fileDir, ViewJProgressBar progressBar)
Tiff reader/writer constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
private void
createDecGui()
int[]
decodeImageData(byte[] imageData, int imageType)
void
finalize()
Prepares this class for cleanup.FileInfoBase
getFileInfo()
Accessor that returns the file info.int[]
getImageBuffer()
Accessor that returns the image buffer.ModelLUT
getModelLUT()
ModelImage
readImage(boolean multiFile, boolean one)
Reads the JP2 header which indicates the number of slices and each slice's size.void
setFileDir(java.lang.String fDir)
Accessor to set the file dir (used when reading TIFF multiFile).void
setFileName(java.lang.String fName)
Accessor to set the file name (used when reading TIFF multiFile).private void
writeHeader()
This function is not used.void
writeImage(ModelImage image, FileWriteOptions options)
-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
-
-
-
Field Detail
-
endianess
private boolean endianess
DOCUMENT ME!
-
fileDir
private java.lang.String fileDir
File directory.
-
fileInfo
private FileInfoJP2 fileInfo
File Info.
-
image
private ModelImage image
Model Image.
-
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
-
progressBar
private ViewJProgressBar progressBar
-
-
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 namefileDir
- 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 namefileDir
- 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 thefinalize
method for existing elements, closes any open files and sets other elements tonull
.
-
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 presentfalse
if one file with either a 2D image or a stack of 2D imagesone
-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 interfacejava.awt.event.ActionListener
-
-