Package gov.nih.mipav.model.file
Class FileTiff
java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileTiff
Tagged Image File Format (TIFF 6.0) reader/ writer. Note that although EchoTech has a tResolution field, there is no
provision for 4D in TIFF. Almost all of the FAX decompression code, modified Huffman decompression code, and JPEG
decompression code was taken from the free software at the website
http://www.mms-computing.co.uk/uk/co/mmscomputing/imageio/tiff ThunderScan decompression code was obtained by porting
C++ code from tif_thunder.c in tif-4.0.0.alpha\libtiff. 16 bit integer data with SGILogCompression and photometric =
CIE Log2(L)was obtained by porting LogL16Decode in tif_luv.c in tif-4.0.0.alpha\libtiff. 32 bit integer data with
SGILogCompression and photometric = CIE Log2(L) (u', v') was obtained by porting LogLuvDecode32, LogL16toY,
LogLuv32toXYZ, and XYZtoRGB24 in tif_luv.c in tif-4.0.0.alpha\libtiff. 24 bit integer data with SGILog24Compression
and photometric = CIE Log2(L) (u', v') was obtained by porting LogLuvDecode24, LogLuv24toXYZ, LogL10toY, uv_decode
and XYZtoRGB24 in tif_luv.h and uvcode.h in tif-4.0.0.alpha\libtiff. The current port of the LogLuv color compression
is not ideal for the MIPAV system. off_l16.tif, a grayscale picture of an office with a view out a much brighter
window, preserves the wide range of pixels both inside the darker office and outside the brighter window when
converted to short in MIPAV. However, when 24 bit SGILog24Compression off_luv24 and 32 bit SGILogCompression
off_luv32 are converted to ARGB in MIPAV only the darker view inside the office is adequately represented. The
brighter view thru the window is mostly saturated, so a transformation to ARGB_USHORT which preserves the window
information is really needed. Note that compression = 7 for new JPEG has been implemented, but compression = 6 for
deprecated JPEG has not been implemented. libtiff does have a 46 page file tif_ojpeg which reads in old JPEG, but
even porting this would not be sufficient since the tif_ojpeg.c file interfaces with Release 6B of the independent
JPEG library written by the Independent JPEG group. LZW compression code was obtained by porting code from tif_lzw.c
in tif-4.0.0.alpha\libtiff except for the final section on the Horizontal Differencing Predictor which comes from the
Sun Microsystems file TIFFLZWDecoder.java. Originally TIFFLZWDecoder.java was used, but it could not handle old-style
LZW code, such as with libtiff library file quad-lzw.tif. Note that the tif reader will not work properly for some
files with different tag values for different slices. For example, the libtiff file dscf0013.tif, which has slice 1
with 640 by 480 pixels and 15 rows per strip and slice 2 with 160 by 120 pixels and 120 rows per strip, will not be
read in properly. The libtiff file text.tif with 4 bits per sample and thunderscan compression in the first slice and
1 bit per sample and no compression in the second slice will not be read in properly. You can make an excellent CMYK
file from an RGB file, but you can only make a mediocre RGB file from a CMYK file. The gamut of RGB colorspace is
significantly larger than the gamut of CMYK colorspace. When you convert from RGB to CMYK, you are throwing away a
lot of data, and you can't get it back.
- Version:
- 1.0 Feb 29, 2000
- Author:
- Matthew J. McAuliffe, Ph.D., William Gandler
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassstatic interfaceprivate classSimple class to store image offsets and bytes located at the offset.classclassclassclassstatic interfaceclassclassclassclassclassclassstatic interfaceclassclassstatic interfaceclassclassstatic enumTiff Types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatprivate byte[]DOCUMENT ME!static final intDOCUMENT ME!static final intprivate intstatic final intDOCUMENT ME!private intprivate int[]private floatprivate byte[]DOCUMENT ME!private intprivate intprivate intprivate byte[]private booleanDOCUMENT ME!static final intprivate shortstatic final intDOCUMENT ME!private intstatic final intCompression: 1 = no compression 2 = modified huffman 3 = CCITT-T4(FAX3) 4 = CCITT-T6(FAX4) 5 = LZW 6 = old JPEG 7 = JPEG 8 or 32946 = zlib 32773 = packbits 32809 = thunderscan RLE. 34676 = SGI Log Luminance RLE 34677 = SGI Log 24-bit packedstatic final intprivate intprivate shortprivate byte[]static final intprivate intprivate intprivate intprivate shortprivate shortprivate Vector<FileTiff.Index>[]static final intDOCUMENT ME!private byte[]DOCUMENT ME!private byte[]private byte[]private floatstatic final intprivate byte[]static final intprivate booleanprivate double[]DOCUMENT ME!private booleanDOCUMENT ME!static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate byte[]private floatprivate shortprivate shortprivate floatstatic final intprivate short[]private booleanprivate booleanprivate FileThe file...private StringFile directory.private FileInfoTiffFile Info.private longprivate StringFile name.private FilePackBitDOCUMENT ME!private FileRawChunkDOCUMENT ME!private intstatic final intprivate intprivate byte[]private shortprivate byte[]private AlgorithmFlipprivate booleanprivate booleanprivate floatprivate floatprivate shortprivate floatprivate floatprivate booleanDOCUMENT ME!private intprivate shortstatic final intprivate byte[]private booleanprivate booleanprivate booleanprivate booleanstatic final intprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanstatic final intDOCUMENT ME!private byte[]DOCUMENT ME!static final intprivate int[]DOCUMENT ME!private ModelImageDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intstatic final intDOCUMENT ME!private byte[]DOCUMENT ME!private intDOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!static final intstatic final intstatic final intprivate byte[]private final intprivate booleanstatic final intprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate short[]private booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanstatic final intprivate booleanprivate byte[]static final intprivate short[]private shortprivate shortprivate floatprivate floatprivate floatprivate ModelLUTDOCUMENT ME!private intDOCUMENT ME!static final intprivate booleanDOCUMENT ME!static final intprivate byte[]static final intprivate byte[]static final intDOCUMENT ME!static final intDOCUMENT ME!private floatprivate intprivate shortstatic final intstatic final intAdobe Tiff Tagsprivate int[]private shortstatic final intDOCUMENT ME!private byte[]static final intstatic final intstatic final intprivate booleanprivate shortprivate longprivate shortDOCUMENT ME!private booleanstatic final intTiff Tags.private booleanprivate int[]private longprivate longprivate intstatic final intDOCUMENT ME!static final intprivate booleanPack Bit: true if the read data file has pack bit compression.static final intstatic final intprivate byte[]static final intDOCUMENT ME!static final intstatic final intDOCUMENT ME!private intDOCUMENT ME!static final intDOCUMENT ME!private intstatic final intstatic final intstatic final intDOCUMENT ME!private longstatic final intprivate booleanprivate AlgorithmRotateprivate booleanprivate booleanstatic final intDOCUMENT ME!private intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private intDOCUMENT ME!private shortprivate shortprivate intprivate shortprivate booleanprivate booleanprivate shortprivate floatprivate double[]DOCUMENT ME!private float[]DOCUMENT ME!private intprivate byte[]DOCUMENT ME!static final intDOCUMENT ME!static final intSample value to Nits, where Nits is the photometric unit for luminance, also written candelas/meter**2.private StringDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intstatic final intprivate booleanstatic final intstatic final intprivate FileTiff.JPEGInputStreamprivate shortstatic final intprivate booleanstatic final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private int[]DOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private long[]DOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private long[]DOCUMENT ME!private intDOCUMENT ME!private doubleDOCUMENT ME!static final intDOCUMENT ME!private final ViewUserInterfaceprivate byte[]private byte[]private VOIVectorprivate shortprivate intDOCUMENT ME!static final intprivate floatstatic final intstatic final intDOCUMENT ME!static final intstatic final intstatic final intprivate intprivate intprivate intprivate intDOCUMENT ME!private floatstatic final intprivate intprivate intstatic final intDOCUMENT ME!private booleanTIFF files.private Inflaterprivate doubleDOCUMENT ME!static final intEchoTech Tiff TAGS.Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidCIELABtoRGB(float[] buffer) private intcopyin(byte[] imgdata, FileTiff.ModHuffmanInputStream is, int width, boolean invert) private voiddecodeROI(byte[] buffer) private intfax34Decompresser(byte[] dataOut, byte[] dataIn) private voidvoidfinalize()Prepares this class for cleanup.private FileTiff.ModHuffmanInputStreamAccessor that returns the file info.float[]Accessor that returns the image buffer.Rreturns LUT if defined.private intgetSegment(float[] array, float[] seg, int index) private intjpegDecompresser(byte[] dataOut, byte[] dataIn, int rowsToDo) private intLogL16Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) private intLogLuv24Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) private intLogLuv32Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) private voidLZWDecompresser(byte[] inData, int bytesToRead, byte[] outData, int startingRow, int rowsToDo, int bytesToGeneratePerRow) Method to decode LZW compressed data.private intmodHuffmanDecompresser(byte[] dataOut, byte[] dataIn) private booleanopenIFD(FileInfoTiff fileInfo) Reads and decodes IFDs (Image File Directory).private voidreadBuffer(int slice, float[] buffer) Reads a slice of data at a time and stores the results in the buffer.private voidreadDoubleBuffer(int slice, double[] buffer) Reads a slice of data at a time and stores the results in the buffer.readImage(boolean multiFile, boolean one) Reads the Tiff header which indicates endianess, the TIFF magic number, and the offset in bytes of the first IFD.Passed in a LeicaSeries object, this function builds a 2d or 3d reconstruction using the Vector of filenames within the series The vector has been presorted so that all files (whether red - green and then blue, or just grayscale) are read in sequentially to build the ModelImage.private intreadMH(byte[] imgdata, int off, InputStream is, int width) private voidreadTileBuffer(int slice, float[] buffer) Reads a slice of data at a time and stores the results in the buffer.voidsetFileDir(String fDir) Accessor to set the file dir (used when reading TIFF multiFile).voidsetFileName(String fName) Accessor to set the file name (used when reading TIFF multiFile).voidsetSuppressProgressBar(boolean suppressProgressBar) voidsetTIFFOrientation(boolean doTIFFOrientation) private intThunderScanDecompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) private voidwriteColorMap(int location) Writes color map to the TIFF file.private voidWrites TIFF starting file header.private voidwriteIFD(int tag, FileTiff.Type type, int count, int value, int value2) Writes one 12 byte IFD entry.private voidwriteIFDs(ModelImage image, int imageOffset, int nextIFD, int index, int theStripCount, boolean writePackBit) Writes one IFD (Image File Directory).voidwriteImage(ModelImage image, ModelLUT LUT, FileWriteOptions options) This method writes a tiff image file.private voidYCbCrtoRGB(float[] buffer, int[] YBuffer, int[] CbInBuffer, int[] CrInBuffer) 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 Details
-
NEW_SUBFILE_TYPE
public static final int NEW_SUBFILE_TYPETiff Tags.- See Also:
-
SUBFILE_TYPE
public static final int SUBFILE_TYPE- See Also:
-
IMAGE_WIDTH
public static final int IMAGE_WIDTHDOCUMENT ME!- See Also:
-
IMAGE_LENGTH
public static final int IMAGE_LENGTHDOCUMENT ME!- See Also:
-
BITS_PER_SAMPLE
public static final int BITS_PER_SAMPLEDOCUMENT ME!- See Also:
-
COMPRESSION
public static final int COMPRESSIONCompression: 1 = no compression 2 = modified huffman 3 = CCITT-T4(FAX3) 4 = CCITT-T6(FAX4) 5 = LZW 6 = old JPEG 7 = JPEG 8 or 32946 = zlib 32773 = packbits 32809 = thunderscan RLE. 34676 = SGI Log Luminance RLE 34677 = SGI Log 24-bit packed- See Also:
-
PHOTO_INTERP
public static final int PHOTO_INTERPDOCUMENT ME!- See Also:
-
THRESHHOLDING
public static final int THRESHHOLDING- See Also:
-
FILL_ORDER
public static final int FILL_ORDER- See Also:
-
DOCUMENT_NAME
public static final int DOCUMENT_NAME- See Also:
-
IMAGE_DESCRIPTION
public static final int IMAGE_DESCRIPTIONDOCUMENT ME!- See Also:
-
MAKE
public static final int MAKE- See Also:
-
MODEL
public static final int MODEL- See Also:
-
STRIP_OFFSETS
public static final int STRIP_OFFSETSDOCUMENT ME!- See Also:
-
ORIENTATION
public static final int ORIENTATIONDOCUMENT ME!- See Also:
-
SAMPLES_PER_PIXEL
public static final int SAMPLES_PER_PIXELDOCUMENT ME!- See Also:
-
ROWS_PER_STRIP
public static final int ROWS_PER_STRIPDOCUMENT ME!- See Also:
-
STRIP_BYTE_COUNTS
public static final int STRIP_BYTE_COUNTSDOCUMENT ME!- See Also:
-
MIN_SAMPLE_VALUE
public static final int MIN_SAMPLE_VALUEDOCUMENT ME!- See Also:
-
MAX_SAMPLE_VALUE
public static final int MAX_SAMPLE_VALUEDOCUMENT ME!- See Also:
-
XRESOLUTION
public static final int XRESOLUTIONDOCUMENT ME!- See Also:
-
YRESOLUTION
public static final int YRESOLUTIONDOCUMENT ME!- See Also:
-
PLANAR_CONFIG
public static final int PLANAR_CONFIGDOCUMENT ME!- See Also:
-
PAGE_NAME
public static final int PAGE_NAME- See Also:
-
XPOSITION
public static final int XPOSITION- See Also:
-
YPOSITION
public static final int YPOSITION- See Also:
-
T4OPTIONS
public static final int T4OPTIONS- See Also:
-
T6OPTIONS
public static final int T6OPTIONS- See Also:
-
RESOLUTION_UNIT
public static final int RESOLUTION_UNITDOCUMENT ME!- See Also:
-
PAGE_NUMBER
public static final int PAGE_NUMBER- See Also:
-
SOFTWARE
public static final int SOFTWAREDOCUMENT ME!- See Also:
-
DATE_TIME
public static final int DATE_TIMEDOCUMENT ME!- See Also:
-
ARTIST
public static final int ARTISTDOCUMENT ME!- See Also:
-
HOST_COMPUTER
public static final int HOST_COMPUTERDOCUMENT ME!- See Also:
-
PREDICTOR
public static final int PREDICTORDOCUMENT ME!- See Also:
-
COLOR_MAP
public static final int COLOR_MAPDOCUMENT ME!- See Also:
-
HALFTONE_HINTS
public static final int HALFTONE_HINTS- See Also:
-
TILE_WIDTH
public static final int TILE_WIDTHDOCUMENT ME!- See Also:
-
TILE_LENGTH
public static final int TILE_LENGTHDOCUMENT ME!- See Also:
-
TILE_OFFSETS
public static final int TILE_OFFSETSDOCUMENT ME!- See Also:
-
TILE_BYTE_COUNTS
public static final int TILE_BYTE_COUNTSDOCUMENT ME!- See Also:
-
BAD_FAX_LINES
public static final int BAD_FAX_LINES- See Also:
-
CLEAN_FAX_DATA
public static final int CLEAN_FAX_DATA- See Also:
-
CONSECUTIVE_BAD_FAX_LINES
public static final int CONSECUTIVE_BAD_FAX_LINES- See Also:
-
SUBIFDS
public static final int SUBIFDS- See Also:
-
INK_SET
public static final int INK_SET- See Also:
-
INK_NAMES
public static final int INK_NAMES- See Also:
-
DOT_RANGE
public static final int DOT_RANGE- See Also:
-
EXTRA_SAMPLES
public static final int EXTRA_SAMPLES- See Also:
-
SAMPLE_FORMAT
public static final int SAMPLE_FORMATDOCUMENT ME!- See Also:
-
JPEG_TABLES
public static final int JPEG_TABLES- See Also:
-
YCBCR_COEFFICIENTS
public static final int YCBCR_COEFFICIENTS- See Also:
-
YCBCR_SUBSAMPLING
public static final int YCBCR_SUBSAMPLING- See Also:
-
YCBCR_POSITIONING
public static final int YCBCR_POSITIONING- See Also:
-
REFERENCE_BLACK_WHITE
public static final int REFERENCE_BLACK_WHITE- See Also:
-
XMP
public static final int XMP- See Also:
-
COPYRIGHT
public static final int COPYRIGHT- See Also:
-
EXIFTAG_EXPOSURE_TIME
public static final int EXIFTAG_EXPOSURE_TIME- See Also:
-
EXIFTAG_FNUMBER
public static final int EXIFTAG_FNUMBER- See Also:
-
MODEL_PIXEL_SCALE
public static final int MODEL_PIXEL_SCALE- See Also:
-
IPTC
public static final int IPTC- See Also:
-
MODEL_TIEPOINT
public static final int MODEL_TIEPOINT- See Also:
-
PHOTOSHOP
public static final int PHOTOSHOP- See Also:
-
EXIFIFD
public static final int EXIFIFD- See Also:
-
ICC_PROFILE
public static final int ICC_PROFILE- See Also:
-
EXIFTAG_EXPOSURE_PROGRAM
public static final int EXIFTAG_EXPOSURE_PROGRAM- See Also:
-
EXIFTAG_ISO_SPEED_RATINGS
public static final int EXIFTAG_ISO_SPEED_RATINGS- See Also:
-
EXIFTAG_EXIF_VERSION
public static final int EXIFTAG_EXIF_VERSION- See Also:
-
EXIFTAG_DATE_TIME_ORIGINAL
public static final int EXIFTAG_DATE_TIME_ORIGINAL- See Also:
-
EXIFTAG_DATE_TIME_DIGITIZED
public static final int EXIFTAG_DATE_TIME_DIGITIZED- See Also:
-
EXIFTAG_SHUTTER_SPEED_VALUE
public static final int EXIFTAG_SHUTTER_SPEED_VALUE- See Also:
-
EXIFTAG_APERTURE_VALUE
public static final int EXIFTAG_APERTURE_VALUE- See Also:
-
EXIFTAG_BRIGHTNESS_VALUE
public static final int EXIFTAG_BRIGHTNESS_VALUE- See Also:
-
EXIFTAG_EXPOSURE_BIAS_VALUE
public static final int EXIFTAG_EXPOSURE_BIAS_VALUE- See Also:
-
EXIFTAG_MAX_APERTURE_VALUE
public static final int EXIFTAG_MAX_APERTURE_VALUE- See Also:
-
EXIFTAG_METERING_MODE
public static final int EXIFTAG_METERING_MODE- See Also:
-
EXIFTAG_LIGHT_SOURCE
public static final int EXIFTAG_LIGHT_SOURCE- See Also:
-
EXIFTAG_FLASH
public static final int EXIFTAG_FLASH- See Also:
-
EXIFTAG_FOCAL_LENGTH
public static final int EXIFTAG_FOCAL_LENGTH- See Also:
-
EXIFTAG_MAKER_NOTE
public static final int EXIFTAG_MAKER_NOTE- See Also:
-
EXIFTAG_USER_COMMENT
public static final int EXIFTAG_USER_COMMENT- See Also:
-
STONITS
public static final int STONITSSample value to Nits, where Nits is the photometric unit for luminance, also written candelas/meter**2.- See Also:
-
IMAGE_SOURCE_DATA
public static final int IMAGE_SOURCE_DATA- See Also:
-
EXIFTAG_FLASHPIX_VERSION
public static final int EXIFTAG_FLASHPIX_VERSION- See Also:
-
EXIFTAG_COLOR_SPACE
public static final int EXIFTAG_COLOR_SPACE- See Also:
-
EXIFTAG_PIXEL_X_DIMENSION
public static final int EXIFTAG_PIXEL_X_DIMENSION- See Also:
-
EXIFTAG_PIXEL_Y_DIMENSION
public static final int EXIFTAG_PIXEL_Y_DIMENSION- See Also:
-
EXIFTAG_FOCAL_PLANE_X_RESOLUTION
public static final int EXIFTAG_FOCAL_PLANE_X_RESOLUTION- See Also:
-
EXIFTAG_FOCAL_PLANE_Y_RESOLUTION
public static final int EXIFTAG_FOCAL_PLANE_Y_RESOLUTION- See Also:
-
EXIFTAG_FOCAL_PLANE_RESOLUTION_UNIT
public static final int EXIFTAG_FOCAL_PLANE_RESOLUTION_UNIT- See Also:
-
EXIFTAG_SENSING_METHOD
public static final int EXIFTAG_SENSING_METHOD- See Also:
-
EXIFTAG_FILE_SOURCE
public static final int EXIFTAG_FILE_SOURCE- See Also:
-
EXIFTAG_SCENE_TYPE
public static final int EXIFTAG_SCENE_TYPE- See Also:
-
EXIFTAG_CUSTOM_RENDERED
public static final int EXIFTAG_CUSTOM_RENDERED- See Also:
-
EXIFTAG_EXPOSURE_MODE
public static final int EXIFTAG_EXPOSURE_MODE- See Also:
-
EXIFTAG_WHITE_BALANCE
public static final int EXIFTAG_WHITE_BALANCE- See Also:
-
EXIFTAG_DIGITAL_ZOOM_RATIO
public static final int EXIFTAG_DIGITAL_ZOOM_RATIO- See Also:
-
EXIFTAG_SCENE_CAPTURE_TYPE
public static final int EXIFTAG_SCENE_CAPTURE_TYPE- See Also:
-
EXIFTAG_GAIN_CONTROL
public static final int EXIFTAG_GAIN_CONTROL- See Also:
-
EXIFTAG_CONTRAST
public static final int EXIFTAG_CONTRAST- See Also:
-
EXIFTAG_SATURATION
public static final int EXIFTAG_SATURATION- See Also:
-
EXIFTAG_SHARPNESS
public static final int EXIFTAG_SHARPNESS- See Also:
-
GDAL_METADATA
public static final int GDAL_METADATA- See Also:
-
META_DATA_BYTE_COUNTS
public static final int META_DATA_BYTE_COUNTSAdobe Tiff Tags- See Also:
-
META_DATA
public static final int META_DATA- See Also:
-
ZRESOLUTION
public static final int ZRESOLUTIONEchoTech Tiff TAGS.- See Also:
-
TRESOLUTION
public static final int TRESOLUTIONDOCUMENT ME!- See Also:
-
MAX_IFD_LENGTH
public static final int MAX_IFD_LENGTHDOCUMENT ME!- See Also:
-
MAGIC_NUMBER
public static final int MAGIC_NUMBER- See Also:
-
INFO
public static final int INFO- See Also:
-
LABELS
public static final int LABELS- See Also:
-
RANGES
public static final int RANGES- See Also:
-
LUTS
public static final int LUTS- See Also:
-
ROI
public static final int ROI- See Also:
-
OVERLAY
public static final int OVERLAY- See Also:
-
artist
private byte[] artistDOCUMENT ME! -
byteBuffer
private byte[] byteBufferDOCUMENT ME! -
chunky
private boolean chunkyDOCUMENT ME! -
dataOffsets
-
dateTime
private byte[] dateTimeDOCUMENT ME! -
doubleBuffer
private double[] doubleBufferDOCUMENT ME! -
endianess
private boolean endianessDOCUMENT ME! -
file
The file... -
fileDir
File directory. -
fileInfo
File Info. -
fileName
File name. -
filePB
DOCUMENT ME! -
fileRW
DOCUMENT ME! -
foundTag43314
private boolean foundTag43314DOCUMENT ME! -
hostComputer
private byte[] hostComputerDOCUMENT ME! -
pageName
private byte[] pageName -
IFDoffsets
private int[] IFDoffsetsDOCUMENT ME! -
image
DOCUMENT ME! -
imageDescription
private byte[] imageDescriptionDOCUMENT ME! -
make
private byte[] make -
model
private byte[] model -
imageSlice
private int imageSliceDOCUMENT ME! -
imgBuffer
private float[] imgBufferDOCUMENT ME! -
imgResols
private float[] imgResolsDOCUMENT ME! -
xPosition
private float xPosition -
yPosition
private float yPosition -
LUT
DOCUMENT ME! -
LUTOffset
private int LUTOffsetDOCUMENT ME! -
lightHalftone
private short lightHalftone -
darkHalftone
private short darkHalftone -
extraSamples
private short[] extraSamples -
lzwCompression
private boolean lzwCompressionDOCUMENT ME! -
zlibCompression
private boolean zlibCompressionTIFF files. -
zlibDecompresser
-
nDirEntries
private short nDirEntriesDOCUMENT ME! -
packBit
private boolean packBitPack Bit: true if the read data file has pack bit compression. -
predictor
private int predictorDOCUMENT ME! -
rowsPerStrip
private int rowsPerStripDOCUMENT ME! -
haveRowsPerStrip
private boolean haveRowsPerStrip -
samplesPerPixel
private int samplesPerPixelDOCUMENT ME! -
sliceBufferDouble
private double[] sliceBufferDoubleDOCUMENT ME! -
sliceBufferFloat
private float[] sliceBufferFloatDOCUMENT ME! -
software
private byte[] softwareDOCUMENT ME! -
documentName
private byte[] documentName -
inkNames
private byte[] inkNames -
copyright
private byte[] copyright -
str
DOCUMENT ME! -
tileByteCounts
private int[] tileByteCountsDOCUMENT ME! -
tileByteNumber
private int tileByteNumberDOCUMENT ME! -
tileLength
private int tileLengthDOCUMENT ME! -
tileMaxByteCount
private int tileMaxByteCountDOCUMENT ME! -
tileOffsetNumber
private int tileOffsetNumberDOCUMENT ME! -
tileOffsets
private long[] tileOffsetsDOCUMENT ME! -
tilesAcross
private int tilesAcrossDOCUMENT ME! -
tilesDown
private int tilesDownDOCUMENT ME! -
tilesPerImage
private int tilesPerImageDOCUMENT ME! -
tilesPerSlice
private int tilesPerSliceDOCUMENT ME! -
tileTemp
private long[] tileTempDOCUMENT ME! -
tileWidth
private int tileWidthDOCUMENT ME! -
haveTileWidth
private boolean haveTileWidth -
haveTileLength
private boolean haveTileLength -
haveTileOffsets
private boolean haveTileOffsets -
bitsPerSample
private int[] bitsPerSample -
haveChangedPhotometricTo1
private boolean haveChangedPhotometricTo1 -
tRes
private double tResDOCUMENT ME! -
xDim
private int xDimDOCUMENT ME! -
yDim
private int yDimDOCUMENT ME! -
fileLength
private long fileLength -
zRes
private double zResDOCUMENT ME! -
fillOrder
private int fillOrder -
isCIELAB
private boolean isCIELAB -
isYCbCr
private boolean isYCbCr -
isCMYK
private boolean isCMYK -
LumaRed
private float LumaRed -
LumaGreen
private float LumaGreen -
LumaBlue
private float LumaBlue -
YCbCrSubsampleHoriz
private int YCbCrSubsampleHoriz -
YCbCrSubsampleVert
private int YCbCrSubsampleVert -
YCbCrPositioning
private int YCbCrPositioning -
YReferenceBlack
private int YReferenceBlack -
YReferenceWhite
private int YReferenceWhite -
CbReferenceBlack
private int CbReferenceBlack -
CbReferenceWhite
private int CbReferenceWhite -
CrReferenceBlack
private int CrReferenceBlack -
CrReferenceWhite
private int CrReferenceWhite -
inkSet
private final int inkSet- See Also:
-
isBW2
private boolean isBW2 -
isBW4
private boolean isBW4 -
isBW6
private boolean isBW6 -
isBW10
private boolean isBW10 -
isBW12
private boolean isBW12 -
isBW14
private boolean isBW14 -
isBW24
private boolean isBW24 -
isRGB2
private boolean isRGB2 -
isRGB4
private boolean isRGB4 -
isRGB10
private boolean isRGB10 -
isRGB12
private boolean isRGB12 -
isRGB14
private boolean isRGB14 -
isRGB24UINTtoFLOAT
private boolean isRGB24UINTtoFLOAT -
isRGB32UINTtoFLOAT
private boolean isRGB32UINTtoFLOAT -
fax3Compression
private boolean fax3Compression -
fax4Compression
private boolean fax4Compression -
modHuffmanCompression
private boolean modHuffmanCompression -
group3_2D_Coding
private boolean group3_2D_Coding -
group3Uncompressed
private boolean group3Uncompressed -
group3Fillbits
private boolean group3Fillbits -
group4Uncompressed
private boolean group4Uncompressed -
haveMultiSpectraImage
private boolean haveMultiSpectraImage -
jpegCompression
private boolean jpegCompression -
jpegTables
private byte[] jpegTables -
tableStream
-
ThunderScanCompression
private boolean ThunderScanCompression -
isLogL
private boolean isLogL -
isLogLuv
private boolean isLogLuv -
SGILogCompression
private boolean SGILogCompression -
SGILog24Compression
private boolean SGILog24Compression -
exposureTime
private float exposureTime -
fNumber
private float fNumber -
exposureProgram
private short exposureProgram -
isoSpeedRatings
private short[] isoSpeedRatings -
exifVersion
private byte[] exifVersion -
dateTimeOriginal
private byte[] dateTimeOriginal -
dateTimeDigitized
private byte[] dateTimeDigitized -
exposureBias
private float exposureBias -
maxAperture
private float maxAperture -
meteringMode
private short meteringMode -
lightSource
private short lightSource -
flash
private short flash -
focalLength
private float focalLength -
makerNote
private byte[] makerNote -
characterCode
private byte[] characterCode -
userComment
private byte[] userComment -
flashPixVersion
private byte[] flashPixVersion -
colorSpace
private int colorSpace -
fileSource
private int fileSource -
sceneType
private int sceneType -
customRendered
private short customRendered -
exposureMode
private short exposureMode -
whiteBalance
private short whiteBalance -
digitalZoomRatio
private float digitalZoomRatio -
sceneCaptureType
private short sceneCaptureType -
gainControl
private short gainControl -
contrast
private short contrast -
saturation
private short saturation -
sharpness
private short sharpness -
shutterSpeed
private float shutterSpeed -
aperture
private float aperture -
brightness
private float brightness -
focalPlaneXResolution
private float focalPlaneXResolution -
focalPlaneYResolution
private float focalPlaneYResolution -
focalPlaneResolutionUnit
private short focalPlaneResolutionUnit -
sensingMethod
private short sensingMethod -
gdalMetadata
private byte[] gdalMetadata -
badFaxLines
private int badFaxLines -
cleanFaxData
private short cleanFaxData -
consecutiveBadFaxLines
private int consecutiveBadFaxLines -
threshholding
private short threshholding -
newLZW
private boolean newLZW -
haveLZWInit
private boolean haveLZWInit -
next
private int[] next -
length
private short[] length -
value
private byte[] value -
firstChar
private byte[] firstChar -
nBits
private short nBits -
maxCode
private short maxCode -
nextData
private long nextData -
nextBits
private long nextBits -
nBitsMask
private long nBitsMask -
restart
private long restart -
bitsLeft
private int bitsLeft -
currentRecognizedCode
private int currentRecognizedCode -
previousRecognizedCode
private int previousRecognizedCode -
nextFreeEntry
private int nextFreeEntry -
maxAvailableEntry
private int maxAvailableEntry -
flipHorizontal
private boolean flipHorizontal -
rotate180
private boolean rotate180 -
flipVertical
private boolean flipVertical -
interchangeXY
private boolean interchangeXY -
rotatePlus90
private boolean rotatePlus90 -
negInterchangeXY
private boolean negInterchangeXY -
rotateMinus90
private boolean rotateMinus90 -
flipAlgo
-
rotateAlgo
-
isRGBA
private boolean isRGBA -
metaDataCounts
private int[] metaDataCounts -
VOIs
-
UI
-
doTIFFOrientation
private boolean doTIFFOrientation -
suppressProgressBar
private boolean suppressProgressBar -
haveResolutionUnit
private boolean haveResolutionUnit -
haveZResolution
private boolean haveZResolution -
channels
private int channels -
slices
private int slices -
frames
private int frames -
have4DColor
private boolean have4DColor -
have3DColor
private boolean have3DColor
-
-
Constructor Details
-
FileTiff
Tiff reader/writer constructor.- Parameters:
fileName- file namefileDir- file directory- Throws:
IOException- if there is an error making the file
-
-
Method Details
-
finalize
public void finalize()Prepares this class for cleanup. Calls thefinalizemethod for existing elements, closes any open files and sets other elements tonull. -
setTIFFOrientation
public void setTIFFOrientation(boolean doTIFFOrientation) - Parameters:
doTIFFOrientation-
-
setSuppressProgressBar
public void setSuppressProgressBar(boolean suppressProgressBar) - Parameters:
suppressProgressBar-
-
getFileInfo
Accessor that returns the file info.- Returns:
- FileInfoBase containing the file info
-
getImageBuffer
public float[] getImageBuffer()Accessor that returns the image buffer.- Returns:
- buffer of image.
-
getModelLUT
Rreturns LUT if defined.- Returns:
- the LUT if defined else it is null
-
readImage
Reads the Tiff header which indicates endianess, the TIFF magic number, and the offset in bytes of the first IFD. It then reads all the IFDs. 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-trueif a set of files each containing a separate 2D image is presentfalseif one file with either a 2D image or a stack of 2D imagesone-trueif 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
-
CIELABtoRGB
private void CIELABtoRGB(float[] buffer) -
YCbCrtoRGB
private void YCbCrtoRGB(float[] buffer, int[] YBuffer, int[] CbInBuffer, int[] CrInBuffer) - Parameters:
buffer-YBuffer-CbInBuffer-CrInBuffer-
-
LZWDecompresser
private void LZWDecompresser(byte[] inData, int bytesToRead, byte[] outData, int startingRow, int rowsToDo, int bytesToGeneratePerRow) throws IOException Method to decode LZW compressed data.- Parameters:
inData- The compressed data.bytesToRead- bytes to be read from inDataoutData- Array to return the uncompressed data in.startingRow- First row to be generated from the callrowsToDo- The number of rows the compressed data contains.bytesGeneratedPerRow-- Throws:
IOException
-
fax34Init
private void fax34Init() -
modHuffmanDecompresser
private int modHuffmanDecompresser(byte[] dataOut, byte[] dataIn) -
readMH
- Throws:
IOException
-
jpegDecompresser
private int jpegDecompresser(byte[] dataOut, byte[] dataIn, int rowsToDo) -
LogL16Decompresser
private int LogL16Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) -
LogLuv24Decompresser
private int LogLuv24Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) -
LogLuv32Decompresser
private int LogLuv32Decompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) -
ThunderScanDecompresser
private int ThunderScanDecompresser(byte[] dataOut, byte[] dataIn, int bytesToRead, int rowsToDo) -
fax34Decompresser
private int fax34Decompresser(byte[] dataOut, byte[] dataIn) -
copyin
private int copyin(byte[] imgdata, FileTiff.ModHuffmanInputStream is, int width, boolean invert) throws IOException - Throws:
IOException
-
getDecoder
- Throws:
IOException
-
readLeicaSeries
Passed in a LeicaSeries object, this function builds a 2d or 3d reconstruction using the Vector of filenames within the series The vector has been presorted so that all files (whether red - green and then blue, or just grayscale) are read in sequentially to build the ModelImage.- Parameters:
series- LeicaSeries series contains leica information for construction- Returns:
- ModelImage a 3d or 2d rgb or grayscale ModelImage
- Throws:
IOException- DOCUMENT ME!
-
setFileDir
Accessor to set the file dir (used when reading TIFF multiFile).- Parameters:
fDir- file dir of image to read.
-
setFileName
Accessor to set the file name (used when reading TIFF multiFile).- Parameters:
fName- file name of image to read.
-
writeImage
This method writes a tiff image file.- Parameters:
image- image model where the data is stored.LUT- LUT to be saved with image if not null.options- options to be used to write out the image- Throws:
IOException- if there is an error writing the file.
-
openIFD
Reads and decodes IFDs (Image File Directory).- Parameters:
fileInfo- DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
IOException- if there is an error reading the file
-
decodeROI
private void decodeROI(byte[] buffer) -
getSegment
private int getSegment(float[] array, float[] seg, int index) -
readBuffer
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 arraybuffer- buffer where the info is stored- Throws:
IOException- if there is an error reading the file
-
readDoubleBuffer
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 arraybuffer- buffer where the info is stored- Throws:
IOException- if there is an error reading the file
-
readTileBuffer
Reads a slice of data at a time and stores the results in the buffer.- Parameters:
slice- image slicebuffer- buffer where the info is stored- Throws:
IOException- if there is an error reading the file
-
writeColorMap
Writes color map to the TIFF file.- Parameters:
location- Location to write at.- Throws:
IOException- DOCUMENT ME!
-
writeHeader
Writes TIFF starting file header.- Throws:
IOException- DOCUMENT ME!
-
writeIFD
private void writeIFD(int tag, FileTiff.Type type, int count, int value, int value2) throws IOException Writes one 12 byte IFD entry.- Parameters:
tag- DOCUMENT ME!type- DOCUMENT ME!count- DOCUMENT ME!value- DOCUMENT ME!value2- DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-
writeIFDs
private void writeIFDs(ModelImage image, int imageOffset, int nextIFD, int index, int theStripCount, boolean writePackBit) throws IOException Writes one IFD (Image File Directory). One IFD per image- Parameters:
image- offset to next IFD. If equal to zero then end of imagesimageOffset- DOCUMENT ME!nextIFD- DOCUMENT ME!index- image index for file information.theStripCount- DOCUMENT ME!writePackBit- DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-