loci.formats.in

## Class MinimalTiffReader

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatReader
    - - loci.formats.SubResolutionFormatReader
      - - loci.formats.in.MinimalTiffReader

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler
  Direct Known Subclasses:
    BaseTiffReader

      public class MinimalTiffReader
      extends SubResolutionFormatReader

  MinimalTiffReader is the superclass for file format readers compatible with or derived from the TIFF 6.0 file format.
  Author:
    Melissa Linkert melissa at glencoesoftware.com

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `canSeparateSeries` Whether or not IFDs with different dimensions can be split into separate series.
    `protected boolean` | `equalStrips`
    `protected IFDList` | `ifds` List of IFDs for the current TIFF.
    `private JPEG2000CodecOptions` | `j2kCodecOptions` Codec options to use when decoding JPEG 2000 data.
    `protected int` | `lastPlane`
    `private static org.slf4j.Logger` | `LOGGER` Logger for this class.
    `protected boolean` | `mergeSubIFDs` Merge SubIFDs into the main IFD list.
    `protected boolean` | `noSubresolutions`
    `private java.lang.Integer` | `resolutionLevels` Number of JPEG 2000 resolution levels.
    `protected boolean` | `seriesToIFD`
    `protected java.util.List<IFDList>` | `subResolutionIFDs` List of sub-resolution IFDs for each IFD in the current TIFF with the same order as `ifds`.
    `protected IFDList` | `thumbnailIFDs` List of thumbnail IFDs for the current TIFF.
    `protected TiffParser` | `tiffParser`
    `protected boolean` | `use64Bit`

    - ### Fields inherited from class loci.formats.SubResolutionFormatReader

      `core`

    - ### Fields inherited from class loci.formats.FormatReader

      `coreIndex, datasetDescription, domains, fillColor, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSION`

    - ### Fields inherited from class loci.formats.FormatHandler

      `COMPRESSION_SUFFIXES, currentId, format, metadataOptions, suffixes`

    - ### Fields inherited from interface loci.formats.IFormatReader

      `CAN_GROUP, CANNOT_GROUP, MUST_GROUP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MinimalTiffReader()` Constructs a new MinimalTiffReader.
    `MinimalTiffReader(java.lang.String name, java.lang.String suffix)` Constructs a new MinimalTiffReader.
    `MinimalTiffReader(java.lang.String name, java.lang.String[] suffixes)` Constructs a new MinimalTiffReader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(boolean fileOnly)` Closes the currently open file.
    `protected byte[]` | `copyTile(IFD ifd, byte[] buf, int x, int y)`
    `short[][]` | `get16BitLookupTable()` Gets the 16-bit color lookup table associated with the most recently opened image.
    `byte[][]` | `get8BitLookupTable()` Gets the 8-bit color lookup table associated with the most recently opened image.
    `protected long` | `getCompressedByteCount(IFD ifd, int x, int y)`
    `IFDList` | `getIFDs()` Gets the list of IFDs associated with the current TIFF's image planes.
    `int` | `getOptimalTileHeight()` Returns the optimal sub-image height for use with openBytes.
    `int` | `getOptimalTileWidth()` Returns the optimal sub-image width for use with openBytes.
    `IFDList` | `getThumbnailIFDs()` Gets the list of IFDs associated with the current TIFF's thumbnails.
    `int` | `getThumbSizeX()` Get the size of the X dimension for the thumbnail.
    `int` | `getThumbSizeY()` Get the size of the Y dimension for the thumbnail.
    `protected int` | `getTileIndex(IFD ifd, int x, int y)` Get the index of the tile corresponding to given IFD (plane) and tile XY indexes.
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `protected void` | `initTiffParser()` Reinitialize the underlying TiffParser.
    `boolean` | `isThisType(loci.common.RandomAccessInputStream stream)` Checks if the given stream is a valid stream for this file format.
    `byte[]` | `openBytes(int no, byte[] buf, int x, int y, int w, int h)` Obtains a sub-image of the specified image plane into a pre-allocated byte array.
    `byte[]` | `openThumbBytes(int no)` Obtains a thumbnail for the specified image plane from the current file, as a byte array.
    `void` | `reopenFile()` Reopen any files that were closed, and which are expected to be open while the reader is open.
    `protected void` | `setResolutionLevel(IFD ifd)` Sets the resolution level when we have JPEG 2000 compressed data.

    - ### Methods inherited from class loci.formats.SubResolutionFormatReader

      `coreIndexToSeries, flattenHashtables, getCoreIndex, getCoreMetadataList, getCurrentCore, getResolution, getResolutionCount, getSeries, getSeriesCount, seriesToCoreIndex, setCoreIndex, setResolution, setSeries`

    - ### Methods inherited from class loci.formats.FormatReader

      `addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMetaList, addMeta, addMetaList, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMetaList, close, fileGroupOption, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCorrection, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, getFillColor, getFillRule, getFilterType, getFontFamily, getFontStyle, getGlobalMeta, getGlobalMetadata, getIlluminationType, getImageCount, getImmersion, getIndex, getIndex, getLaserMedium, getLaserType, getMarker, getMedium, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getMicrobeamManipulationType, getMicroscopeType, getModuloC, getModuloT, getModuloZ, getNamingConvention, getPixelType, getPixelType, getPossibleDomains, getPulse, getRequiredDirectories, getRGBChannelCount, getRotationTransform, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, readPlane, readPlane, readPlane, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, updateMetadataLists`

    - ### Methods inherited from class loci.formats.FormatHandler

      `checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface loci.formats.IFormatHandler

      `getFormat, getNativeDataType, getSuffixes`

    - ### Methods inherited from interface loci.formats.IMetadataConfigurable

      `getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from interface loci.formats.ICompressedTileReader

      `getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytes`

- - ### Field Detail

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      Logger for this class.

    - #### ifds

          protected IFDList ifds

      List of IFDs for the current TIFF.

    - #### thumbnailIFDs

          protected IFDList thumbnailIFDs

      List of thumbnail IFDs for the current TIFF.

    - #### subResolutionIFDs

          protected java.util.List<IFDList> subResolutionIFDs

      List of sub-resolution IFDs for each IFD in the current TIFF with the same order as `ifds`.

    - #### tiffParser

          protected transient TiffParser tiffParser

    - #### equalStrips

          protected boolean equalStrips

    - #### use64Bit

          protected boolean use64Bit

    - #### lastPlane

          protected int lastPlane

    - #### noSubresolutions

          protected boolean noSubresolutions

    - #### seriesToIFD

          protected boolean seriesToIFD

    - #### mergeSubIFDs

          protected transient boolean mergeSubIFDs

      Merge SubIFDs into the main IFD list.

    - #### canSeparateSeries

          protected transient boolean canSeparateSeries

      Whether or not IFDs with different dimensions can be split into separate series.

    - #### resolutionLevels

          private java.lang.Integer resolutionLevels

      Number of JPEG 2000 resolution levels.

    - #### j2kCodecOptions

          private JPEG2000CodecOptions j2kCodecOptions

      Codec options to use when decoding JPEG 2000 data.

  - ### Constructor Detail

    - #### MinimalTiffReader

          public MinimalTiffReader()

      Constructs a new MinimalTiffReader.

    - #### MinimalTiffReader

          public MinimalTiffReader(java.lang.String name,
                                   java.lang.String suffix)

      Constructs a new MinimalTiffReader.

    - #### MinimalTiffReader

          public MinimalTiffReader(java.lang.String name,
                                   java.lang.String[] suffixes)

      Constructs a new MinimalTiffReader.

  - ### Method Detail

    - #### getIFDs

          public IFDList getIFDs()

      Gets the list of IFDs associated with the current TIFF's image planes.

    - #### getThumbnailIFDs

          public IFDList getThumbnailIFDs()

      Gets the list of IFDs associated with the current TIFF's thumbnails.

    - #### isThisType

          public boolean isThisType(loci.common.RandomAccessInputStream stream)
                             throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Checks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.
      Specified by:
        `isThisType` in interface `IFormatReader`
      Overrides:
        `isThisType` in class `FormatReader`
      Parameters:
        `stream` - A RandomAccessInputStream representing the file to check. The first byte in the stream is assumed to be the first byte in the file.
      Returns:
        true if the file represented by the stream can be read by this reader; false otherwise.
      Throws:
        `java.io.IOException`

    - #### get8BitLookupTable

          public byte[][] get8BitLookupTable()
                                      throws FormatException,
                                             java.io.IOException

      Description copied from interface: `IFormatReader`
      Gets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if `IFormatReader.isIndexed()` returns false, then this may return null. Also, if `IFormatReader.getPixelType()` returns anything other than `FormatTools.INT8` or `FormatTools.UINT8`, this method will return null.
      Specified by:
        `get8BitLookupTable` in interface `IFormatReader`
      Overrides:
        `get8BitLookupTable` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### get16BitLookupTable

          public short[][] get16BitLookupTable()
                                        throws FormatException,
                                               java.io.IOException

      Description copied from interface: `IFormatReader`
      Gets the 16-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if `IFormatReader.isIndexed()` returns false, then this may return null. Also, if `IFormatReader.getPixelType()` returns anything other than `FormatTools.INT16` or `FormatTools.UINT16`, this method will return null.
      Specified by:
        `get16BitLookupTable` in interface `IFormatReader`
      Overrides:
        `get16BitLookupTable` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getThumbSizeX

          public int getThumbSizeX()

      Description copied from interface: `IFormatReader`
      Get the size of the X dimension for the thumbnail.
      Specified by:
        `getThumbSizeX` in interface `IFormatReader`
      Overrides:
        `getThumbSizeX` in class `FormatReader`

    - #### getThumbSizeY

          public int getThumbSizeY()

      Description copied from interface: `IFormatReader`
      Get the size of the Y dimension for the thumbnail.
      Specified by:
        `getThumbSizeY` in interface `IFormatReader`
      Overrides:
        `getThumbSizeY` in class `FormatReader`

    - #### openThumbBytes

          public byte[] openThumbBytes(int no)
                                throws FormatException,
                                       java.io.IOException

      Description copied from interface: `IFormatReader`
      Obtains a thumbnail for the specified image plane from the current file, as a byte array.
      Specified by:
        `openThumbBytes` in interface `IFormatReader`
      Overrides:
        `openThumbBytes` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### openBytes

          public byte[] openBytes(int no,
                                  byte[] buf,
                                  int x,
                                  int y,
                                  int w,
                                  int h)
                           throws FormatException,
                                  java.io.IOException

      Description copied from interface: `IFormatReader`
      Obtains a sub-image of the specified image plane into a pre-allocated byte array.
      Specified by:
        `openBytes` in interface `IFormatReader`
      Specified by:
        `openBytes` in class `FormatReader`
      Parameters:
        `no` - the plane index within the current series.
        `buf` - a pre-allocated buffer.
        `x` - X coordinate of the upper-left corner of the sub-image
        `y` - Y coordinate of the upper-left corner of the sub-image
        `w` - width of the sub-image
        `h` - height of the sub-image
      Returns:
        the pre-allocated buffer `buf` for convenience.
      Throws:
        `FormatException` - if there was a problem parsing the metadata of the file.
        `java.io.IOException` - if there was a problem reading the file.
      See Also:
        `FormatReader.openBytes(int, byte[], int, int, int, int)`

    - #### reopenFile

          public void reopenFile()
                          throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Reopen any files that were closed, and which are expected to be open while the reader is open. This assumes that `IFormatHandler.setId(java.lang.String)` has been called, but close(false) has not been called.
      Specified by:
        `reopenFile` in interface `IFormatReader`
      Overrides:
        `reopenFile` in class `FormatReader`
      Throws:
        `java.io.IOException`

    - #### close

          public void close(boolean fileOnly)
                     throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Closes the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to calling `Closeable.close()`.
      Specified by:
        `close` in interface `IFormatReader`
      Overrides:
        `close` in class `SubResolutionFormatReader`
      Throws:
        `java.io.IOException`

    - #### getOptimalTileWidth

          public int getOptimalTileWidth()

      Description copied from interface: `IFormatReader`
      Returns the optimal sub-image width for use with openBytes.
      Specified by:
        `getOptimalTileWidth` in interface `IFormatReader`
      Overrides:
        `getOptimalTileWidth` in class `FormatReader`

    - #### getOptimalTileHeight

          public int getOptimalTileHeight()

      Description copied from interface: `IFormatReader`
      Returns the optimal sub-image height for use with openBytes.
      Specified by:
        `getOptimalTileHeight` in interface `IFormatReader`
      Overrides:
        `getOptimalTileHeight` in class `FormatReader`

    - #### initFile

          protected void initFile(java.lang.String id)
                           throws FormatException,
                                  java.io.IOException

      Description copied from class: `SubResolutionFormatReader`
      Initializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.
      Overrides:
        `initFile` in class `SubResolutionFormatReader`
      Throws:
        `FormatException` - if a parsing error occurs processing the file.
        `java.io.IOException` - if an I/O error occurs processing the file

    - #### setResolutionLevel

          protected void setResolutionLevel(IFD ifd)

      Sets the resolution level when we have JPEG 2000 compressed data.
      Parameters:
        `ifd` - The active IFD that is being used in our current `openBytes()` calling context. It will be the sub-resolution IFD if currentSeries > 0.

    - #### initTiffParser

          protected void initTiffParser()

      Reinitialize the underlying TiffParser.

    - #### getTileIndex

          protected int getTileIndex(IFD ifd,
                                     int x,
                                     int y)
                              throws FormatException

      Get the index of the tile corresponding to given IFD (plane) and tile XY indexes.
      Parameters:
        `ifd` - IFD for the requested tile's plane
        `x` - tile X index
        `y` - tile Y index
      Returns:
        corresponding tile index
      Throws:
        `FormatException`

    - #### getCompressedByteCount

          protected long getCompressedByteCount(IFD ifd,
                                                int x,
                                                int y)
                                         throws FormatException,
                                                java.io.IOException

      Throws:
        `FormatException`
        `java.io.IOException`

    - #### copyTile

          protected byte[] copyTile(IFD ifd,
                                    byte[] buf,
                                    int x,
                                    int y)
                             throws FormatException,
                                    java.io.IOException

      Throws:
        `FormatException`
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment