public class FileStitcher extends ReaderWrapper
Modifier and Type | Class and Description |
---|---|
(package private) class |
FileStitcher.ExternalSeries |
Modifier and Type | Field and Description |
---|---|
private ClassList<IFormatReader> |
classList |
private ArrayList<CoreMetadata> |
core
Core metadata.
|
private int |
coreIndex
The number of the current series.
|
private boolean |
doNotChangePattern |
private FileStitcher.ExternalSeries[] |
externals |
private boolean |
group |
private int[][] |
lenC
Component lengths for each axis type.
|
private int[][] |
lenT
Component lengths for each axis type.
|
private int[][] |
lenZ
Component lengths for each axis type.
|
private static org.slf4j.Logger |
LOGGER |
private static int |
MAX_READERS |
private boolean |
noStitch |
private boolean |
patternIds
Whether string ids given should be treated
as file patterns rather than single file paths.
|
private int |
series
The number of the current series (non flat).
|
private int[] |
sizeC
Dimensional axis lengths per file.
|
private int[] |
sizeT
Dimensional axis lengths per file.
|
private int[] |
sizeZ
Dimensional axis lengths per file.
|
private MetadataStore |
store |
reader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
Constructor and Description |
---|
FileStitcher()
Constructs a FileStitcher around a new image reader.
|
FileStitcher(boolean patternIds)
Constructs a FileStitcher around a new image reader.
|
FileStitcher(IFormatReader r)
Constructs a FileStitcher with the given reader.
|
FileStitcher(IFormatReader r,
boolean patternIds)
Constructs a FileStitcher with the given reader.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canChangePattern() |
void |
close() |
void |
close(boolean fileOnly)
Closes the currently open file.
|
protected void |
computeAxisLengths()
Computes axis length arrays, and total axis lengths.
|
protected int[] |
computeIndices(int no)
Gets the file index, and image index into that file,
corresponding to the given global image index.
|
int |
coreIndexToSeries(int index)
Returns the series corresponding to the specified core index.
|
FilePattern |
findPattern(String id) |
String[] |
findPatterns(String id)
Finds the file pattern for the given ID, based on the state of the file
stitcher.
|
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 |
getAdjustedIndex(int no)
Gets the local reader index for use with the given image plane.
|
FileInfo[] |
getAdvancedSeriesUsedFiles(boolean noPixels)
Returns an array of FileInfo objects representing the files needed to
open the current series.
|
FileInfo[] |
getAdvancedUsedFiles(boolean noPixels)
Returns an array of FileInfo objects representing the files needed
to open this dataset.
|
AxisGuesser |
getAxisGuesser()
Gets the axis guesser object used to guess
which dimensional axes are which.
|
int[] |
getAxisTypes()
Gets the axis type for each dimensional block.
|
int |
getBitsPerPixel()
Gets the number of valid bits per pixel.
|
int |
getCoreIndex()
Return the index into CoreMetadata of the current resolution/series.
|
List<CoreMetadata> |
getCoreMetadataList()
Obtains the core metadata values for the current file.
|
String |
getDimensionOrder()
Gets a five-character string representing the
dimension order in which planes will be returned.
|
private int |
getExternalSeries() |
private int |
getExternalSeries(int currentSeries) |
FilePattern |
getFilePattern()
Gets the file pattern object used to build the list of files.
|
int |
getImageCount()
Determines the number of image planes in the current file.
|
int |
getIndex(int z,
int c,
int t)
Gets the rasterized index corresponding
to the given Z, C and T coordinates (real sizes).
|
int |
getIndex(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).
|
MetadataStore |
getMetadataStore()
Retrieves the current metadata store for this reader.
|
Object |
getMetadataStoreRoot()
Retrieves the current metadata store's root object.
|
int |
getPixelType()
Gets the pixel type.
|
IFormatReader |
getReader()
Gets the wrapped reader prototype.
|
IFormatReader |
getReader(int no)
Gets the reader appropriate for use with the given image plane.
|
DimensionSwapper |
getReader(int series,
int no)
Gets the reader that should be used with the given series and image plane.
|
int |
getRequiredDirectories(String[] files)
Returns the number of parent directories that are important when
processing the given list of files.
|
int |
getSeries()
Gets the currently active series.
|
int |
getSeriesCount()
Gets the number of series in this file.
|
Hashtable<String,Object> |
getSeriesMetadata()
Obtains the hashtable containing metadata field/value pairs from the
current series in the current file.
|
String[] |
getSeriesUsedFiles()
Returns an array of filenames needed to open the current series.
|
String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
int |
getSizeC()
Gets the size of the C dimension.
|
int |
getSizeT()
Gets the size of the T dimension.
|
int |
getSizeX()
Gets the size of the X dimension.
|
int |
getSizeY()
Gets the size of the Y dimension.
|
int |
getSizeZ()
Gets the size of the Z dimension.
|
int |
getThumbSizeX()
Get the size of the X dimension for the thumbnail.
|
int |
getThumbSizeY()
Get the size of the Y dimension for the thumbnail.
|
IFormatReader[] |
getUnderlyingReaders()
Retrieves all underlying readers.
|
String[] |
getUsedFiles()
Returns an array of filenames needed to open this dataset.
|
String[] |
getUsedFiles(boolean noPixels)
Returns an array of filenames needed to open this dataset.
|
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.
|
protected void |
initFile(String id)
Initializes the given file or file pattern.
|
protected void |
initReader(int sno,
int fno) |
boolean |
isFalseColor()
Returns false if
IFormatReader.isIndexed() is false, or if IFormatReader.isIndexed()
is true and the lookup table represents "real" color data. |
boolean |
isGroupFiles()
Returns true if we should group files in multi-file formats.
|
boolean |
isIndexed()
Gets whether the image planes are indexed color.
|
boolean |
isInterleaved()
Gets whether or not the channels are interleaved.
|
boolean |
isInterleaved(int subC)
Gets whether or not the given sub-channel is interleaved.
|
boolean |
isLittleEndian()
Gets whether the data is in little-endian format.
|
boolean |
isOrderCertain()
Gets whether the dimension order and sizes are known, or merely guesses.
|
boolean |
isRGB()
Checks if the image planes in the file have more than one channel per
IFormatReader.openBytes(int) call. |
boolean |
isThumbnailSeries()
Gets whether the current series is a lower resolution copy of a different
series.
|
boolean |
isUsingPatternIds()
Gets whether the reader is using file patterns for IDs.
|
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).
|
Object |
openPlane(int no,
int x,
int y,
int w,
int h)
Obtains the specified image plane (or sub-image thereof) in the reader's
native data structure.
|
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.
|
int |
seriesToCoreIndex(int series)
Returns the first core index corresponding to the specified series.
|
void |
setAxisTypes(int[] axes)
Sets the axis type for each dimensional block.
|
void |
setCanChangePattern(boolean doChange) |
void |
setCoreIndex(int no)
Set the current resolution/series (ignores subresolutions).
|
void |
setGroupFiles(boolean group)
Specifies whether or not to force grouping in multi-file formats.
|
void |
setId(String id)
Sets the current file name.
|
void |
setMetadataOptions(MetadataOptions options) |
void |
setMetadataStore(MetadataStore store)
Sets the default metadata store for this reader.
|
void |
setNormalized(boolean normalize)
Specifies whether or not to normalize float data.
|
void |
setOriginalMetadataPopulated(boolean populate)
Specifies whether or not to save proprietary metadata
in the MetadataStore.
|
void |
setReaderClassList(ClassList<IFormatReader> classList)
Set the ClassList object to use when constructing any helper readers.
|
void |
setSeries(int no)
Activates the specified series.
|
void |
setUsingPatternIds(boolean patternIds)
Sets whether the reader is using file patterns for IDs.
|
duplicate, fileGroupOption, getCurrentFile, getDatasetStructureDescription, getDomains, getEffectiveSizeC, getFormat, getGlobalMetadata, getMetadataOptions, getMetadataValue, getModuloC, getModuloT, getModuloZ, getNativeDataType, getOptimalTileHeight, getOptimalTileWidth, getPossibleDomains, getResolution, getResolutionCount, getRGBChannelCount, getSeriesMetadataValue, getSuffixes, getSupportedMetadataLevels, hasCompanionFiles, hasFlattenedResolutions, isMetadataComplete, isMetadataFiltered, isNormalized, isOriginalMetadataPopulated, isSingleFile, isThisType, isThisType, isThisType, isThisType, setFlattenedResolutions, setMetadataFiltered, setResolution, unwrap, unwrap, unwrap
private static final org.slf4j.Logger LOGGER
private static final int MAX_READERS
private boolean patternIds
private boolean doNotChangePattern
private int[] sizeZ
private int[] sizeC
private int[] sizeT
private int[][] lenZ
private int[][] lenC
private int[][] lenT
private ArrayList<CoreMetadata> core
private int coreIndex
private int series
private boolean noStitch
private boolean group
private MetadataStore store
private FileStitcher.ExternalSeries[] externals
private ClassList<IFormatReader> classList
public FileStitcher()
public FileStitcher(boolean patternIds)
patternIds
- Whether string ids given should be treated as file
patterns rather than single file paths.public FileStitcher(IFormatReader r)
r
- The reader to use for reading stitched files.public FileStitcher(IFormatReader r, boolean patternIds)
r
- The reader to use for reading stitched files.patternIds
- Whether string ids given should be treated as file
patterns rather than single file paths.public void setReaderClassList(ClassList<IFormatReader> classList)
public IFormatReader getReader()
getReader
in class ReaderWrapper
public void setUsingPatternIds(boolean patternIds)
public boolean isUsingPatternIds()
public void setCanChangePattern(boolean doChange)
public boolean canChangePattern()
public IFormatReader getReader(int no) throws FormatException, IOException
FormatException
IOException
public DimensionSwapper getReader(int series, int no)
public int getAdjustedIndex(int no) throws FormatException, IOException
FormatException
IOException
public int[] getAxisTypes()
public void setAxisTypes(int[] axes) throws FormatException
axes
- An array containing values from the enumeration:
FormatException
public FilePattern getFilePattern()
public AxisGuesser getAxisGuesser()
public FilePattern findPattern(String id)
public String[] findPatterns(String id)
public int getRequiredDirectories(String[] files) throws FormatException, IOException
IFormatReader
getRequiredDirectories
in interface IFormatReader
getRequiredDirectories
in class ReaderWrapper
FormatException
IOException
public int getImageCount()
IFormatReader
getImageCount
in interface IFormatReader
getImageCount
in class ReaderWrapper
public boolean isRGB()
IFormatReader
IFormatReader.openBytes(int)
call.
This method returns true if and only if IFormatReader.getRGBChannelCount()
returns a value greater than 1.isRGB
in interface IFormatReader
isRGB
in class ReaderWrapper
public int getSizeX()
IFormatReader
getSizeX
in interface IFormatReader
getSizeX
in class ReaderWrapper
public int getSizeY()
IFormatReader
getSizeY
in interface IFormatReader
getSizeY
in class ReaderWrapper
public int getSizeZ()
IFormatReader
getSizeZ
in interface IFormatReader
getSizeZ
in class ReaderWrapper
public int getSizeC()
IFormatReader
getSizeC
in interface IFormatReader
getSizeC
in class ReaderWrapper
public int getSizeT()
IFormatReader
getSizeT
in interface IFormatReader
getSizeT
in class ReaderWrapper
public int getPixelType()
IFormatReader
getPixelType
in interface IFormatReader
getPixelType
in class ReaderWrapper
FormatTools
static pixel types such as FormatTools.INT8
.public int getBitsPerPixel()
IFormatReader
IFormatReader.getPixelType()
.getBitsPerPixel
in interface IFormatReader
getBitsPerPixel
in class ReaderWrapper
public boolean isIndexed()
IFormatReader
IFormatReader.getSizeC()
,
IFormatReader.getEffectiveSizeC()
or IFormatReader.getRGBChannelCount()
.isIndexed
in interface IFormatReader
isIndexed
in class ReaderWrapper
public boolean isFalseColor()
IFormatReader
IFormatReader.isIndexed()
is false, or if IFormatReader.isIndexed()
is true and the lookup table represents "real" color data. Returns true
if IFormatReader.isIndexed()
is true and the lookup table is only present to aid
in visualization.isFalseColor
in interface IFormatReader
isFalseColor
in class ReaderWrapper
public byte[][] get8BitLookupTable() throws FormatException, IOException
IFormatReader
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.get8BitLookupTable
in interface IFormatReader
get8BitLookupTable
in class ReaderWrapper
FormatException
IOException
public short[][] get16BitLookupTable() throws FormatException, IOException
IFormatReader
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.get16BitLookupTable
in interface IFormatReader
get16BitLookupTable
in class ReaderWrapper
FormatException
IOException
public int getThumbSizeX()
IFormatReader
getThumbSizeX
in interface IFormatReader
getThumbSizeX
in class ReaderWrapper
public int getThumbSizeY()
IFormatReader
getThumbSizeY
in interface IFormatReader
getThumbSizeY
in class ReaderWrapper
public boolean isLittleEndian()
IFormatReader
isLittleEndian
in interface IFormatReader
isLittleEndian
in class ReaderWrapper
public String getDimensionOrder()
IFormatReader
IFormatReader.isInterleaved()
method will return true.getDimensionOrder
in interface IFormatReader
getDimensionOrder
in class ReaderWrapper
public boolean isOrderCertain()
IFormatReader
isOrderCertain
in interface IFormatReader
isOrderCertain
in class ReaderWrapper
public boolean isThumbnailSeries()
IFormatReader
isThumbnailSeries
in interface IFormatReader
isThumbnailSeries
in class ReaderWrapper
public boolean isInterleaved()
IFormatReader
IFormatReader.getDimensionOrder()
returns XYCTZ or XYCZT,
and this method returns true.
Note that this flag returns whether or not the data returned by
IFormatReader.openBytes(int)
is interleaved. In most cases, this will
match the interleaving in the original file, but for some formats (e.g.
TIFF) channel re-ordering is done internally and the return value of
this method will not match what is in the original file.isInterleaved
in interface IFormatReader
isInterleaved
in class ReaderWrapper
public boolean isInterleaved(int subC)
IFormatReader
SDTReader
handles spectral-lifetime data with
interleaved lifetime bins and non-interleaved spectral channels.isInterleaved
in interface IFormatReader
isInterleaved
in class ReaderWrapper
public byte[] openBytes(int no) throws FormatException, IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
FormatException
IOException
IFormatReader.openBytes(int, byte[])
public byte[] openBytes(int no, byte[] buf) throws FormatException, IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
no
- the image index within the file.buf
- a pre-allocated buffer.buf
for convenience.FormatException
- if there was a problem parsing the metadata of the
file.IOException
- if there was a problem reading the file.public byte[] openBytes(int no, int x, int y, int w, int h) throws FormatException, IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
FormatException
IOException
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
no
- the image index within the file.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-imagebuf
for convenience.FormatException
- if there was a problem parsing the metadata of the
file.IOException
- if there was a problem reading the file.public Object openPlane(int no, int x, int y, int w, int h) throws FormatException, IOException
IFormatReader
BufferedImage
. The openPlane method exists to
maintain generality and efficiency while avoiding pollution of the API
with AWT-specific logic.openPlane
in interface IFormatReader
openPlane
in class ReaderWrapper
FormatException
IOException
FormatReader
,
BufferedImageReader
public byte[] openThumbBytes(int no) throws FormatException, IOException
IFormatReader
openThumbBytes
in interface IFormatReader
openThumbBytes
in class ReaderWrapper
FormatException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class ReaderWrapper
IOException
public void close(boolean fileOnly) throws IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class ReaderWrapper
IOException
public int getSeriesCount()
IFormatReader
getSeriesCount
in interface IFormatReader
getSeriesCount
in class ReaderWrapper
public void setSeries(int no)
IFormatReader
setSeries
in interface IFormatReader
setSeries
in class ReaderWrapper
public int getSeries()
IFormatReader
getSeries
in interface IFormatReader
getSeries
in class ReaderWrapper
public int seriesToCoreIndex(int series)
IFormatReader
seriesToCoreIndex
in interface IFormatReader
seriesToCoreIndex
in class ReaderWrapper
public int coreIndexToSeries(int index)
IFormatReader
coreIndexToSeries
in interface IFormatReader
coreIndexToSeries
in class ReaderWrapper
public void setCoreIndex(int no)
IFormatReader
setCoreIndex
in interface IFormatReader
setCoreIndex
in class ReaderWrapper
public int getCoreIndex()
IFormatReader
getCoreIndex
in interface IFormatReader
getCoreIndex
in class ReaderWrapper
public void setGroupFiles(boolean group)
IFormatReader
setGroupFiles
in interface IFormatReader
setGroupFiles
in class ReaderWrapper
public boolean isGroupFiles()
IFormatReader
isGroupFiles
in interface IFormatReader
isGroupFiles
in class ReaderWrapper
public void setMetadataOptions(MetadataOptions options)
setMetadataOptions
in interface IMetadataConfigurable
setMetadataOptions
in class ReaderWrapper
public void setNormalized(boolean normalize)
IFormatReader
setNormalized
in interface IFormatReader
setNormalized
in class ReaderWrapper
public void setOriginalMetadataPopulated(boolean populate)
IFormatReader
setOriginalMetadataPopulated
in interface IFormatReader
setOriginalMetadataPopulated
in class ReaderWrapper
public String[] getUsedFiles()
IFormatReader
getUsedFiles
in interface IFormatReader
getUsedFiles
in class ReaderWrapper
public String[] getUsedFiles(boolean noPixels)
IFormatReader
getUsedFiles
in interface IFormatReader
getUsedFiles
in class ReaderWrapper
public String[] getSeriesUsedFiles()
IFormatReader
getSeriesUsedFiles
in interface IFormatReader
getSeriesUsedFiles
in class ReaderWrapper
public String[] getSeriesUsedFiles(boolean noPixels)
IFormatReader
getSeriesUsedFiles
in interface IFormatReader
getSeriesUsedFiles
in class ReaderWrapper
public FileInfo[] getAdvancedUsedFiles(boolean noPixels)
IFormatReader
getAdvancedUsedFiles
in interface IFormatReader
getAdvancedUsedFiles
in class ReaderWrapper
public FileInfo[] getAdvancedSeriesUsedFiles(boolean noPixels)
IFormatReader
getAdvancedSeriesUsedFiles
in interface IFormatReader
getAdvancedSeriesUsedFiles
in class ReaderWrapper
public int getIndex(int z, int c, int t)
IFormatReader
getIndex
in interface IFormatReader
getIndex
in class ReaderWrapper
public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT)
IFormatReader
getIndex
in interface IFormatReader
getIndex
in class ReaderWrapper
public int[] getZCTCoords(int index)
IFormatReader
getZCTCoords
in interface IFormatReader
getZCTCoords
in class ReaderWrapper
public int[] getZCTModuloCoords(int index)
IFormatReader
getZCTModuloCoords
in interface IFormatReader
getZCTModuloCoords
in class ReaderWrapper
public Hashtable<String,Object> getSeriesMetadata()
IFormatReader
getSeriesMetadata
in interface IFormatReader
getSeriesMetadata
in class ReaderWrapper
public List<CoreMetadata> getCoreMetadataList()
IFormatReader
getCoreMetadataList
in interface IFormatReader
getCoreMetadataList
in class ReaderWrapper
public void setMetadataStore(MetadataStore store)
IFormatReader
setMetadataStore
in interface IFormatReader
setMetadataStore
in class ReaderWrapper
store
- a metadata store implementation.public MetadataStore getMetadataStore()
IFormatReader
null
metadata store.getMetadataStore
in interface IFormatReader
getMetadataStore
in class ReaderWrapper
public Object getMetadataStoreRoot()
IFormatReader
getMetadataStoreRoot
in interface IFormatReader
getMetadataStoreRoot
in class ReaderWrapper
public IFormatReader[] getUnderlyingReaders()
IFormatReader
getUnderlyingReaders
in interface IFormatReader
getUnderlyingReaders
in class ReaderWrapper
public void reopenFile() throws IOException
IFormatReader
IFormatHandler.setId(java.lang.String)
has been
called, but close(false) has not been called.reopenFile
in interface IFormatReader
reopenFile
in class ReaderWrapper
IOException
public void setId(String id) throws FormatException, IOException
IFormatHandler
setId
in interface IFormatHandler
setId
in class ReaderWrapper
FormatException
IOException
protected void initFile(String id) throws FormatException, IOException
FormatException
IOException
private int getExternalSeries()
private int getExternalSeries(int currentSeries)
protected void computeAxisLengths() throws FormatException
FormatException
protected int[] computeIndices(int no) throws FormatException, IOException
FormatException
IOException
protected void initReader(int sno, int fno)
Copyright © 2017 Open Microscopy Environment