loci.formats.in

## Class OIRReader

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatReader
    - - loci.formats.in.OIRReader

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler

      public class OIRReader
      extends FormatReader

  OIRReader is the file format reader for Olympus .oir files.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) class` | `OIRReader.Channel`
    `private static class` | `OIRReader.CZTKey` This is a class that wraps three numbers c,z,t and an object can be used as a key in a hashmap.
    `(package private) class` | `OIRReader.Detector`
    `(package private) class` | `OIRReader.Laser`
    `(package private) class` | `OIRReader.Objective`
    `(package private) class` | `OIRReader.PixelBlock`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private ome.xml.model.primitives.Timestamp` | `acquisitionDate`
    `private java.lang.String` | `baseName`
    `private int` | `blocksPerPlane`
    `private static int` | `BUFFER_SIZE`
    `private java.util.ArrayList<OIRReader.Channel>` | `channels`
    `private java.util.Map<OIRReader.CZTKey,OIRReader.PixelBlock[]>` | `cztToPixelBlocks`
    `private int` | `defaultXMLSkip`
    `private java.util.ArrayList<OIRReader.Detector>` | `detectors`
    `private static java.lang.String` | `IDENTIFIER`
    `private java.util.ArrayList<OIRReader.Laser>` | `lasers`
    `private int` | `lastChannel`
    `private int` | `minT`
    `private int` | `minZ`
    `private java.util.ArrayList<OIRReader.Objective>` | `objectives`
    `private int` | `optimalTileHeight`
    `private ome.units.quantity.Length` | `physicalSizeX`
    `private ome.units.quantity.Length` | `physicalSizeY`
    `private ome.units.quantity.Length` | `physicalSizeZ`
    `private java.util.HashMap<java.lang.String,OIRReader.PixelBlock>` | `pixelBlocks`
    `private java.util.HashMap<java.lang.Integer,java.lang.Double>` | `timestampAdjustments`
    `private java.lang.Double` | `tStart`
    `private java.lang.Double` | `tStep`
    `private java.lang.Double` | `zStart`
    `private java.lang.Double` | `zStep`

    - ### 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_DIMENSION`

    - ### Fields inherited from class loci.formats.FormatHandler

      `COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes`

    - ### Fields inherited from interface loci.formats.IFormatReader

      `CAN_GROUP, CANNOT_GROUP, MUST_GROUP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OIRReader()` Constructs a new OIR reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(boolean fileOnly)` Closes the currently open file.
    `private void` | `copyPixelBlock(OIRReader.PixelBlock block, byte[] buf, int offsetBuf, int offsetBlock, int nBytesPerLinesBuf, int nBytesPerLineBlock, int nLines)`
    `int` | `fileGroupOption(java.lang.String id)` Returns an indication of whether the files in a multi-file dataset can be handled individually.
    `private void` | `findNextXMLBlock(loci.common.RandomAccessInputStream s)`
    `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.
    `private int` | `getBlock(java.lang.String uid)`
    `private int` | `getC(java.lang.String uid)`
    `private org.w3c.dom.Element` | `getFirstChild(org.w3c.dom.Element root, java.lang.String tag)`
    `private int` | `getL(java.lang.String uid)`
    `int` | `getOptimalTileHeight()` Returns the optimal sub-image height for use with openBytes.
    `int` | `getOptimalTileWidth()` Returns the optimal sub-image width for use with openBytes.
    `java.lang.String[]` | `getSeriesUsedFiles(boolean noPixels)` Returns an array of filenames needed to open the current series.
    `private int` | `getT(java.lang.String uid)`
    `private int` | `getZ(java.lang.String uid)`
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `private void` | `insertChannel(int index, OIRReader.Channel c)` Insert the given Channel into the list of channels, at the given index.
    `private boolean` | `isCurrentFile(java.lang.String file)`
    `boolean` | `isSingleFile(java.lang.String id)` Returns true if the named file is expected to be the only file in the dataset.
    `boolean` | `isThisType(loci.common.RandomAccessInputStream stream)` Checks if the given stream is a valid stream for this file format.
    `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 void` | `parseAxis(org.w3c.dom.Element dimensionAxis)`
    `private void` | `parseChannel(org.w3c.dom.Element channel, boolean appendChannels)`
    `private void` | `parseFrameProperties(org.w3c.dom.Element root)`
    `private void` | `parseImageProperties(org.w3c.dom.Element root)`
    `private void` | `parseLUT(org.w3c.dom.Element root, java.lang.String uid)`
    `private void` | `parseOriginalMetadata(org.w3c.dom.Node root)`
    `private void` | `parseXML(loci.common.RandomAccessInputStream s, java.lang.String xml, long startFilePointer)`
    `private void` | `readPixelsFile(java.lang.String file, loci.common.RandomAccessInputStream s)`
    `private void` | `readXMLBlock(java.lang.String file, loci.common.RandomAccessInputStream s)`
    `private boolean` | `skipPixelBlock(java.lang.String currentFile, loci.common.RandomAccessInputStream s, boolean store)`

    - ### 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, 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, 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, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataLists`

    - ### Methods inherited from class loci.formats.FormatHandler

      `checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface loci.formats.IFormatHandler

      `getFormat, getNativeDataType, getSuffixes`

    - ### Methods inherited from interface loci.formats.IMetadataConfigurable

      `getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from interface loci.formats.ICompressedTileReader

      `getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytes`

