Package loci.formats
Class ChannelFiller
java.lang.Object
loci.formats.ReaderWrapper
loci.formats.ChannelFiller
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
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
FieldsModifier and TypeFieldDescriptionprotected BooleanWhether to fill in the indices.protected intNumber of LUT components.Fields inherited from class loci.formats.ReaderWrapper
readerFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ChannelFiller around a new image reader.Constructs a ChannelFiller with a given reader. -
Method Summary
Modifier and TypeMethodDescriptionshort[][]Gets the 16-bit color lookup table associated with the most recently opened image.byte[][]Gets the 8-bit color lookup table associated with the most recently opened image.intGets the number of valid bits per pixel.private intGets the number of color components in the lookup table.Class<?> Returns the native data type of image planes for this reader, as returned byIFormatReader.openPlane(int, int, int, int, int)orIFormatWriter.savePlane(int, java.lang.Object).intgetSizeC()Gets the size of the C dimension.getTileCodec(int no) Retrieve a codec that can be used to decompress compressed tiles.getTileCodecOptions(int no, int x, int y) Retrieve codec options that can be used to decompressed the specified tile.booleanisFilled()Returns true if the indices are being factored out.booleanGets whether the image planes are indexed color.booleanisRGB()Checks if the image planes in the file have more than one channel perIFormatReader.openBytes(int)call.static ChannelFillerConverts 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.voidsetFilled(boolean filled) Toggles whether the indices should be factored out.voidSets 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
-
Field Details
-
filled
Whether to fill in the indices. By default, indices are filled iff data not false color. -
lutLength
protected int lutLengthNumber of LUT components.
-
-
Constructor Details
-
ChannelFiller
public ChannelFiller()Constructs a ChannelFiller around a new image reader. -
ChannelFiller
Constructs a ChannelFiller with a given reader.
-
-
Method Details
-
makeChannelFiller
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:IFormatReaderGets the size of the C dimension.- Specified by:
getSizeCin interfaceIFormatReader- Overrides:
getSizeCin classReaderWrapper
-
isRGB
public boolean isRGB()Description copied from interface:IFormatReaderChecks if the image planes in the file have more than one channel perIFormatReader.openBytes(int)call. This method returns true if and only ifIFormatReader.getRGBChannelCount()returns a value greater than 1.- Specified by:
isRGBin interfaceIFormatReader- Overrides:
isRGBin classReaderWrapper
-
isIndexed
public boolean isIndexed()Description copied from interface:IFormatReaderGets whether the image planes are indexed color. This value has no impact onIFormatReader.getSizeC(),IFormatReader.getEffectiveSizeC()orIFormatReader.getRGBChannelCount().- Specified by:
isIndexedin interfaceIFormatReader- Overrides:
isIndexedin classReaderWrapper
-
getBitsPerPixel
public int getBitsPerPixel()Description copied from interface:IFormatReaderGets 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 toIFormatReader.getPixelType().- Specified by:
getBitsPerPixelin interfaceIFormatReader- Overrides:
getBitsPerPixelin classReaderWrapper
-
get8BitLookupTable
Description copied from interface:IFormatReaderGets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or ifIFormatReader.isIndexed()returns false, then this may return null. Also, ifIFormatReader.getPixelType()returns anything other thanFormatTools.INT8orFormatTools.UINT8, this method will return null.- Specified by:
get8BitLookupTablein interfaceIFormatReader- Overrides:
get8BitLookupTablein classReaderWrapper- Throws:
FormatExceptionIOException
-
get16BitLookupTable
Description copied from interface:IFormatReaderGets the 16-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or ifIFormatReader.isIndexed()returns false, then this may return null. Also, ifIFormatReader.getPixelType()returns anything other thanFormatTools.INT16orFormatTools.UINT16, this method will return null.- Specified by:
get16BitLookupTablein interfaceIFormatReader- Overrides:
get16BitLookupTablein classReaderWrapper- Throws:
FormatExceptionIOException
-
openBytes
Description copied from interface:IFormatReaderObtains the specified image plane from the current file as a byte array.- Specified by:
openBytesin interfaceIFormatReader- Overrides:
openBytesin classReaderWrapper- Throws:
FormatExceptionIOException- See Also:
-
openBytes
Description copied from interface:IFormatReaderObtains the specified image plane from the current file into a pre-allocated byte array of (sizeX * sizeY * bytesPerPixel * RGB channel count).- Specified by:
openBytesin interfaceIFormatReader- Overrides:
openBytesin classReaderWrapper- Parameters:
no- the plane index within the current series.buf- a pre-allocated buffer.- Returns:
- the pre-allocated buffer
buffor convenience. - Throws:
FormatException- if there was a problem parsing the metadata of the file.IOException- if there was a problem reading the file.
-
openBytes
Description copied from interface:IFormatReaderObtains a sub-image of the specified image plane, whose upper-left corner is given by (x, y).- Specified by:
openBytesin interfaceIFormatReader- Overrides:
openBytesin classReaderWrapper- Throws:
FormatExceptionIOException
-
openBytes
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException Description copied from interface:IFormatReaderObtains a sub-image of the specified image plane into a pre-allocated byte array.- Specified by:
openBytesin interfaceIFormatReader- Overrides:
openBytesin classReaderWrapper- 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-imagey- Y coordinate of the upper-left corner of the sub-imagew- width of the sub-imageh- height of the sub-image- Returns:
- the pre-allocated buffer
buffor convenience. - Throws:
FormatException- if there was a problem parsing the metadata of the file.IOException- if there was a problem reading the file.
-
openCompressedBytes
Description copied from interface:ICompressedTileReaderRetrieve the specified tile without performing any decompression.- Specified by:
openCompressedBytesin interfaceICompressedTileReader- Overrides:
openCompressedBytesin classReaderWrapper- Parameters:
no- plane indexx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- compressed tile bytes
- Throws:
FormatExceptionIOException
-
openCompressedBytes
public byte[] openCompressedBytes(int no, byte[] buf, int x, int y) throws FormatException, IOException Description copied from interface:ICompressedTileReaderRetrieve the specified tile without performing any decompression.- Specified by:
openCompressedBytesin interfaceICompressedTileReader- Overrides:
openCompressedBytesin classReaderWrapper- Parameters:
no- plane indexbuf- pre-allocated buffer in which to store compressed bytesx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- compressed tile bytes
- Throws:
FormatExceptionIOException
-
getTileCodec
Description copied from interface:ICompressedTileReaderRetrieve a codec that can be used to decompress compressed tiles.- Specified by:
getTileCodecin interfaceICompressedTileReader- Overrides:
getTileCodecin classReaderWrapper- Parameters:
no- plane index- Returns:
- codec that can be used for compressed tiles in the specified plane
- Throws:
FormatExceptionIOException- See Also:
-
getTileCodecOptions
Description copied from interface:ICompressedTileReaderRetrieve codec options that can be used to decompressed the specified tile.- Specified by:
getTileCodecOptionsin interfaceICompressedTileReader- Overrides:
getTileCodecOptionsin classReaderWrapper- Parameters:
no- plane indexx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- codec options
- Throws:
FormatExceptionIOException- See Also:
-
getNativeDataType
Description copied from interface:IFormatHandlerReturns the native data type of image planes for this reader, as returned byIFormatReader.openPlane(int, int, int, int, int)orIFormatWriter.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 asBufferedImage.- Specified by:
getNativeDataTypein interfaceIFormatHandler- Overrides:
getNativeDataTypein classReaderWrapper
-
setId
Description copied from interface:IFormatHandlerSets the current file name.- Specified by:
setIdin interfaceIFormatHandler- Overrides:
setIdin classReaderWrapper- Throws:
FormatExceptionIOException
-
getLookupTableComponentCount
Gets the number of color components in the lookup table.- Throws:
FormatExceptionIOException
-