loci.formats.in

## Class NDPIReader

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatReader
    - - loci.formats.SubResolutionFormatReader
      - - loci.formats.in.MinimalTiffReader
        - - loci.formats.in.BaseTiffReader
          - - loci.formats.in.NDPIReader

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

      public class NDPIReader
      extends BaseTiffReader

  NDPIReader is the file format reader for Hamamatsu .ndpi files.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int` | `BLUE_MULTIPLIER`
    `private static int` | `BYTE_COUNT_HIGH_BYTES`
    `private static int` | `CAPTURE_MODE`
    `private static int` | `DEFAULT_GAMMA`
    `private static int` | `EXPOSURE_RATIO`
    `private static int` | `EXPOSURE_TIME`
    `private static int` | `FILTER_SET_NAME`
    `private static int` | `FIRMWARE_VERSION`
    `private static int` | `FOCUS_OFFSET`
    `private static int` | `FOCUS_POINT_REGIONS`
    `private static int` | `FOCUS_TIME`
    `private static int` | `FULLY_AUTO_FOCUS`
    `private static int` | `GREEN_MULTIPLIER`
    `private int` | `initializedPlane`
    `private int` | `initializedSeries`
    `private java.lang.String` | `instrumentModel`
    `private static int` | `JPEG_QUALITY`
    `private static int` | `LABEL_OBSCURED`
    `private static int` | `LAMP_AGE`
    `private java.lang.Double` | `magnification`
    `private static int` | `MARKER_TAG`
    `private static int` | `MARKER_TAG_HIGH_BYTES`
    `private static int` | `MAX_SIZE`
    `private static int` | `METADATA_TAG`
    `private static int` | `OFFSET_HIGH_BYTES`
    `private int` | `pyramidHeight`
    `private static int` | `RED_MULTIPLIER`
    `private static int` | `REFERENCE`
    `private static int` | `REFOCUS_INTERVAL`
    `private static int` | `SCAN_TIME`
    `private static int` | `SERIAL_NUMBER`
    `private java.lang.String` | `serialNumber`
    `private JPEGTurboService` | `service`
    `private int` | `sizeZ`
    `private static int` | `SOURCE_LENS`
    `private static int` | `THUMB_TAG_2`
    `private static int` | `TISSUE_INDEX`
    `private static int` | `VERSION`
    `private static int` | `WAVELENGTH`
    `private static int` | `WRITE_TIME`
    `private static int` | `X_POSITION`
    `private static int` | `Y_POSITION`
    `private static int` | `Z_POSITION`

    - ### Fields inherited from class loci.formats.in.BaseTiffReader

      `DATE_FORMATS, LOGGER`

    - ### Fields inherited from class loci.formats.in.MinimalTiffReader

      `canSeparateSeries, equalStrips, ifds, lastPlane, mergeSubIFDs, noSubresolutions, seriesToIFD, subResolutionIFDs, thumbnailIFDs, tiffParser, use64Bit`

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

      `core`

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

      `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, metadataOptions, suffixes`

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

      `CAN_GROUP, CANNOT_GROUP, MUST_GROUP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NDPIReader()` Constructs a new NDPI 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.
    `private int` | `getBitsPerSample(int mode)` Get the number of bits per sample associated with the given capture mode.
    `private java.lang.String` | `getCaptureMode(int mode)` Get the description of the given capture mode.
    `private int` | `getIFDIndex(int seriesIndex, int zIndex)`
    `private long[]` | `getMarkers(IFD ifd)` Get the array of restart markers (offsets) for the given IFD.
    `int` | `getOptimalTileHeight()` Returns the optimal sub-image height for use with openBytes.
    `int` | `getOptimalTileWidth()` Returns the optimal sub-image width for use with openBytes.
    `protected int` | `getPyramidHeight()`
    `Codec` | `getTileCodec(int no)` Retrieve a codec that can be used to decompress compressed tiles.
    `CodecOptions` | `getTileCodecOptions(int no, int x, int y)` Retrieve codec options that can be used to decompressed the specified tile.
    `int` | `getTileColumns(int no)` Get the number of columns of tiles in the specified plane in the current series.
    `int` | `getTileRows(int no)` Get the number of rows of tiles in the specified plane in the current series.
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `protected void` | `initMetadataStore()` Populates the metadata store using the data parsed in `BaseTiffReader.initStandardMetadata()` along with some further parsing done in the method itself.
    `protected void` | `initStandardMetadata()` Parses standard metadata.
    `boolean` | `isThisType(java.lang.String name, boolean open)` Checks if a file matches the type of this format reader.
    `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[]` | `openCompressedBytes(int no, byte[] buf, int x, int y)` Retrieve the specified tile without performing any decompression.
    `byte[]` | `openCompressedBytes(int no, int x, int y)` Retrieve the specified tile without performing any decompression.
    `byte[]` | `openThumbBytes(int no)` Obtains a thumbnail for the specified image plane from the current file, as a byte array.
    `private void` | `resetStream(IFD ifd)`
    `private boolean` | `useTiffParser(IFD ifd)`

    - ### Methods inherited from class loci.formats.in.BaseTiffReader

      `getExifTagName, getImageCreationDate, initMetadata, put, put, put, put, put, put, put, put, put, put, putDouble, putInt, putString`

    - ### Methods inherited from class loci.formats.in.MinimalTiffReader

      `copyTile, get16BitLookupTable, get8BitLookupTable, getCompressedByteCount, getIFDs, getThumbnailIFDs, getThumbSizeX, getThumbSizeY, getTileIndex, initTiffParser, isThisType, reopenFile, setResolutionLevel`

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

      `coreIndexToSeries, flattenHashtables, getCoreIndex, getCoreMetadataList, getCurrentCore, getResolution, getResolutionCount, getSeries, getSeriesCount, seriesToCoreIndex, setCoreIndex, setResolution, setSeries`

    - ### 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, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCorrection, 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, getRGBChannelCount, getRotationTransform, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, readPlane, readPlane, readPlane, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, 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`

