Class FileTiff

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

public class FileTiff extends FileBase
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:
  • Field Details

    • NEW_SUBFILE_TYPE

      public static final int NEW_SUBFILE_TYPE
      Tiff Tags.
      See Also:
    • SUBFILE_TYPE

      public static final int SUBFILE_TYPE
      See Also:
    • IMAGE_WIDTH

      public static final int IMAGE_WIDTH
      DOCUMENT ME!
      See Also:
    • IMAGE_LENGTH

      public static final int IMAGE_LENGTH
      DOCUMENT ME!
      See Also:
    • BITS_PER_SAMPLE

      public static final int BITS_PER_SAMPLE
      DOCUMENT ME!
      See Also:
    • COMPRESSION

      public static final int COMPRESSION
      Compression: 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_INTERP
      DOCUMENT 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_DESCRIPTION
      DOCUMENT 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_OFFSETS
      DOCUMENT ME!
      See Also:
    • ORIENTATION

      public static final int ORIENTATION
      DOCUMENT ME!
      See Also:
    • SAMPLES_PER_PIXEL

      public static final int SAMPLES_PER_PIXEL
      DOCUMENT ME!
      See Also:
    • ROWS_PER_STRIP

      public static final int ROWS_PER_STRIP
      DOCUMENT ME!
      See Also:
    • STRIP_BYTE_COUNTS

      public static final int STRIP_BYTE_COUNTS
      DOCUMENT ME!
      See Also:
    • MIN_SAMPLE_VALUE

      public static final int MIN_SAMPLE_VALUE
      DOCUMENT ME!
      See Also:
    • MAX_SAMPLE_VALUE

      public static final int MAX_SAMPLE_VALUE
      DOCUMENT ME!
      See Also:
    • XRESOLUTION

      public static final int XRESOLUTION
      DOCUMENT ME!
      See Also:
    • YRESOLUTION

      public static final int YRESOLUTION
      DOCUMENT ME!
      See Also:
    • PLANAR_CONFIG

      public static final int PLANAR_CONFIG
      DOCUMENT 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_UNIT
      DOCUMENT ME!
      See Also:
    • PAGE_NUMBER

      public static final int PAGE_NUMBER
      See Also:
    • SOFTWARE

      public static final int SOFTWARE
      DOCUMENT ME!
      See Also:
    • DATE_TIME

      public static final int DATE_TIME
      DOCUMENT ME!
      See Also:
    • ARTIST

      public static final int ARTIST
      DOCUMENT ME!
      See Also:
    • HOST_COMPUTER

      public static final int HOST_COMPUTER
      DOCUMENT ME!
      See Also:
    • PREDICTOR

      public static final int PREDICTOR
      DOCUMENT ME!
      See Also:
    • COLOR_MAP

      public static final int COLOR_MAP
      DOCUMENT ME!
      See Also:
    • HALFTONE_HINTS

      public static final int HALFTONE_HINTS
      See Also:
    • TILE_WIDTH

      public static final int TILE_WIDTH
      DOCUMENT ME!
      See Also:
    • TILE_LENGTH

      public static final int TILE_LENGTH
      DOCUMENT ME!
      See Also:
    • TILE_OFFSETS

      public static final int TILE_OFFSETS
      DOCUMENT ME!
      See Also:
    • TILE_BYTE_COUNTS

      public static final int TILE_BYTE_COUNTS
      DOCUMENT 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_FORMAT
      DOCUMENT 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:
    • 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 STONITS
      Sample 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_COUNTS
      Adobe Tiff Tags
      See Also:
    • META_DATA

      public static final int META_DATA
      See Also:
    • ZRESOLUTION

      public static final int ZRESOLUTION
      EchoTech Tiff TAGS.
      See Also:
    • TRESOLUTION

      public static final int TRESOLUTION
      DOCUMENT ME!
      See Also:
    • MAX_IFD_LENGTH

      public static final int MAX_IFD_LENGTH
      DOCUMENT 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[] artist
      DOCUMENT ME!
    • byteBuffer

      private byte[] byteBuffer
      DOCUMENT ME!
    • chunky

      private boolean chunky
      DOCUMENT ME!
    • dataOffsets

      private Vector<FileTiff.Index>[] dataOffsets
    • dateTime

      private byte[] dateTime
      DOCUMENT ME!
    • doubleBuffer

      private double[] doubleBuffer
      DOCUMENT ME!
    • endianess

      private boolean endianess
      DOCUMENT ME!
    • file

      private File file
      The file...
    • fileDir

      private String fileDir
      File directory.
    • fileInfo

      private FileInfoTiff fileInfo
      File Info.
    • fileName

      private String fileName
      File name.
    • filePB

      private FilePackBit filePB
      DOCUMENT ME!
    • fileRW

      private FileRawChunk fileRW
      DOCUMENT ME!
    • foundTag43314

      private boolean foundTag43314
      DOCUMENT ME!
    • hostComputer

      private byte[] hostComputer
      DOCUMENT ME!
    • pageName

      private byte[] pageName
    • IFDoffsets

      private int[] IFDoffsets
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • imageDescription

      private byte[] imageDescription
      DOCUMENT ME!
    • make

      private byte[] make
    • model

      private byte[] model
    • imageSlice

      private int imageSlice
      DOCUMENT ME!
    • imgBuffer

      private float[] imgBuffer
      DOCUMENT ME!
    • imgResols

      private float[] imgResols
      DOCUMENT ME!
    • xPosition

      private float xPosition
    • yPosition

      private float yPosition
    • LUT

      private ModelLUT LUT
      DOCUMENT ME!
    • LUTOffset

      private int LUTOffset
      DOCUMENT ME!
    • lightHalftone

      private short lightHalftone
    • darkHalftone

      private short darkHalftone
    • extraSamples

      private short[] extraSamples
    • lzwCompression

      private boolean lzwCompression
      DOCUMENT ME!
    • zlibCompression

      private boolean zlibCompression
      TIFF files.
    • zlibDecompresser

      private Inflater zlibDecompresser
    • nDirEntries

      private short nDirEntries
      DOCUMENT ME!
    • packBit

      private boolean packBit
      Pack Bit: true if the read data file has pack bit compression.
    • predictor

      private int predictor
      DOCUMENT ME!
    • rowsPerStrip

      private int rowsPerStrip
      DOCUMENT ME!
    • haveRowsPerStrip

      private boolean haveRowsPerStrip
    • samplesPerPixel

      private int samplesPerPixel
      DOCUMENT ME!
    • sliceBufferDouble

      private double[] sliceBufferDouble
      DOCUMENT ME!
    • sliceBufferFloat

      private float[] sliceBufferFloat
      DOCUMENT ME!
    • software

      private byte[] software
      DOCUMENT ME!
    • documentName

      private byte[] documentName
    • inkNames

      private byte[] inkNames
    • str

      private String str
      DOCUMENT ME!
    • tileByteCounts

      private int[] tileByteCounts
      DOCUMENT ME!
    • tileByteNumber

      private int tileByteNumber
      DOCUMENT ME!
    • tileLength

      private int tileLength
      DOCUMENT ME!
    • tileMaxByteCount

      private int tileMaxByteCount
      DOCUMENT ME!
    • tileOffsetNumber

      private int tileOffsetNumber
      DOCUMENT ME!
    • tileOffsets

      private long[] tileOffsets
      DOCUMENT ME!
    • tilesAcross

      private int tilesAcross
      DOCUMENT ME!
    • tilesDown

      private int tilesDown
      DOCUMENT ME!
    • tilesPerImage

      private int tilesPerImage
      DOCUMENT ME!
    • tilesPerSlice

      private int tilesPerSlice
      DOCUMENT ME!
    • tileTemp

      private long[] tileTemp
      DOCUMENT ME!
    • tileWidth

      private int tileWidth
      DOCUMENT ME!
    • haveTileWidth

      private boolean haveTileWidth
    • haveTileLength

      private boolean haveTileLength
    • haveTileOffsets

      private boolean haveTileOffsets
    • bitsPerSample

      private int[] bitsPerSample
    • haveChangedPhotometricTo1

      private boolean haveChangedPhotometricTo1
    • tRes

      private double tRes
      DOCUMENT ME!
    • xDim

      private int xDim
      DOCUMENT ME!
    • yDim

      private int yDim
      DOCUMENT ME!
    • fileLength

      private long fileLength
    • zRes

      private double zRes
      DOCUMENT 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

      private FileTiff.JPEGInputStream 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

      private AlgorithmFlip flipAlgo
    • rotateAlgo

      private AlgorithmRotate rotateAlgo
    • isRGBA

      private boolean isRGBA
    • metaDataCounts

      private int[] metaDataCounts
    • VOIs

      private VOIVector VOIs
    • UI

      private final ViewUserInterface 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

      public FileTiff(String fileName, String fileDir) 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
    • setTIFFOrientation

      public void setTIFFOrientation(boolean doTIFFOrientation)
      Parameters:
      doTIFFOrientation -
    • setSuppressProgressBar

      public void setSuppressProgressBar(boolean suppressProgressBar)
      Parameters:
      suppressProgressBar -
    • getFileInfo

      public FileInfoBase 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

      public ModelLUT getModelLUT()
      Rreturns LUT if defined.
      Returns:
      the LUT if defined else it is null
    • readImage

      public ModelImage readImage(boolean multiFile, boolean one) throws IOException
      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 - 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
    • 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 inData
      outData - Array to return the uncompressed data in.
      startingRow - First row to be generated from the call
      rowsToDo - The number of rows the compressed data contains.
      bytesGeneratedPerRow -
      Throws:
      IOException
    • fax34Init

      private void fax34Init()
    • modHuffmanDecompresser

      private int modHuffmanDecompresser(byte[] dataOut, byte[] dataIn)
    • readMH

      private int readMH(byte[] imgdata, int off, InputStream is, int width) throws IOException
      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

      private FileTiff.ModHuffmanInputStream getDecoder(InputStream is) throws IOException
      Throws:
      IOException
    • readLeicaSeries

      public ModelImage readLeicaSeries(JDialogLoadLeica.LeicaSeries series) throws IOException
      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

      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, ModelLUT LUT, FileWriteOptions options) throws IOException
      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

      private boolean openIFD(FileInfoTiff fileInfo) throws IOException
      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

      private void readBuffer(int slice, float[] buffer) throws IOException
      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 array
      buffer - buffer where the info is stored
      Throws:
      IOException - if there is an error reading the file
    • readDoubleBuffer

      private void readDoubleBuffer(int slice, double[] buffer) throws IOException
      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 array
      buffer - buffer where the info is stored
      Throws:
      IOException - if there is an error reading the file
    • readTileBuffer

      private void readTileBuffer(int slice, float[] buffer) throws IOException
      Reads a slice of data at a time and stores the results in the buffer.
      Parameters:
      slice - image slice
      buffer - buffer where the info is stored
      Throws:
      IOException - if there is an error reading the file
    • writeColorMap

      private void writeColorMap(int location) throws IOException
      Writes color map to the TIFF file.
      Parameters:
      location - Location to write at.
      Throws:
      IOException - DOCUMENT ME!
    • writeHeader

      private void writeHeader() throws IOException
      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 images
      imageOffset - DOCUMENT ME!
      nextIFD - DOCUMENT ME!
      index - image index for file information.
      theStripCount - DOCUMENT ME!
      writePackBit - DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!