Class FakeReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
Examples:
- showinf 'multi-series&series=11&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake' -series 9
- showinf '8bit-signed&pixelType=int8&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '8bit-unsigned&pixelType=uint8&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '16bit-signed&pixelType=int16&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '16bit-unsigned&pixelType=uint16&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '32bit-signed&pixelType=int32&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '32bit-unsigned&pixelType=uint32&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '32bit-floating&pixelType=float&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf '64bit-floating&pixelType=double&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
- showinf 'SPW&plates=2&plateRows=3&plateCols=3&fields=8&plateAcqs=5.fake'
- showinf 'SPW&screens=2&plates=1&plateRows=3&plateCols=3&fields=1&plateAcqs=1.fake'
- showinf 'Plate&screens=0&plates=1&plateRows=3&plateCols=3&fields=8&plateAcqs=5.fake'
- showinf 'regions&points=10&ellipses=5&rectangles=10.fake'
- showinf 'pyramid&sizeX=10000&sizeY=10000&resolutions=5&resolutionScale=2.fake' -noflat -resolution 4
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intChannel of last opened image plane.private static final booleanprivate static final Stringprivate static final Doubleprivate static final longprivate static final Stringprivate static final Stringprivate static final ome.xml.model.primitives.Timestampprivate static final Stringprivate static final Stringprivate intprivate intprivate intprivate intprivate intprivate static final Stringprivate static final Stringprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intprivate intprivate ArrayList<ome.units.quantity.Length> private ArrayList<ome.units.quantity.Length> private ome.units.quantity.Timeexposure time per plane infoList of used files if the fake is a SPW structureprivate intprivate int[][]For indexed color, mapping from indices to values and vice versa.private StringProperties companion file which can be associated with this fake fileprivate booleanprivate intprivate intprivate short[][][]16-bit lookup table, if indexed color, one per channel.private byte[][][]8-bit lookup table, if indexed color, one per channel.private intprivate OMEXMLMetadataprivate OMEXMLServiceprivate ome.units.quantity.Lengthprivate ome.units.quantity.Lengthprivate ome.units.quantity.Lengthprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate static final Stringprivate static final intprivate intprivate doubleScale factor for gradient, if any.private intprivate static final longprivate static final Stringprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate static final Stringprivate int[][]For indexed color, mapping from indices to values and vice versa.Fields inherited from class loci.formats.FormatReader
core, coreIndex, datasetDescription, domains, fillColor, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSIONFields inherited from class loci.formats.FormatHandler
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixesFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) Closes the currently open file.private voidcreateIndexMap(int num) Creates a mapping between indices and color values.private String[]private voidfillAcquisitionDate(MetadataStore store, String date, int imageIndex) private voidfillAnnotations(MetadataStore store, int imageIndex) private voidprivate voidfillExposureTime(MetadataStore store) private voidfillInstrumentRefs(MetadataStore store) private voidfillPhysicalSizes(MetadataStore store) private voidfillRegions(MetadataStore store, int imageIndex) private voidshort[][]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.private StringgetPoints(int i) String[]getSeriesUsedFiles(boolean noPixels) Returns an array of filenames needed to open the current series.private DoublegetX(int i) private DoublegetY(int i) protected voidInitializes the given file (parsing header information, etc.).booleanisSingleFile(String id) Returns true if the named file is expected to be the only file in the dataset.private booleanisSPWStructure(String path) booleanisThisType(String name, boolean open) Checks if a file matches the type of this format reader.listFakeSeries(String traversedDirectory) Traverses a fake file folder structure indicated by traversedDirectorybyte[]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.private intparseColor(String value) private ome.units.quantity.LengthparsePhysicalSize(String s, String defaultUnit) private ome.units.quantity.LengthparsePosition(String axis, int s, int index, loci.common.IniTable table) private voidparseSeriesTable(loci.common.IniTable table, MetadataStore store, int newSeries) Translate key/value pairs from the INI table for the specified series.private ome.units.quantity.LengthparseWavelength(String s, String defaultUnit) private voidpopulateInstrument(MetadataStore store) private intpopulateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam) static int[]readSpecialPixels(byte[] plane) Read byte-encoded metadata from the given plane.static int[]readSpecialPixels(byte[] plane, int pixelType, boolean little) Read byte-encoded metadata from the given plane.static int[]readSpecialPixels(byte[] plane, int pixelType, boolean little, int rgb, boolean interleaved) Read byte-encoded metadata from the given plane.voidReopen any files that were closed, and which are expected to be open while the reader is open.private static voidshuffle(int c, int[] array) Fisher-Yates shuffle with constant seeds to ensure reproducibility.(package private) static voidprivate int[]toSPWCoordinates(int seriesIndex) Convert the given series (Image) index to a WellSample, Well, and Plate index.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, coreIndexToSeries, fileGroupOption, flattenHashtables, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, 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, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPixelType, getPossibleDomains, getPulse, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getRotationTransform, getSeries, getSeriesCount, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataListsMethods inherited from class loci.formats.FormatHandler
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface loci.formats.ICompressedTileReader
getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytesMethods inherited from interface loci.formats.IFormatHandler
getFormat, getNativeDataType, getSuffixesMethods inherited from interface loci.formats.IMetadataConfigurable
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
-
Field Details
-
ANN_LONG_VALUE
private static final long ANN_LONG_VALUE- See Also:
-
ANN_DOUBLE_VALUE
-
ANNOTATION_PREFIX
- See Also:
-
ANNOTATION_NAMESPACE
- See Also:
-
ANN_TERM_VALUE
- See Also:
-
ANN_TAG_VALUE
- See Also:
-
ANN_TIME_VALUE
private static final ome.xml.model.primitives.Timestamp ANN_TIME_VALUE -
ANN_BOOLEAN_VALUE
private static final boolean ANN_BOOLEAN_VALUE- See Also:
-
ANN_COMMENT_VALUE
- See Also:
-
ANN_XML_VALUE_START
- See Also:
-
ANN_XML_VALUE_END
- See Also:
-
ROI_PREFIX
- See Also:
-
SHAPE_PREFIX
- See Also:
-
BOX_SIZE
public static final int BOX_SIZE- See Also:
-
ROI_SPACING
private static final int ROI_SPACING- See Also:
-
DEFAULT_SIZE_X
public static final int DEFAULT_SIZE_X- See Also:
-
DEFAULT_SIZE_Y
public static final int DEFAULT_SIZE_Y- See Also:
-
DEFAULT_SIZE_Z
public static final int DEFAULT_SIZE_Z- See Also:
-
DEFAULT_SIZE_C
public static final int DEFAULT_SIZE_C- See Also:
-
DEFAULT_SIZE_T
public static final int DEFAULT_SIZE_T- See Also:
-
DEFAULT_PIXEL_TYPE
public static final int DEFAULT_PIXEL_TYPE- See Also:
-
DEFAULT_RGB_CHANNEL_COUNT
public static final int DEFAULT_RGB_CHANNEL_COUNT- See Also:
-
DEFAULT_DIMENSION_ORDER
- See Also:
-
DEFAULT_RGB_DIMENSION_ORDER
- See Also:
-
DEFAULT_RESOLUTION_SCALE
public static final int DEFAULT_RESOLUTION_SCALE- See Also:
-
TOKEN_SEPARATOR
- See Also:
-
SEED
private static final long SEED- See Also:
-
sizeX
private int sizeX -
sizeY
private int sizeY -
sizeZ
private int sizeZ -
sizeC
private int sizeC -
sizeT
private int sizeT -
exposureTime
private ome.units.quantity.Time exposureTimeexposure time per plane info -
physicalSizeX
private ome.units.quantity.Length physicalSizeX -
physicalSizeY
private ome.units.quantity.Length physicalSizeY -
physicalSizeZ
private ome.units.quantity.Length physicalSizeZ -
excitationWavelengths
-
emissionWavelengths
-
annBool
private int annBool -
annComment
private int annComment -
annDouble
private int annDouble -
annLong
private int annLong -
annMap
private int annMap -
annTime
private int annTime -
annTag
private int annTag -
annTerm
private int annTerm -
annXml
private int annXml -
annotationCount
private int annotationCount -
annotationBoolCount
private int annotationBoolCount -
annotationCommentCount
private int annotationCommentCount -
annotationDoubleCount
private int annotationDoubleCount -
annotationLongCount
private int annotationLongCount -
annotationMapCount
private int annotationMapCount -
annotationTagCount
private int annotationTagCount -
annotationTermCount
private int annotationTermCount -
annotationTimeCount
private int annotationTimeCount -
annotationXmlCount
private int annotationXmlCount -
ellipses
private int ellipses -
labels
private int labels -
lines
private int lines -
masks
private int masks -
points
private int points -
polygons
private int polygons -
polylines
private int polylines -
rectangles
private int rectangles -
roiCount
private int roiCount -
scaleFactor
private double scaleFactorScale factor for gradient, if any. -
lut8
private byte[][][] lut88-bit lookup table, if indexed color, one per channel. -
lut16
private short[][][] lut1616-bit lookup table, if indexed color, one per channel. -
indexToValue
private int[][] indexToValueFor indexed color, mapping from indices to values and vice versa. -
valueToIndex
private int[][] valueToIndexFor indexed color, mapping from indices to values and vice versa. -
ac
private int acChannel of last opened image plane. -
iniFile
Properties companion file which can be associated with this fake file -
fakeSeries
List of used files if the fake is a SPW structure -
omeXmlMetadata
-
omeXmlService
-
screens
private transient int screens -
plates
private transient int plates -
plateRows
private transient int plateRows -
plateCols
private transient int plateCols -
fields
private transient int fields -
plateAcqs
private transient int plateAcqs -
sleepOpenBytes
private int sleepOpenBytes -
sleepInitFile
private int sleepInitFile -
labelPlanes
private boolean labelPlanes
-
-
Constructor Details
-
FakeReader
public FakeReader()Constructs a new fake reader.
-
-
Method Details
-
sleep
-
readSpecialPixels
public static int[] readSpecialPixels(byte[] plane) Read byte-encoded metadata from the given plane.- See Also:
-
readSpecialPixels
public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little) Read byte-encoded metadata from the given plane.- See Also:
-
readSpecialPixels
public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little, int rgb, boolean interleaved) Read byte-encoded metadata from the given plane.FakeReader encodes the following information in the upper-left section of each plane: series, plane number, Z index, C index, T index. Given an image plane generated by FakeReader (or by anything that follows the same encoding rules), this method decodes the above information and returns it as an array of integers.
Note that the above numbers are encoded as valid pixels, so that the information is still retrievable after conversion to a pixel-oriented image format (this allows to use the class for testing the ImageJ plugin). Among other things, this implies that the maximum encodable values depend on the pixel type.
Note:
In the case of indexed color data, the returned values will be the indices of the actual values in the relevant lookup table (see
get8BitLookupTable()andget16BitLookupTable()).- Parameters:
plane- an image plane as a byte arraypixelType- the pixel type of the image; seeFormatToolslittle- true if the byte order is little-endian, false otherwisergb- the RGB channel countinterleaved- true if the channels are interleaved, false otherwise- Returns:
- an array of integers representing, in order: series; plane number; Z index; C index, T index
-
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 classFormatReader- 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 classFormatReader- 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- Specified by:
openBytesin classFormatReader- 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.
-
isSingleFile
Description copied from interface:IFormatReaderReturns true if the named file is expected to be the only file in the dataset. For single-file formats, always returns true.- Specified by:
isSingleFilein interfaceIFormatReader- Overrides:
isSingleFilein classFormatReader- Throws:
FormatExceptionIOException
-
isThisType
Description copied from class:FormatReaderChecks if a file matches the type of this format reader. Checks filename suffixes against those known for this format. If the suffix check is inconclusive and the open parameter is true, the file is opened and tested withFormatReader.isThisType(RandomAccessInputStream).- Specified by:
isThisTypein interfaceIFormatReader- Overrides:
isThisTypein classFormatReader- Parameters:
open- If true, and the file extension is insufficient to determine the file type, the (existing) file is opened for further analysis.
-
getSeriesUsedFiles
Description copied from interface:IFormatReaderReturns an array of filenames needed to open the current series. If the 'noPixels' flag is set, then only files that do not contain pixel data will be returned. The first element in the array is expected to be the path passed toIFormatHandler.setId(String), if appropriate based upon 'noPixels'. The remaining elements are expected to be in a consistent order; if a directory listing is necessary to build the list then it should be sorted first.- Specified by:
getSeriesUsedFilesin interfaceIFormatReader- Overrides:
getSeriesUsedFilesin classFormatReader
-
findLogFiles
private void findLogFiles() -
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 classFormatReader- Throws:
IOException
-
getOmeXmlMetadata
-
getOmeXmlService
-
initFile
Description copied from class:FormatReaderInitializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.- Overrides:
initFilein classFormatReader- Throws:
FormatException- if a parsing error occurs processing the file.IOException- if an I/O error occurs processing the file
-
reopenFile
Description copied from interface:IFormatReaderReopen any files that were closed, and which are expected to be open while the reader is open. This assumes thatIFormatHandler.setId(java.lang.String)has been called, but close(false) has not been called.- Specified by:
reopenFilein interfaceIFormatReader- Overrides:
reopenFilein classFormatReader- Throws:
IOException
-
fillPhysicalSizes
-
fillExposureTime
-
fillChannelWavelengths
-
fillAcquisitionDate
-
fillAnnotations
-
fillInstrumentRefs
-
getX
-
getY
-
getPoints
-
fillRegions
-
parseSeriesTable
Translate key/value pairs from the INI table for the specified series. -
toSPWCoordinates
private int[] toSPWCoordinates(int seriesIndex) Convert the given series (Image) index to a WellSample, Well, and Plate index. This should match the ordering used by XMLMockObjects.- Parameters:
seriesIndex- the index of the series/Image- Returns:
- an array of length 3 containing the WellSample, Well, and Plate indices (in order), or null if SPW metadata was not defined
-
extractTokensFromFakeSeries
-
isSPWStructure
-
populateSPW
private int populateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam) -
populateInstrument
-
createIndexMap
private void createIndexMap(int num) Creates a mapping between indices and color values. -
listFakeSeries
Traverses a fake file folder structure indicated by traversedDirectory -
shuffle
private static void shuffle(int c, int[] array) Fisher-Yates shuffle with constant seeds to ensure reproducibility. -
parseColor
-
parsePosition
private ome.units.quantity.Length parsePosition(String axis, int s, int index, loci.common.IniTable table) -
parsePhysicalSize
-
parseWavelength
-