Class 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:
    FileIO, FileInfoTiff, FileRaw
    • Field Detail

      • 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:
        Constant Field Values
      • IMAGE_DESCRIPTION

        public static final int IMAGE_DESCRIPTION
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • SAMPLES_PER_PIXEL

        public static final int SAMPLES_PER_PIXEL
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • STRIP_BYTE_COUNTS

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

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

        public static final int MAX_SAMPLE_VALUE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • TILE_BYTE_COUNTS

        public static final int TILE_BYTE_COUNTS
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • CONSECUTIVE_BAD_FAX_LINES

        public static final int CONSECUTIVE_BAD_FAX_LINES
        See Also:
        Constant Field Values
      • EXIFTAG_EXPOSURE_PROGRAM

        public static final int EXIFTAG_EXPOSURE_PROGRAM
        See Also:
        Constant Field Values
      • EXIFTAG_ISO_SPEED_RATINGS

        public static final int EXIFTAG_ISO_SPEED_RATINGS
        See Also:
        Constant Field Values
      • EXIFTAG_DATE_TIME_ORIGINAL

        public static final int EXIFTAG_DATE_TIME_ORIGINAL
        See Also:
        Constant Field Values
      • EXIFTAG_DATE_TIME_DIGITIZED

        public static final int EXIFTAG_DATE_TIME_DIGITIZED
        See Also:
        Constant Field Values
      • EXIFTAG_SHUTTER_SPEED_VALUE

        public static final int EXIFTAG_SHUTTER_SPEED_VALUE
        See Also:
        Constant Field Values
      • EXIFTAG_BRIGHTNESS_VALUE

        public static final int EXIFTAG_BRIGHTNESS_VALUE
        See Also:
        Constant Field Values
      • EXIFTAG_EXPOSURE_BIAS_VALUE

        public static final int EXIFTAG_EXPOSURE_BIAS_VALUE
        See Also:
        Constant Field Values
      • EXIFTAG_MAX_APERTURE_VALUE

        public static final int EXIFTAG_MAX_APERTURE_VALUE
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • EXIFTAG_FLASHPIX_VERSION

        public static final int EXIFTAG_FLASHPIX_VERSION
        See Also:
        Constant Field Values
      • EXIFTAG_PIXEL_X_DIMENSION

        public static final int EXIFTAG_PIXEL_X_DIMENSION
        See Also:
        Constant Field Values
      • EXIFTAG_PIXEL_Y_DIMENSION

        public static final int EXIFTAG_PIXEL_Y_DIMENSION
        See Also:
        Constant Field Values
      • EXIFTAG_FOCAL_PLANE_X_RESOLUTION

        public static final int EXIFTAG_FOCAL_PLANE_X_RESOLUTION
        See Also:
        Constant Field Values
      • EXIFTAG_FOCAL_PLANE_Y_RESOLUTION

        public static final int EXIFTAG_FOCAL_PLANE_Y_RESOLUTION
        See Also:
        Constant Field Values
      • EXIFTAG_FOCAL_PLANE_RESOLUTION_UNIT

        public static final int EXIFTAG_FOCAL_PLANE_RESOLUTION_UNIT
        See Also:
        Constant Field Values
      • EXIFTAG_CUSTOM_RENDERED

        public static final int EXIFTAG_CUSTOM_RENDERED
        See Also:
        Constant Field Values
      • EXIFTAG_DIGITAL_ZOOM_RATIO

        public static final int EXIFTAG_DIGITAL_ZOOM_RATIO
        See Also:
        Constant Field Values
      • EXIFTAG_SCENE_CAPTURE_TYPE

        public static final int EXIFTAG_SCENE_CAPTURE_TYPE
        See Also:
        Constant Field Values
      • META_DATA_BYTE_COUNTS

        public static final int META_DATA_BYTE_COUNTS
        Adobe Tiff Tags
        See Also:
        Constant Field Values
      • artist

        private byte[] artist
        DOCUMENT ME!
      • byteBuffer

        private byte[] byteBuffer
        DOCUMENT ME!
      • chunky

        private boolean chunky
        DOCUMENT ME!
      • dateTime

        private byte[] dateTime
        DOCUMENT ME!
      • doubleBuffer

        private double[] doubleBuffer
        DOCUMENT ME!
      • endianess

        private boolean endianess
        DOCUMENT ME!
      • file

        private java.io.File file
        The file...
      • fileDir

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

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

        private boolean foundTag43314
        DOCUMENT ME!
      • hostComputer

        private byte[] hostComputer
        DOCUMENT ME!
      • pageName

        private byte[] pageName
      • IFDoffsets

        private int[] IFDoffsets
        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 java.util.zip.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
      • copyright

        private byte[] copyright
      • str

        private java.lang.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
      • 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
      • 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
      • isRGBA

        private boolean isRGBA
      • metaDataCounts

        private int[] metaDataCounts
      • 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 Detail

      • FileTiff

        public FileTiff​(java.lang.String fileName,
                        java.lang.String fileDir)
                 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
      • 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 java.io.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:
        java.io.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 java.io.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:
        java.io.IOException
      • fax34Init

        private void fax34Init()
      • modHuffmanDecompresser

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

        private int readMH​(byte[] imgdata,
                           int off,
                           java.io.InputStream is,
                           int width)
                    throws java.io.IOException
        Throws:
        java.io.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 java.io.IOException
        Throws:
        java.io.IOException
      • readLeicaSeries

        public ModelImage readLeicaSeries​(JDialogLoadLeica.LeicaSeries series)
                                   throws java.io.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:
        java.io.IOException - DOCUMENT ME!
      • 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,
                               ModelLUT LUT,
                               FileWriteOptions options)
                        throws java.io.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:
        java.io.IOException - if there is an error writing the file.
      • openIFD

        private boolean openIFD​(FileInfoTiff fileInfo)
                         throws java.io.IOException
        Reads and decodes IFDs (Image File Directory).
        Parameters:
        fileInfo - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
        Throws:
        java.io.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 java.io.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:
        java.io.IOException - if there is an error reading the file
      • readDoubleBuffer

        private void readDoubleBuffer​(int slice,
                                      double[] buffer)
                               throws java.io.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:
        java.io.IOException - if there is an error reading the file
      • readTileBuffer

        private void readTileBuffer​(int slice,
                                    float[] buffer)
                             throws java.io.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:
        java.io.IOException - if there is an error reading the file
      • writeColorMap

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

        private void writeHeader()
                          throws java.io.IOException
        Writes TIFF starting file header.
        Throws:
        java.io.IOException - DOCUMENT ME!
      • writeIFD

        private void writeIFD​(int tag,
                              FileTiff.Type type,
                              int count,
                              int value,
                              int value2)
                       throws java.io.IOException
        Writes one 12 byte IFD entry.
        Parameters:
        tag - DOCUMENT ME!
        type - DOCUMENT ME!
        count - DOCUMENT ME!
        value - DOCUMENT ME!
        value2 - DOCUMENT ME!
        Throws:
        java.io.IOException - DOCUMENT ME!
      • writeIFDs

        private void writeIFDs​(ModelImage image,
                               int imageOffset,
                               int nextIFD,
                               int index,
                               int theStripCount,
                               boolean writePackBit)
                        throws java.io.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:
        java.io.IOException - DOCUMENT ME!