- - ### Field Detail

    - #### IDENTIFIER

          private static final java.lang.String IDENTIFIER

      See Also:
        Constant Field Values

    - #### BUFFER_SIZE

          private static final int BUFFER_SIZE

      See Also:
        Constant Field Values

    - #### pixelBlocks

          private java.util.HashMap<java.lang.String,OIRReader.PixelBlock> pixelBlocks

    - #### channels

          private java.util.ArrayList<OIRReader.Channel> channels

    - #### lasers

          private java.util.ArrayList<OIRReader.Laser> lasers

    - #### detectors

          private java.util.ArrayList<OIRReader.Detector> detectors

    - #### objectives

          private java.util.ArrayList<OIRReader.Objective> objectives

    - #### physicalSizeX

          private ome.units.quantity.Length physicalSizeX

    - #### physicalSizeY

          private ome.units.quantity.Length physicalSizeY

    - #### physicalSizeZ

          private ome.units.quantity.Length physicalSizeZ

    - #### acquisitionDate

          private ome.xml.model.primitives.Timestamp acquisitionDate

    - #### defaultXMLSkip

          private int defaultXMLSkip

    - #### blocksPerPlane

          private int blocksPerPlane

    - #### cztToPixelBlocks

          private final java.util.Map<OIRReader.CZTKey,OIRReader.PixelBlock[]> cztToPixelBlocks

    - #### baseName

          private java.lang.String baseName

    - #### lastChannel

          private int lastChannel

    - #### optimalTileHeight

          private int optimalTileHeight

    - #### minZ

          private int minZ

    - #### minT

          private int minT

    - #### zStart

          private transient java.lang.Double zStart

    - #### zStep

          private transient java.lang.Double zStep

    - #### tStart

          private transient java.lang.Double tStart

    - #### tStep

          private transient java.lang.Double tStep

    - #### timestampAdjustments

          private transient java.util.HashMap<java.lang.Integer,java.lang.Double> timestampAdjustments

  - ### Constructor Detail

    - #### OIRReader

          public OIRReader()

      Constructs a new OIR reader.

  - ### Method Detail

    - #### fileGroupOption

          public int fileGroupOption(java.lang.String id)
                              throws FormatException,
                                     java.io.IOException

      Description copied from interface: `IFormatReader`
      Returns an indication of whether the files in a multi-file dataset can be handled individually. This method is only useful for formats and datasets which contain multiple files.
      Specified by:
        `fileGroupOption` in interface `IFormatReader`
      Overrides:
        `fileGroupOption` in class `FormatReader`
      Parameters:
        `id` - a file in the multi-file dataset
      Returns:
        an int indicating that we cannot, must, or might group the files. A return value of `FormatTools.MUST_GROUP` indicates that the files cannot be handled separately; the reader will always detect and read all files in the dataset. `FormatTools.CAN_GROUP` indicates that the files may be handled separately, but file grouping must then be disabled via `IFormatReader.setGroupFiles(boolean)`. `FormatTools.CANNOT_GROUP` indicates that the files must be handled separately; the reader will not attempt to read all files in the dataset (this is rare).
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `FormatTools.MUST_GROUP`, `FormatTools.CAN_GROUP`, `FormatTools.CANNOT_GROUP`

    - #### isSingleFile

          public boolean isSingleFile(java.lang.String id)
                               throws FormatException,
                                      java.io.IOException

      Description copied from interface: `IFormatReader`
      Returns true if the named file is expected to be the only file in the dataset. For single-file formats, always returns true.
      Specified by:
        `isSingleFile` in interface `IFormatReader`
      Overrides:
        `isSingleFile` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getSeriesUsedFiles

          public java.lang.String[] getSeriesUsedFiles(boolean noPixels)

      Description copied from interface: `IFormatReader`
      Returns 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 to `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.
      Specified by:
        `getSeriesUsedFiles` in interface `IFormatReader`
      Overrides:
        `getSeriesUsedFiles` in class `FormatReader`

    - #### isThisType

          public boolean isThisType(loci.common.RandomAccessInputStream stream)
                             throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Checks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.
      Specified by:
        `isThisType` in interface `IFormatReader`
      Overrides:
        `isThisType` in class `FormatReader`
      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:
        `java.io.IOException`

    - #### get8BitLookupTable

          public byte[][] get8BitLookupTable()
                                      throws FormatException,
                                             java.io.IOException

      Description copied from interface: `IFormatReader`
      Gets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if `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.
      Specified by:
        `get8BitLookupTable` in interface `IFormatReader`
      Overrides:
        `get8BitLookupTable` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### get16BitLookupTable

          public short[][] get16BitLookupTable()
                                        throws FormatException,
                                               java.io.IOException

      Description copied from interface: `IFormatReader`
      Gets the 16-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if `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.
      Specified by:
        `get16BitLookupTable` in interface `IFormatReader`
      Overrides:
        `get16BitLookupTable` in class `FormatReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getOptimalTileHeight

          public int getOptimalTileHeight()

      Description copied from interface: `IFormatReader`
      Returns the optimal sub-image height for use with openBytes.
      Specified by:
        `getOptimalTileHeight` in interface `IFormatReader`
      Overrides:
        `getOptimalTileHeight` in class `FormatReader`

    - #### getOptimalTileWidth

          public int getOptimalTileWidth()

      Description copied from interface: `IFormatReader`
      Returns the optimal sub-image width for use with openBytes.
      Specified by:
        `getOptimalTileWidth` in interface `IFormatReader`
      Overrides:
        `getOptimalTileWidth` in class `FormatReader`

    - #### openBytes

          public byte[] openBytes(int no,
                                  byte[] buf,
                                  int x,
                                  int y,
                                  int w,
                                  int h)
                           throws FormatException,
                                  java.io.IOException

      Description copied from interface: `IFormatReader`
      Obtains a sub-image of the specified image plane into a pre-allocated byte array.
      Specified by:
        `openBytes` in interface `IFormatReader`
      Specified by:
        `openBytes` in class `FormatReader`
      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-image
        `y` - Y coordinate of the upper-left corner of the sub-image
        `w` - width of the sub-image
        `h` - height of the sub-image
      Returns:
        the pre-allocated buffer `buf` for convenience.
      Throws:
        `FormatException` - if there was a problem parsing the metadata of the file.
        `java.io.IOException` - if there was a problem reading the file.
      See Also:
        `IFormatReader.openBytes(int, byte[], int, int, int, int)`

    - #### close

          public void close(boolean fileOnly)
                     throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Closes the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to calling `Closeable.close()`.
      Specified by:
        `close` in interface `IFormatReader`
      Overrides:
        `close` in class `FormatReader`
      Throws:
        `java.io.IOException`

    - #### initFile

          protected void initFile(java.lang.String id)
                           throws FormatException,
                                  java.io.IOException

      Description copied from class: `FormatReader`
      Initializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.
      Overrides:
        `initFile` in class `FormatReader`
      Throws:
        `FormatException` - if a parsing error occurs processing the file.
        `java.io.IOException` - if an I/O error occurs processing the file

    - #### readPixelsFile

          private void readPixelsFile(java.lang.String file,
                                      loci.common.RandomAccessInputStream s)
                               throws FormatException,
                                      java.io.IOException

      Throws:
        `FormatException`
        `java.io.IOException`

    - #### findNextXMLBlock

          private void findNextXMLBlock(loci.common.RandomAccessInputStream s)
                                 throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readXMLBlock

          private void readXMLBlock(java.lang.String file,
                                    loci.common.RandomAccessInputStream s)
                             throws FormatException,
                                    java.io.IOException

      Throws:
        `FormatException`
        `java.io.IOException`

    - #### parseXML

          private void parseXML(loci.common.RandomAccessInputStream s,
                                java.lang.String xml,
                                long startFilePointer)
                         throws FormatException,
                                java.io.IOException

      Throws:
        `FormatException`
        `java.io.IOException`

    - #### parseLUT

          private void parseLUT(org.w3c.dom.Element root,
                                java.lang.String uid)
                         throws FormatException

      Throws:
        `FormatException`

    - #### parseFrameProperties

          private void parseFrameProperties(org.w3c.dom.Element root)
                                     throws FormatException

      Throws:
        `FormatException`

    - #### parseImageProperties

          private void parseImageProperties(org.w3c.dom.Element root)
                                     throws FormatException

      Throws:
        `FormatException`

    - #### insertChannel

          private void insertChannel(int index,
                                     OIRReader.Channel c)

      Insert the given Channel into the list of channels, at the given index. If the index is greater than the current list length, then the list will be expanded accordingly.

    - #### parseChannel

          private void parseChannel(org.w3c.dom.Element channel,
                                    boolean appendChannels)

    - #### parseAxis

          private void parseAxis(org.w3c.dom.Element dimensionAxis)

    - #### parseOriginalMetadata

          private void parseOriginalMetadata(org.w3c.dom.Node root)

    - #### getFirstChild

          private org.w3c.dom.Element getFirstChild(org.w3c.dom.Element root,
                                                    java.lang.String tag)

    - #### skipPixelBlock

          private boolean skipPixelBlock(java.lang.String currentFile,
                                         loci.common.RandomAccessInputStream s,
                                         boolean store)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### copyPixelBlock

          private void copyPixelBlock(OIRReader.PixelBlock block,
                                      byte[] buf,
                                      int offsetBuf,
                                      int offsetBlock,
                                      int nBytesPerLinesBuf,
                                      int nBytesPerLineBlock,
                                      int nLines)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getZ

          private int getZ(java.lang.String uid)

    - #### getT

          private int getT(java.lang.String uid)

    - #### getC

          private int getC(java.lang.String uid)

    - #### getBlock

          private int getBlock(java.lang.String uid)

    - #### getL

          private int getL(java.lang.String uid)

    - #### isCurrentFile

          private boolean isCurrentFile(java.lang.String file)

Copyright © 2026 Open Microscopy Environment