- - ### Field Detail

    - #### MAX_SIZE

          private static final int MAX_SIZE

      See Also:
        Constant Field Values

    - #### OFFSET_HIGH_BYTES

          private static final int OFFSET_HIGH_BYTES

      See Also:
        Constant Field Values

    - #### BYTE_COUNT_HIGH_BYTES

          private static final int BYTE_COUNT_HIGH_BYTES

      See Also:
        Constant Field Values

    - #### VERSION

          private static final int VERSION

      See Also:
        Constant Field Values

    - #### SOURCE_LENS

          private static final int SOURCE_LENS

      See Also:
        Constant Field Values

    - #### X_POSITION

          private static final int X_POSITION

      See Also:
        Constant Field Values

    - #### Y_POSITION

          private static final int Y_POSITION

      See Also:
        Constant Field Values

    - #### Z_POSITION

          private static final int Z_POSITION

      See Also:
        Constant Field Values

    - #### TISSUE_INDEX

          private static final int TISSUE_INDEX

      See Also:
        Constant Field Values

    - #### MARKER_TAG

          private static final int MARKER_TAG

      See Also:
        Constant Field Values

    - #### REFERENCE

          private static final int REFERENCE

      See Also:
        Constant Field Values

    - #### MARKER_TAG_HIGH_BYTES

          private static final int MARKER_TAG_HIGH_BYTES

      See Also:
        Constant Field Values

    - #### FILTER_SET_NAME

          private static final int FILTER_SET_NAME

      See Also:
        Constant Field Values

    - #### EXPOSURE_RATIO

          private static final int EXPOSURE_RATIO

      See Also:
        Constant Field Values

    - #### RED_MULTIPLIER

          private static final int RED_MULTIPLIER

      See Also:
        Constant Field Values

    - #### GREEN_MULTIPLIER

          private static final int GREEN_MULTIPLIER

      See Also:
        Constant Field Values

    - #### BLUE_MULTIPLIER

          private static final int BLUE_MULTIPLIER

      See Also:
        Constant Field Values

    - #### THUMB_TAG_2

          private static final int THUMB_TAG_2

      See Also:
        Constant Field Values

    - #### FOCUS_POINT_REGIONS

          private static final int FOCUS_POINT_REGIONS

      See Also:
        Constant Field Values

    - #### CAPTURE_MODE

          private static final int CAPTURE_MODE

      See Also:
        Constant Field Values

    - #### SERIAL_NUMBER

          private static final int SERIAL_NUMBER

      See Also:
        Constant Field Values

    - #### JPEG_QUALITY

          private static final int JPEG_QUALITY

      See Also:
        Constant Field Values

    - #### REFOCUS_INTERVAL

          private static final int REFOCUS_INTERVAL

      See Also:
        Constant Field Values

    - #### FOCUS_OFFSET

          private static final int FOCUS_OFFSET

      See Also:
        Constant Field Values

    - #### FIRMWARE_VERSION

          private static final int FIRMWARE_VERSION

      See Also:
        Constant Field Values

    - #### METADATA_TAG

          private static final int METADATA_TAG

      See Also:
        Constant Field Values

    - #### LABEL_OBSCURED

          private static final int LABEL_OBSCURED

      See Also:
        Constant Field Values

    - #### WAVELENGTH

          private static final int WAVELENGTH

      See Also:
        Constant Field Values

    - #### LAMP_AGE

          private static final int LAMP_AGE

      See Also:
        Constant Field Values

    - #### EXPOSURE_TIME

          private static final int EXPOSURE_TIME

      See Also:
        Constant Field Values

    - #### FOCUS_TIME

          private static final int FOCUS_TIME

      See Also:
        Constant Field Values

    - #### SCAN_TIME

          private static final int SCAN_TIME

      See Also:
        Constant Field Values

    - #### WRITE_TIME

          private static final int WRITE_TIME

      See Also:
        Constant Field Values

    - #### FULLY_AUTO_FOCUS

          private static final int FULLY_AUTO_FOCUS

      See Also:
        Constant Field Values

    - #### DEFAULT_GAMMA

          private static final int DEFAULT_GAMMA

      See Also:
        Constant Field Values

    - #### initializedSeries

          private int initializedSeries

    - #### initializedPlane

          private int initializedPlane

    - #### sizeZ

          private int sizeZ

    - #### pyramidHeight

          private int pyramidHeight

    - #### service

          private JPEGTurboService service

    - #### magnification

          private java.lang.Double magnification

    - #### serialNumber

          private java.lang.String serialNumber

    - #### instrumentModel

          private java.lang.String instrumentModel

  - ### Constructor Detail

    - #### NDPIReader

          public NDPIReader()

      Constructs a new NDPI reader.

  - ### Method Detail

    - #### getTileRows

          public int getTileRows(int no)

      Description copied from interface: `ICompressedTileReader`
      Get the number of rows of tiles in the specified plane in the current series.
      Specified by:
        `getTileRows` in interface `ICompressedTileReader`
      Overrides:
        `getTileRows` in class `FormatReader`
      Parameters:
        `no` - plane index
      Returns:
        tile row count

    - #### getTileColumns

          public int getTileColumns(int no)

      Description copied from interface: `ICompressedTileReader`
      Get the number of columns of tiles in the specified plane in the current series.
      Specified by:
        `getTileColumns` in interface `ICompressedTileReader`
      Overrides:
        `getTileColumns` in class `FormatReader`
      Parameters:
        `no` - plane index
      Returns:
        tile column count

    - #### openCompressedBytes

          public byte[] openCompressedBytes(int no,
                                            int x,
                                            int y)
                                     throws FormatException,
                                            java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve the specified tile without performing any decompression.
      Parameters:
        `no` - plane index
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        compressed tile bytes
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### openCompressedBytes

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

      Description copied from interface: `ICompressedTileReader`
      Retrieve the specified tile without performing any decompression.
      Parameters:
        `no` - plane index
        `buf` - pre-allocated buffer in which to store compressed bytes
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        compressed tile bytes
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### getTileCodec

          public Codec getTileCodec(int no)
                             throws FormatException,
                                    java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve a codec that can be used to decompress compressed tiles.
      Parameters:
        `no` - plane index
      Returns:
        codec that can be used for compressed tiles in the specified plane
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `ICompressedTileReader.openCompressedBytes(int, int, int)`

    - #### getTileCodecOptions

          public CodecOptions getTileCodecOptions(int no,
                                                  int x,
                                                  int y)
                                           throws FormatException,
                                                  java.io.IOException

      Description copied from interface: `ICompressedTileReader`
      Retrieve codec options that can be used to decompressed the specified tile.
      Parameters:
        `no` - plane index
        `x` - tile X index (indexed from 0, @see getTileColumns(int))
        `y` - tile Y index (indexed from 0, @see getTileRows(int))
      Returns:
        codec options
      Throws:
        `FormatException`
        `java.io.IOException`
      See Also:
        `ICompressedTileReader.getTileCodec(int)`

    - #### isThisType

          public boolean isThisType(java.lang.String name,
                                    boolean open)

      Description copied from class: `FormatReader`
      Checks 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 with `FormatReader.isThisType(RandomAccessInputStream)`.
      Specified by:
        `isThisType` in interface `IFormatReader`
      Overrides:
        `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.

    - #### 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:
        `IFormatReader.fileGroupOption(String)`

    - #### 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`
      Overrides:
        `openBytes` in class `MinimalTiffReader`
      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)`

    - #### openThumbBytes

          public byte[] openThumbBytes(int no)
                                throws FormatException,
                                       java.io.IOException

      Description copied from interface: `IFormatReader`
      Obtains a thumbnail for the specified image plane from the current file, as a byte array.
      Specified by:
        `openThumbBytes` in interface `IFormatReader`
      Overrides:
        `openThumbBytes` in class `MinimalTiffReader`
      Throws:
        `FormatException`
        `java.io.IOException`

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

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

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

    - #### initFile

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

      Description copied from class: `SubResolutionFormatReader`
      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 `BaseTiffReader`
      Throws:
        `FormatException` - if a parsing error occurs processing the file.
        `java.io.IOException` - if an I/O error occurs processing the file

    - #### initStandardMetadata

          protected void initStandardMetadata()
                                       throws FormatException,
                                              java.io.IOException

      Description copied from class: `BaseTiffReader`
      Parses standard metadata. NOTE: Absolutely no calls to the metadata store should be made in this method or methods that override this method. Data will be overwritten if you do so.
      Overrides:
        `initStandardMetadata` in class `BaseTiffReader`
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### initMetadataStore

          protected void initMetadataStore()
                                    throws FormatException

      Description copied from class: `BaseTiffReader`
      Populates the metadata store using the data parsed in `BaseTiffReader.initStandardMetadata()` along with some further parsing done in the method itself. All calls to the active `MetadataStore` should be made in this method and only in this method. This is especially important for sub-classes that override the getters for pixel set array size, etc.
      Overrides:
        `initMetadataStore` in class `BaseTiffReader`
      Throws:
        `FormatException`

    - #### getPyramidHeight

          protected int getPyramidHeight()

    - #### getIFDIndex

          private int getIFDIndex(int seriesIndex,
                                  int zIndex)

    - #### useTiffParser

          private boolean useTiffParser(IFD ifd)
                                 throws FormatException

      Returns:
        true if tiles can be read using TiffParser logic, or false if the JPEGTurboService needs to be used
      Throws:
        `FormatException`

    - #### getCaptureMode

          private java.lang.String getCaptureMode(int mode)

      Get the description of the given capture mode.

    - #### getBitsPerSample

          private int getBitsPerSample(int mode)

      Get the number of bits per sample associated with the given capture mode.

    - #### getMarkers

          private long[] getMarkers(IFD ifd)
                             throws FormatException

      Get the array of restart markers (offsets) for the given IFD. Reads both the marker tag and marker high bytes tag (if present) to build the array of 64-bit offsets.
      Throws:
        `FormatException`

    - #### resetStream

          private void resetStream(IFD ifd)
                            throws java.io.IOException,
                                   FormatException

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

Copyright © 2026 Open Microscopy Environment