Package loci.formats
Class ChannelSeparator
java.lang.Object
loci.formats.ReaderWrapper
loci.formats.ChannelSeparator
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
Logic to automatically separate the channels in a file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]Last image opened.private intHeight of last image opened.private intIndex of last image opened.private intSeries of last image opened.private intWidth of last image opened.private intX index of last image opened.private intY index of last image opened.Fields inherited from class loci.formats.ReaderWrapper
readerFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ChannelSeparator around a new image reader.Constructs a ChannelSeparator with the given reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) Closes the currently open file.Gets a five-character string representing the dimension order in which planes will be returned.intDetermines the number of image planes in the current file.intgetIndex(int z, int c, int t) Gets the rasterized index corresponding to the given Z, C and T coordinates (real sizes).intgetIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) Gets the rasterized index corresponding to the given Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes).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).intgetOriginalIndex(int no) Returns the image number in the original dataset that corresponds to the given image number.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.int[]getZCTCoords(int index) Gets the Z, C and T coordinates (real sizes) corresponding to the given rasterized index value.int[]getZCTModuloCoords(int index) Gets the Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes) corresponding to the given rasterized index value.booleanisRGB()Checks if the image planes in the file have more than one channel perIFormatReader.openBytes(int)call.static ChannelSeparatorConverts the given reader into a ChannelSeparator, 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.byte[]openThumbBytes(int no) Obtains a thumbnail for the specified image plane from the current file, as a byte array.voidSets the current file name.Methods inherited from class loci.formats.ReaderWrapper
close, coreIndexToSeries, duplicate, fileGroupOption, get16BitLookupTable, get8BitLookupTable, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getBitsPerPixel, getCoreIndex, getCoreMetadataList, getCurrentFile, getDatasetStructureDescription, getDomains, getEffectiveSizeC, getFillColor, getFormat, getGlobalMetadata, getMetadataOptions, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getModuloC, getModuloT, getModuloZ, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPossibleDomains, getReader, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getSeries, getSeriesCount, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getSuffixes, getSupportedMetadataLevels, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isSingleFile, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, openPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setMetadataFiltered, setMetadataOptions, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, unwrap, unwrap, unwrap
-
Field Details
-
lastImage
private byte[] lastImageLast image opened. -
lastImageIndex
private int lastImageIndexIndex of last image opened. -
lastImageSeries
private int lastImageSeriesSeries of last image opened. -
lastImageX
private int lastImageXX index of last image opened. -
lastImageY
private int lastImageYY index of last image opened. -
lastImageWidth
private int lastImageWidthWidth of last image opened. -
lastImageHeight
private int lastImageHeightHeight of last image opened.
-
-
Constructor Details
-
ChannelSeparator
public ChannelSeparator()Constructs a ChannelSeparator around a new image reader. -
ChannelSeparator
Constructs a ChannelSeparator with the given reader.
-
-
Method Details
-
makeChannelSeparator
Converts the given reader into a ChannelSeparator, wrapping if needed. -
getOriginalIndex
public int getOriginalIndex(int no) Returns the image number in the original dataset that corresponds to the given image number. For instance, if the original dataset was a single RGB image and the given image number is 2, the return value will be 0.- Parameters:
no- is an image number greater than or equal to 0 and less than getImageCount()- Returns:
- the corresponding image number in the original (unseparated) data.
-
getImageCount
public int getImageCount()Description copied from interface:IFormatReaderDetermines the number of image planes in the current file.- Specified by:
getImageCountin interfaceIFormatReader- Overrides:
getImageCountin classReaderWrapper
-
getDimensionOrder
Description copied from interface:IFormatReaderGets a five-character string representing the dimension order in which planes will be returned. Valid orders are:- XYCTZ
- XYCZT
- XYTCZ
- XYTZC
- XYZCT
- XYZTC
IFormatReader.isInterleaved()method will return true.- Specified by:
getDimensionOrderin interfaceIFormatReader- Overrides:
getDimensionOrderin 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
-
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.
-
openThumbBytes
Description copied from interface:IFormatReaderObtains a thumbnail for the specified image plane from the current file, as a byte array.- Specified by:
openThumbBytesin interfaceIFormatReader- Overrides:
openThumbBytesin classReaderWrapper- Throws:
FormatExceptionIOException
-
close
Description copied from interface:IFormatReaderCloses the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to callingCloseable.close().- Specified by:
closein interfaceIFormatReader- Overrides:
closein classReaderWrapper- Throws:
IOException
-
getIndex
public int getIndex(int z, int c, int t) Description copied from interface:IFormatReaderGets the rasterized index corresponding to the given Z, C and T coordinates (real sizes).- Specified by:
getIndexin interfaceIFormatReader- Overrides:
getIndexin classReaderWrapper
-
getIndex
public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) Description copied from interface:IFormatReaderGets the rasterized index corresponding to the given Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes). Note that the Z, C and T coordinates take the modulo dimension sizes into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.- Specified by:
getIndexin interfaceIFormatReader- Overrides:
getIndexin classReaderWrapper
-
getZCTCoords
public int[] getZCTCoords(int index) Description copied from interface:IFormatReaderGets the Z, C and T coordinates (real sizes) corresponding to the given rasterized index value.- Specified by:
getZCTCoordsin interfaceIFormatReader- Overrides:
getZCTCoordsin classReaderWrapper
-
getZCTModuloCoords
public int[] getZCTModuloCoords(int index) Description copied from interface:IFormatReaderGets the Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes) corresponding to the given rasterized index value. Note that the Z, C and T coordinates are not the same as those returned by getZCTCoords(int) because the size of the modulo dimensions is taken into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.- Specified by:
getZCTModuloCoordsin interfaceIFormatReader- Overrides:
getZCTModuloCoordsin classReaderWrapper
-
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
-