loci.formats

## Class ChannelFiller

- java.lang.Object
- - loci.formats.ReaderWrapper
  - - loci.formats.ChannelFiller

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

      public class ChannelFiller
      extends ReaderWrapper

  For indexed color data representing true color, factors out the indices, replacing them with the color table values directly. For all other data (either non-indexed, or indexed with "false color" tables), does nothing.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Boolean` | `filled` Whether to fill in the indices.
    `protected int` | `lutLength` Number of LUT components.

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

      `reader`

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

      `CAN_GROUP, CANNOT_GROUP, MUST_GROUP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChannelFiller()` Constructs a ChannelFiller around a new image reader.
    `ChannelFiller(IFormatReader r)` Constructs a ChannelFiller with a given reader.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `int` | `getBitsPerPixel()` Gets the number of valid bits per pixel.
    `private int` | `getLookupTableComponentCount()` Gets the number of color components in the lookup table.
    `java.lang.Class<?>` | `getNativeDataType()` Returns the native data type of image planes for this reader, as returned by `IFormatReader.openPlane(int, int, int, int, int)` or `IFormatWriter.savePlane(int, java.lang.Object)`.
    `int` | `getSizeC()` Gets the size of the C dimension.
    `Codec` | `getTileCodec(int no)` Retrieve a codec that can be used to decompress compressed tiles.
    `CodecOptions` | `getTileCodecOptions(int no, int x, int y)` Retrieve codec options that can be used to decompressed the specified tile.
    `boolean` | `isFilled()` Returns true if the indices are being factored out.
    `boolean` | `isIndexed()` Gets whether the image planes are indexed color.
    `boolean` | `isRGB()` Checks if the image planes in the file have more than one channel per `IFormatReader.openBytes(int)` call.
    `static ChannelFiller` | `makeChannelFiller(IFormatReader r)` Converts the given reader into a ChannelFiller, wrapping if needed.
    `byte[]` | `openBytes(int no)` Obtains the specified image plane from the current file as a byte array.
    `byte[]` | `openBytes(int no, byte[] buf)` Obtains the specified image plane from the current file into a pre-allocated byte array of (sizeX * sizeY * bytesPerPixel * RGB channel count).
    `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[]` | `openBytes(int no, int x, int y, int w, int h)` Obtains a sub-image of the specified image plane, whose upper-left corner is given by (x, y).
    `byte[]` | `openCompressedBytes(int no, byte[] buf, int x, int y)` Retrieve the specified tile without performing any decompression.
    `byte[]` | `openCompressedBytes(int no, int x, int y)` Retrieve the specified tile without performing any decompression.
    `void` | `setFilled(boolean filled)` Toggles whether the indices should be factored out.
    `void` | `setId(java.lang.String id)` Sets the current file name.

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

      `close, close, coreIndexToSeries, duplicate, fileGroupOption, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getCoreIndex, getCoreMetadataList, getCurrentFile, getDatasetStructureDescription, getDimensionOrder, getDomains, getEffectiveSizeC, getFillColor, getFormat, getGlobalMetadata, getImageCount, getIndex, getIndex, getMetadataOptions, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getModuloC, getModuloT, getModuloZ, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPossibleDomains, getReader, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getSeries, getSeriesCount, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeT, getSizeX, getSizeY, getSizeZ, getSuffixes, getSupportedMetadataLevels, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isSingleFile, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, openPlane, openThumbBytes, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setMetadataFiltered, setMetadataOptions, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, unwrap, unwrap, unwrap`

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

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

- - ### Field Detail

    - #### filled

          protected java.lang.Boolean filled

      Whether to fill in the indices. By default, indices are filled iff data not false color.

    - #### lutLength

          protected int lutLength

      Number of LUT components.

  - ### Constructor Detail

    - #### ChannelFiller

          public ChannelFiller()

      Constructs a ChannelFiller around a new image reader.

    - #### ChannelFiller

          public ChannelFiller(IFormatReader r)

      Constructs a ChannelFiller with a given reader.

  - ### Method Detail

    - #### makeChannelFiller

          public static ChannelFiller makeChannelFiller(IFormatReader r)

      Converts the given reader into a ChannelFiller, wrapping if needed.

    - #### isFilled

          public boolean isFilled()

      Returns true if the indices are being factored out.

    - #### setFilled

          public void setFilled(boolean filled)

      Toggles whether the indices should be factored out.

    - #### getSizeC

          public int getSizeC()

      Description copied from interface: `IFormatReader`
      Gets the size of the C dimension.
      Specified by:
        `getSizeC` in interface `IFormatReader`
      Overrides:
        `getSizeC` in class `ReaderWrapper`

    - #### isRGB

          public boolean isRGB()

      Description copied from interface: `IFormatReader`
      Checks if the image planes in the file have more than one channel per `IFormatReader.openBytes(int)` call. This method returns true if and only if `IFormatReader.getRGBChannelCount()` returns a value greater than 1.
      Specified by:
        `isRGB` in interface `IFormatReader`
      Overrides:
        `isRGB` in class `ReaderWrapper`

    - #### isIndexed

          public boolean isIndexed()

      Description copied from interface: `IFormatReader`
      Gets whether the image planes are indexed color. This value has no impact on `IFormatReader.getSizeC()`, `IFormatReader.getEffectiveSizeC()` or `IFormatReader.getRGBChannelCount()`.
      Specified by:
        `isIndexed` in interface `IFormatReader`
      Overrides:
        `isIndexed` in class `ReaderWrapper`

    - #### getBitsPerPixel

          public int getBitsPerPixel()

      Description copied from interface: `IFormatReader`
      Gets the number of valid bits per pixel. The number of valid bits per pixel is always less than or equal to the number of bits per pixel that correspond to `IFormatReader.getPixelType()`.
      Specified by:
        `getBitsPerPixel` in interface `IFormatReader`
      Overrides:
        `getBitsPerPixel` in class `ReaderWrapper`

    - #### 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 `ReaderWrapper`
      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 `ReaderWrapper`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### openBytes

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

      Description copied from interface: `IFormatReader`
      Obtains the specified image plane from the current file as a byte array.
      Specified by:
        `openBytes` in interface `IFormatReader`
      Overrides:
        `openBytes` in class `ReaderWrapper`
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `IFormatReader.openBytes(int, byte[])`

    - #### openBytes

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

      Description copied from interface: `IFormatReader`
      Obtains the specified image plane from the current file into a pre-allocated byte array of (sizeX * sizeY * bytesPerPixel * RGB channel count).
      Specified by:
        `openBytes` in interface `IFormatReader`
      Overrides:
        `openBytes` in class `ReaderWrapper`
      Parameters:
        `no` - the plane index within the current series.
        `buf` - a pre-allocated buffer.
      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.

    - #### openBytes

          public byte[] openBytes(int no,
                                  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, whose upper-left corner is given by (x, y).
      Specified by:
        `openBytes` in interface `IFormatReader`
      Overrides:
        `openBytes` in class `ReaderWrapper`
      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`
      Overrides:
        `openBytes` in class `ReaderWrapper`
      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.

    - #### openCompressedBytes

          public byte[] openCompressedBytes(int no,
                                            int x,
                                            int y)
                                     throws FormatException,
                                            java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve the specified tile without performing any decompression.
      Specified by:
        `openCompressedBytes` in interface `ICompressedTileReader`
      Overrides:
        `openCompressedBytes` in class `ReaderWrapper`
      Parameters:
        `no` - plane index
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        compressed tile bytes
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### openCompressedBytes

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

      Description copied from interface: `ICompressedTileReader`
      Retrieve the specified tile without performing any decompression.
      Specified by:
        `openCompressedBytes` in interface `ICompressedTileReader`
      Overrides:
        `openCompressedBytes` in class `ReaderWrapper`
      Parameters:
        `no` - plane index
        `buf` - pre-allocated buffer in which to store compressed bytes
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        compressed tile bytes
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getTileCodec

          public Codec getTileCodec(int no)
                             throws FormatException,
                                    java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve a codec that can be used to decompress compressed tiles.
      Specified by:
        `getTileCodec` in interface `ICompressedTileReader`
      Overrides:
        `getTileCodec` in class `ReaderWrapper`
      Parameters:
        `no` - plane index
      Returns:
        codec that can be used for compressed tiles in the specified plane
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `ICompressedTileReader.openCompressedBytes(int, int, int)`

    - #### getTileCodecOptions

          public CodecOptions getTileCodecOptions(int no,
                                                  int x,
                                                  int y)
                                           throws FormatException,
                                                  java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve codec options that can be used to decompressed the specified tile.
      Specified by:
        `getTileCodecOptions` in interface `ICompressedTileReader`
      Overrides:
        `getTileCodecOptions` in class `ReaderWrapper`
      Parameters:
        `no` - plane index
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        codec options
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `ICompressedTileReader.getTileCodec(int)`

    - #### getNativeDataType

          public java.lang.Class<?> getNativeDataType()

      Description copied from interface: `IFormatHandler`
      Returns the native data type of image planes for this reader, as returned by `IFormatReader.openPlane(int, int, int, int, int)` or `IFormatWriter.savePlane(int, java.lang.Object)`. For most readers this type will be a byte array; however, some readers call external APIs that work with other types such as `BufferedImage`.
      Specified by:
        `getNativeDataType` in interface `IFormatHandler`
      Overrides:
        `getNativeDataType` in class `ReaderWrapper`

    - #### setId

          public void setId(java.lang.String id)
                     throws FormatException,
                            java.io.IOException

      Description copied from interface: `IFormatHandler`
      Sets the current file name.
      Specified by:
        `setId` in interface `IFormatHandler`
      Overrides:
        `setId` in class `ReaderWrapper`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getLookupTableComponentCount

          private int getLookupTableComponentCount()
                                            throws FormatException,
                                                   java.io.IOException

      Gets the number of color components in the lookup table.
      Throws:
        `FormatException`
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment