loci.formats.in

## Class XLEFReader

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatReader
    - - loci.formats.in.LeicaMicrosystemsMetadata.LMSFileReader
      - - loci.formats.in.XLEFReader

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

      public class XLEFReader
      extends LMSFileReader

  XLEFReader is the file format reader for Leica Microsystems' XLEF files.
  Author:
    Melissa Linkert melissa at glencoesoftware.com, Constanze Wendlandt constanze.wendlandt at leica-microsystems.com

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `XLEFReader.PathComparator` Helper class to sort file paths by name and depth

    - ### Nested classes/interfaces inherited from class loci.formats.in.LeicaMicrosystemsMetadata.LMSFileReader

      `LMSFileReader.ImageFormat`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.util.List<LMSFileReader>` | `readers`

    - ### Fields inherited from class loci.formats.in.LeicaMicrosystemsMetadata.LMSFileReader

      `associatedXmlDoc, log, metaTemp, OLD_PHYSICAL_SIZE_DEFAULT, OLD_PHYSICAL_SIZE_KEY`

    - ### 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
    `XLEFReader()` Constructs a new Leica XLEF reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(boolean fileOnly)` Closes the currently open file.
    `int` | `fileGroupOption(java.lang.String id)` Returns an indication of whether the files in a multi-file dataset can be handled individually.
    `LMSFileReader.ImageFormat` | `getImageFormat()` Returns the file format in which actual image bytes are stored
    `private int` | `getReaderIndex(int seriesIndex)` Returns the index of the correct reader for the series index.
    `private byte[]` | `getRgbChannel(int channel, byte[] in)` Returns single channel data for an rgb plane
    `private int` | `getSeriesPerReaderIndex(int series)` Returns the index of the series (tile) in the corresponding reader
    `java.lang.String[]` | `getSeriesUsedFiles(boolean noPixels)` Returns an array of filenames needed to open the current series.
    `java.lang.String[]` | `getUsedFiles(boolean noPixels)` Returns an array of filenames needed to open this dataset.
    `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.
    `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).
    `private byte[]` | `openBytesJpeg(int no, byte[] buf, int x, int y, int w, int h)` Gets bytes of jpeg images.
    `void` | `reopenFile()` Reopen any files that were closed, and which are expected to be open while the reader is open.
    `private void` | `setMetadataOfMultipleImagesReaders()`
    `private void` | `sortMultipleImagesReaders()` Sorts frames of all MultipleImagesReaders as per core dimension sizes and order
    `private void` | `sortPaths(java.util.List<java.lang.String> paths)` Sorts file paths by name and depth and moves current file path to the beginning
    `private int` | `sum(int[] arr, int start, int end)` Sums up all values of an array, from start index to (including) end index
    `private void` | `transformBytes8To16(byte[] in, byte[] out, int outRes)` Transforms an 8bit byte array to a 16bit byte array, optionally with bit upscaling (8-16bit)

    - ### Methods inherited from class loci.formats.in.LeicaMicrosystemsMetadata.LMSFileReader

      `addSeriesMeta, addSeriesMetaList, fileExists, getCore, makeFilterMetadata, setCore, translateMetadata, translateMetadata, useOldPhysicalSizeCalculation`

    - ### 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, close, coreIndexToSeries, 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, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, 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

    - #### readers

          private java.util.List<LMSFileReader> readers

  - ### Constructor Detail

    - #### XLEFReader

          public XLEFReader()

      Constructs a new Leica XLEF reader.

  - ### Method Detail

    - #### 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.

    - #### openBytes

          public byte[] openBytes(int no,
                                  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, whose upper-left corner is given by (x, y).
      Specified by:
        `openBytes` in interface `IFormatReader`
      Overrides:
        `openBytes` in class `FormatReader`
      Throws:
        `FormatException`
        `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

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

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

    - #### getUsedFiles

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

      Description copied from interface: `IFormatReader`
      Returns an array of filenames needed to open this dataset. 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:
        `getUsedFiles` in interface `IFormatReader`
      Overrides:
        `getUsedFiles` in class `FormatReader`

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

    - #### 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 `LMSFileReader`
      Throws:
        `java.io.IOException`

    - #### reopenFile

          public void reopenFile()
                          throws java.io.IOException

      Description copied from interface: `IFormatReader`
      Reopen any files that were closed, and which are expected to be open while the reader is open. This assumes that `IFormatHandler.setId(java.lang.String)` has been called, but close(false) has not been called.
      Specified by:
        `reopenFile` in interface `IFormatReader`
      Overrides:
        `reopenFile` in class `FormatReader`
      Throws:
        `java.io.IOException`

    - #### getImageFormat

          public LMSFileReader.ImageFormat getImageFormat()

      Description copied from class: `LMSFileReader`
      Returns the file format in which actual image bytes are stored
      Specified by:
        `getImageFormat` in class `LMSFileReader`

    - #### getReaderIndex

          private int getReaderIndex(int seriesIndex)

      Returns the index of the correct reader for the series index. Currently, tilescans are treated as if each tile was an own series (like in LIFReader), so one reader may contain multiple series.
      Parameters:
        `seriesIndex` - index of series
      Returns:
        reader which contains the series

    - #### getSeriesPerReaderIndex

          private int getSeriesPerReaderIndex(int series)

      Returns the index of the series (tile) in the corresponding reader
      Parameters:
        `series` - index of the series over all readers
      Returns:

    - #### openBytesJpeg

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

      Gets bytes of jpeg images. Originally monochrome images that were stored by LASX as 24bit (RGB) jpegs are transformed to monochrome again (upscaled to their original bit depth)
      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:
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### sortMultipleImagesReaders

          private void sortMultipleImagesReaders()
                                          throws FormatException

      Sorts frames of all MultipleImagesReaders as per core dimension sizes and order
      Throws:
        `FormatException`

    - #### setMetadataOfMultipleImagesReaders

          private void setMetadataOfMultipleImagesReaders()

    - #### transformBytes8To16

          private void transformBytes8To16(byte[] in,
                                           byte[] out,
                                           int outRes)

      Transforms an 8bit byte array to a 16bit byte array, optionally with bit upscaling (8-16bit)
      Parameters:
        `in` - 8bit buffer with data
        `out` - 16bit buffer to be filled
        `outRes` - resolution to which data shall be upscaled (8-16)

    - #### getRgbChannel

          private byte[] getRgbChannel(int channel,
                                       byte[] in)

      Returns single channel data for an rgb plane
      Parameters:
        `channel` - Index of channel that shall be read
        `in` - channel separated buffer

    - #### sum

          private int sum(int[] arr,
                          int start,
                          int end)

      Sums up all values of an array, from start index to (including) end index
      Parameters:
        `arr` -
        `start` - first array position whose value shall be added
        `end` - last array position whose value shall be added
      Returns:

    - #### sortPaths

          private void sortPaths(java.util.List<java.lang.String> paths)

      Sorts file paths by name and depth and moves current file path to the beginning
      Parameters:
        `paths` -

Copyright © 2026 Open Microscopy Environment