Package loci.formats.in
Class IM3Reader
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.in.IM3Reader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
- Author:
- Lee Kamentsky This is a FormatReader for the Perkin-Elmer Nuance line of multispectral imaging microscopes' .im3 file format. The .im3 format stores 63 planes representing intensity measurements taken on separate spectral bands. The pixel intensity at a single band might be used as a proxy for fluorophore presence, but the best results are obtained if the whole spectrum is used to synthesize an intensity. The most efficient strategy is to use IM3Reader.openRaw() to fetch the entire image which may then be scanned sequentially to create one planar image per desired signal. IM3Reader may be run as a Java application to dump a per-record description of the file to standard output
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA record containing boolean valuesprotected static classprotected static classprotected static classprotected static classstatic classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intFirst 4 bytes of file is "1985"private byte[]private List<IM3Reader.ContainerRecord> private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final org.slf4j.LoggerLogger for outputting summary diagnostics.private static final intprivate static final intA record that is a container of other records.private static final intprivate static final intImage format int: pixel type? 3 = RGBA int: width int: height int: depth data bytes followprivate static final int32-bit integer valuesprivate static final intA nested record of recordsprivate static final intA string int: ? int: length 8-byte characters followprivate List<IM3Reader.IM3Record> private List<IM3Reader.Spectrum> 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, 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.If a Nuance file is a spectral library set (.csl) file, there is a spectral library inside that contains a profile of spectral bin magnitudes for each of several measured fluorophores (or auto fluorescence).protected voidInitializes the given file (parsing header information, etc.).booleanisThisType(loci.common.RandomAccessInputStream stream) Checks if the given stream is a valid stream for this file format.static voidWrite a summary of each record to STDOUTbyte[]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[]openRaw()Open the current series in raw-mode, returning the interleaved image bytes.private static IM3Reader.IM3RecordparseRecord(loci.common.IRandomAccess is) Parse an IM3 record at the current file pointer locationprotected static StringparseString(loci.common.IRandomAccess is) Parse a string from the IM3 file at the current file pointer locvoidsetSeries(int no) Activates the specified series.voidWrite a summary of each field in the IM3 file to the writerMethods 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, get16BitLookupTable, get8BitLookupTable, 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, 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, isSingleFile, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, 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
-
LOGGER
private static final org.slf4j.Logger LOGGERLogger for outputting summary diagnostics. -
COOKIE
private static final int COOKIEFirst 4 bytes of file is "1985"- See Also:
-
REC_CONTAINER
private static final int REC_CONTAINERA record that is a container of other records.- See Also:
-
REC_IMAGE
private static final int REC_IMAGEImage format int: pixel type? 3 = RGBA int: width int: height int: depth data bytes follow- See Also:
-
REC_NESTED
private static final int REC_NESTEDA nested record of records- See Also:
-
REC_INT
private static final int REC_INT32-bit integer values- See Also:
-
REC_FLOAT
private static final int REC_FLOAT- See Also:
-
REC_BOOLEAN
private static final int REC_BOOLEAN- See Also:
-
REC_STRING
private static final int REC_STRINGA string int: ? int: length 8-byte characters follow- See Also:
-
FIELD_DATA_SET
- See Also:
-
FIELD_TIMESTAMP
- See Also:
-
FIELD_AUX_FLAGS
- See Also:
-
FIELD_NUANCE_FLAGS
- See Also:
-
FIELD_SPECTRA
- See Also:
-
FIELD_VALUES
- See Also:
-
FIELD_PROTOCOL
- See Also:
-
FIELD_OBJECTIVE
- See Also:
-
FIELD_SPECTRAL_BASIS_INFO
- See Also:
-
FIELD_FILTER_PAIR
- See Also:
-
FIELD_FIXED_FILTER
- See Also:
-
FIELD_BANDS
- See Also:
-
FIELD_SPECTRAL_LIBRARY
- See Also:
-
FIELD_SPECTRUM
- See Also:
-
FIELD_THUMBNAIL
- See Also:
-
FIELD_DATA
- See Also:
-
FIELD_FILE_VERSION
- See Also:
-
FIELD_CLASS_ID
- See Also:
-
FIELD_TYPE_ID
- See Also:
-
FIELD_SHAPE
- See Also:
-
FIELD_BAND_INDEX
- See Also:
-
FIELD_NAME
- See Also:
-
FIELD_SAMPLE_ID
- See Also:
-
FIELD_USER_COMMENTS
- See Also:
-
FIELD_SOURCE_FILE_NAME
- See Also:
-
FIELD_PROXY_PARENT_FILE_NAME
- See Also:
-
FIELD_MANUFACTURER
- See Also:
-
FIELD_PART_NUMBER
- See Also:
-
FIELD_MILLIMETERS_PER_PIXEL
- See Also:
-
FIELD_EXPOSURE
- See Also:
-
FIELD_WAVELENGTH
- See Also:
-
FIELD_WAVELENGTHS
- See Also:
-
FIELD_MAGNITUDES
- See Also:
-
FIELD_HOMOGENEOUS
- See Also:
-
records
-
dataSets
-
spectra
-
data
private byte[] data -
EMPTY_STRING
-
-
Constructor Details
-
IM3Reader
public IM3Reader()Construct an uninitialized reader of .im3 files.
-
-
Method Details
-
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.
-
openRaw
Open the current series in raw-mode, returning the interleaved image bytes. The data format for a pixel is a run of 63 unsigned short little endian values.- Returns:
- a byte array containing the data organized by spectral channel, then x, then y. Returns null if, for some incomprehensible reason, the DATA block was missing.
- Throws:
IOException
-
getSpectra
If a Nuance file is a spectral library set (.csl) file, there is a spectral library inside that contains a profile of spectral bin magnitudes for each of several measured fluorophores (or auto fluorescence). This method finds the spectral library and returns the spectra inside.- Returns:
- a list of the Spectrum records contained in the library
-
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
-
parseString
Parse a string from the IM3 file at the current file pointer loc- Parameters:
is- stream to read from- Returns:
- parsed string or null for string of zero length
- Throws:
IOException
-
parseRecord
Parse an IM3 record at the current file pointer location- Parameters:
is- random access stream, pointing at the record's start (the length-quadword of the record's tag name)- Returns:
- an IM3Record or subclass depending on the record's type
- Throws:
IOException- on file misparsing leading to overrun and other
-
isThisType
Description copied from interface:IFormatReaderChecks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.- Specified by:
isThisTypein interfaceIFormatReader- Overrides:
isThisTypein classFormatReader- Parameters:
stream- A RandomAccessInputStream representing the file to check. The first byte in the stream is assumed to be the first byte in the file.- Returns:
- true if the file represented by the stream can be read by this reader; false otherwise.
- Throws:
IOException
-
setSeries
public void setSeries(int no) Description copied from interface:IFormatReaderActivates the specified series. This also resets the resolution to 0.- Specified by:
setSeriesin interfaceIFormatReader- Overrides:
setSeriesin classFormatReader
-
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
-
writeSummary
Write a summary of each field in the IM3 file to the writer- Throws:
IOException
-
main
Write a summary of each record to STDOUT- Parameters:
args-- Throws:
IOException
-