public class FakeReader extends FormatReader
Examples:
Modifier and Type | Field and Description |
---|---|
private int |
ac
Channel of last opened image plane.
|
private static boolean |
ANN_BOOLEAN_VALUE |
private static java.lang.String |
ANN_COMMENT_VALUE |
private static java.lang.Double |
ANN_DOUBLE_VALUE |
private static long |
ANN_LONG_VALUE |
private static java.lang.String |
ANN_TAG_VALUE |
private static java.lang.String |
ANN_TERM_VALUE |
private static ome.xml.model.primitives.Timestamp |
ANN_TIME_VALUE |
private static java.lang.String |
ANN_XML_VALUE_END |
private static java.lang.String |
ANN_XML_VALUE_START |
private int |
annBool |
private int |
annComment |
private int |
annDouble |
private int |
annLong |
private int |
annMap |
private static java.lang.String |
ANNOTATION_NAMESPACE |
private static java.lang.String |
ANNOTATION_PREFIX |
private int |
annotationBoolCount |
private int |
annotationCommentCount |
private int |
annotationCount |
private int |
annotationDoubleCount |
private int |
annotationLongCount |
private int |
annotationMapCount |
private int |
annotationTagCount |
private int |
annotationTermCount |
private int |
annotationTimeCount |
private int |
annotationXmlCount |
private int |
annTag |
private int |
annTerm |
private int |
annTime |
private int |
annXml |
static int |
BOX_SIZE |
static java.lang.String |
DEFAULT_DIMENSION_ORDER |
static int |
DEFAULT_PIXEL_TYPE |
static int |
DEFAULT_RESOLUTION_SCALE |
static int |
DEFAULT_RGB_CHANNEL_COUNT |
static int |
DEFAULT_SIZE_C |
static int |
DEFAULT_SIZE_T |
static int |
DEFAULT_SIZE_X |
static int |
DEFAULT_SIZE_Y |
static int |
DEFAULT_SIZE_Z |
private int |
ellipses |
private ome.units.quantity.Time |
exposureTime
exposure time per plane info
|
private java.util.List<java.lang.String> |
fakeSeries
List of used files if the fake is a SPW structure
|
private int |
fields |
private int[][] |
indexToValue
For indexed color, mapping from indices to values and vice versa.
|
private java.lang.String |
iniFile
Properties companion file which can be associated with this fake file
|
private int |
labels |
private int |
lines |
private short[][][] |
lut16
16-bit lookup table, if indexed color, one per channel.
|
private byte[][][] |
lut8
8-bit lookup table, if indexed color, one per channel.
|
private int |
masks |
private OMEXMLMetadata |
omeXmlMetadata |
private OMEXMLService |
omeXmlService |
private ome.units.quantity.Length |
physicalSizeX |
private ome.units.quantity.Length |
physicalSizeY |
private ome.units.quantity.Length |
physicalSizeZ |
private int |
plateAcqs |
private int |
plateCols |
private int |
plateRows |
private int |
plates |
private int |
points |
private int |
polygons |
private int |
polylines |
private int |
rectangles |
private static java.lang.String |
ROI_PREFIX |
private static int |
ROI_SPACING |
private int |
roiCount |
private double |
scaleFactor
Scale factor for gradient, if any.
|
private int |
screens |
private static long |
SEED |
private static java.lang.String |
SHAPE_PREFIX |
private int |
sizeC |
private int |
sizeT |
private int |
sizeX |
private int |
sizeY |
private int |
sizeZ |
private int |
sleepInitFile |
private int |
sleepOpenBytes |
private static java.lang.String |
TOKEN_SEPARATOR |
private int[][] |
valueToIndex
For indexed color, mapping from indices to values and vice versa.
|
core, coreIndex, datasetDescription, domains, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSION
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
Constructor and Description |
---|
FakeReader()
Constructs a new fake reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close(boolean fileOnly)
Closes the currently open file.
|
private void |
createIndexMap(int num)
Creates a mapping between indices and color values.
|
private java.lang.String[] |
extractTokensFromFakeSeries(java.lang.String path) |
private void |
fillAcquisitionDate(MetadataStore store,
java.lang.String date,
int imageIndex) |
private void |
fillAnnotations(MetadataStore store,
int imageIndex) |
private void |
fillExposureTime(MetadataStore store) |
private void |
fillPhysicalSizes(MetadataStore store) |
private void |
fillRegions(MetadataStore store,
int imageIndex) |
private void |
findLogFiles() |
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.
|
OMEXMLMetadata |
getOmeXmlMetadata() |
OMEXMLService |
getOmeXmlService() |
private java.lang.String |
getPoints(int i) |
java.lang.String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
private java.lang.Double |
getX(int i) |
private java.lang.Double |
getY(int i) |
protected void |
initFile(java.lang.String id)
Initializes the given file (parsing header information, etc.).
|
boolean |
isSingleFile(java.lang.String id)
Returns true if the named file is expected to be the only
file in the dataset.
|
private boolean |
isSPWStructure(java.lang.String path) |
boolean |
isThisType(java.lang.String name,
boolean open)
Checks if a file matches the type of this format reader.
|
private java.util.List<java.lang.String> |
listFakeSeries(java.lang.String traversedDirectory)
Traverses a fake file folder structure indicated by traversedDirectory
|
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.
|
private int |
parseColor(java.lang.String value) |
private ome.units.quantity.Length |
parsePhysicalSize(java.lang.String s,
java.lang.String defaultUnit) |
private ome.units.quantity.Length |
parsePosition(java.lang.String axis,
int s,
int index,
loci.common.IniTable table) |
private void |
parseSeriesTable(loci.common.IniTable table,
MetadataStore store,
int newSeries)
Translate key/value pairs from the INI table for the specified series.
|
private int |
populateSPW(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.
|
void |
reopenFile()
Reopen any files that were closed, and which are expected to be open
while the reader is open.
|
private static void |
shuffle(int c,
int[] array)
Fisher-Yates shuffle with constant seeds to ensure reproducibility.
|
(package private) static void |
sleep(java.lang.String msg,
int ms) |
private int[] |
toSPWCoordinates(int seriesIndex)
Convert the given series (Image) index to a
WellSample, Well, and Plate index.
|
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, 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, 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, seriesToCoreIndex, setCoreIndex, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataLists
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFormat, getNativeDataType, getSuffixes
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
private static final long ANN_LONG_VALUE
private static final java.lang.Double ANN_DOUBLE_VALUE
private static final java.lang.String ANNOTATION_PREFIX
private static final java.lang.String ANNOTATION_NAMESPACE
private static final java.lang.String ANN_TERM_VALUE
private static final java.lang.String ANN_TAG_VALUE
private static final ome.xml.model.primitives.Timestamp ANN_TIME_VALUE
private static final boolean ANN_BOOLEAN_VALUE
private static final java.lang.String ANN_COMMENT_VALUE
private static final java.lang.String ANN_XML_VALUE_START
private static final java.lang.String ANN_XML_VALUE_END
private static final java.lang.String ROI_PREFIX
private static final java.lang.String SHAPE_PREFIX
public static final int BOX_SIZE
private static final int ROI_SPACING
public static final int DEFAULT_SIZE_X
public static final int DEFAULT_SIZE_Y
public static final int DEFAULT_SIZE_Z
public static final int DEFAULT_SIZE_C
public static final int DEFAULT_SIZE_T
public static final int DEFAULT_PIXEL_TYPE
public static final int DEFAULT_RGB_CHANNEL_COUNT
public static final java.lang.String DEFAULT_DIMENSION_ORDER
public static final int DEFAULT_RESOLUTION_SCALE
private static final java.lang.String TOKEN_SEPARATOR
private static final long SEED
private int sizeX
private int sizeY
private int sizeZ
private int sizeC
private int sizeT
private ome.units.quantity.Time exposureTime
private ome.units.quantity.Length physicalSizeX
private ome.units.quantity.Length physicalSizeY
private ome.units.quantity.Length physicalSizeZ
private int annBool
private int annComment
private int annDouble
private int annLong
private int annMap
private int annTime
private int annTag
private int annTerm
private int annXml
private int annotationCount
private int annotationBoolCount
private int annotationCommentCount
private int annotationDoubleCount
private int annotationLongCount
private int annotationMapCount
private int annotationTagCount
private int annotationTermCount
private int annotationTimeCount
private int annotationXmlCount
private int ellipses
private int labels
private int lines
private int masks
private int points
private int polygons
private int polylines
private int rectangles
private int roiCount
private double scaleFactor
private byte[][][] lut8
private short[][][] lut16
private int[][] indexToValue
private int[][] valueToIndex
private int ac
private java.lang.String iniFile
private java.util.List<java.lang.String> fakeSeries
private OMEXMLMetadata omeXmlMetadata
private OMEXMLService omeXmlService
private transient int screens
private transient int plates
private transient int plateRows
private transient int plateCols
private transient int fields
private transient int plateAcqs
private int sleepOpenBytes
private int sleepInitFile
static void sleep(java.lang.String msg, int ms)
public static int[] readSpecialPixels(byte[] plane)
public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little)
public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little, int rgb, boolean interleaved)
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()
and
get16BitLookupTable()
).
plane
- an image plane as a byte arraypixelType
- the pixel type of the image; see
FormatTools
little
- true if the byte order is little-endian, false otherwisergb
- the RGB channel countinterleaved
- true if the channels are interleaved, false otherwisepublic byte[][] get8BitLookupTable() throws FormatException, java.io.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 FormatReader
FormatException
java.io.IOException
public short[][] get16BitLookupTable() throws FormatException, java.io.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 FormatReader
FormatException
java.io.IOException
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class FormatReader
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-imagebuf
for convenience.FormatException
- if there was a problem parsing the metadata of the
file.java.io.IOException
- if there was a problem reading the file.public boolean isSingleFile(java.lang.String id) throws FormatException, java.io.IOException
IFormatReader
isSingleFile
in interface IFormatReader
isSingleFile
in class FormatReader
FormatException
java.io.IOException
public boolean isThisType(java.lang.String name, boolean open)
FormatReader
FormatReader.isThisType(RandomAccessInputStream)
.isThisType
in interface IFormatReader
isThisType
in class FormatReader
open
- If true, and the file extension is insufficient to determine
the file type, the (existing) file is opened for further analysis.public java.lang.String[] getSeriesUsedFiles(boolean noPixels)
IFormatReader
IFormatHandler.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.getSeriesUsedFiles
in interface IFormatReader
getSeriesUsedFiles
in class FormatReader
private void findLogFiles()
public void close(boolean fileOnly) throws java.io.IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class FormatReader
java.io.IOException
public OMEXMLMetadata getOmeXmlMetadata()
public OMEXMLService getOmeXmlService()
protected void initFile(java.lang.String id) throws FormatException, java.io.IOException
FormatReader
initFile
in class FormatReader
FormatException
- if a parsing error occurs processing the file.java.io.IOException
- if an I/O error occurs processing the filepublic void reopenFile() throws java.io.IOException
IFormatReader
IFormatHandler.setId(java.lang.String)
has been
called, but close(false) has not been called.reopenFile
in interface IFormatReader
reopenFile
in class FormatReader
java.io.IOException
private void fillPhysicalSizes(MetadataStore store)
private void fillExposureTime(MetadataStore store)
private void fillAcquisitionDate(MetadataStore store, java.lang.String date, int imageIndex)
private void fillAnnotations(MetadataStore store, int imageIndex)
private java.lang.Double getX(int i)
private java.lang.Double getY(int i)
private java.lang.String getPoints(int i)
private void fillRegions(MetadataStore store, int imageIndex)
private void parseSeriesTable(loci.common.IniTable table, MetadataStore store, int newSeries)
private int[] toSPWCoordinates(int seriesIndex)
seriesIndex
- the index of the series/Imageprivate java.lang.String[] extractTokensFromFakeSeries(java.lang.String path)
private boolean isSPWStructure(java.lang.String path)
private int populateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam)
private void createIndexMap(int num)
private java.util.List<java.lang.String> listFakeSeries(java.lang.String traversedDirectory)
private static void shuffle(int c, int[] array)
private int parseColor(java.lang.String value)
private ome.units.quantity.Length parsePosition(java.lang.String axis, int s, int index, loci.common.IniTable table)
private ome.units.quantity.Length parsePhysicalSize(java.lang.String s, java.lang.String defaultUnit)
Copyright © 2020 Open Microscopy Environment