loci.formats.in

## Class NikonReader

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

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

      public class NikonReader
      extends BaseTiffReader

  NikonReader is the file format reader for Nikon NEF (TIFF) files.
  Author:
    Melissa Linkert melissa at glencoesoftware.com

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int` | `CAPTURE_EDITOR_DATA`
    `private java.lang.Object` | `cfaPattern`
    `private static int` | `COLOR_MAP`
    `private static int` | `COLOR_MODE`
    `private int[]` | `curve`
    `private static int` | `CURVE`
    `private static int` | `FIRMWARE_VERSION`
    `private static int` | `FLASH_COMPENSATION`
    `private static int` | `FLASH_MODE`
    `private static int` | `FLASH_SETTING`
    `private static int` | `FLASH_USED`
    `private static int` | `FOCUS_MODE`
    `private static int` | `HUE`
    `private static int` | `ISO`
    `private int` | `lastIndex`
    `private byte[]` | `lastPlane`
    `private static int` | `LENS`
    `private static int` | `LENS_TYPE`
    `private static int` | `LIGHT_TYPE`
    `private static org.slf4j.Logger` | `LOGGER` Logger for this class.
    `private boolean` | `lossyCompression`
    `private static int` | `MAKER_WHITE_BALANCE`
    `protected int` | `makerNoteOffset` Offset to the Nikon Maker Note.
    `static java.lang.String[]` | `NEF_SUFFIX`
    `protected IFD` | `original` The original IFD.
    `private static int` | `QUALITY`
    `private static int` | `SHARPENING`
    `private int` | `split`
    `private static int` | `TIFF_EPS_STANDARD`
    `private static int` | `TONE_COMPENSATION`
    `private int[]` | `vPredictor`
    `private static int` | `WHITE_BALANCE_FINE`
    `private static int` | `WHITE_BALANCE_RGB_COEFFS`
    `private TiffRational[]` | `whiteBalance`

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

      `DATE_FORMATS`

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

      `canSeparateSeries, equalStrips, ifds, 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
    `NikonReader()` Constructs a new Nikon reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private short` | `adjustForWhiteBalance(short val, int index)`
    `void` | `close(boolean fileOnly)` Closes the currently open file.
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `protected void` | `initStandardMetadata()` Parses standard metadata.
    `boolean` | `isThisType(loci.common.RandomAccessInputStream stream)` Checks if the given stream is a valid stream for this file format.
    `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.

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

      `getExifTagName, getImageCreationDate, initMetadata, initMetadataStore, 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, getOptimalTileHeight, getOptimalTileWidth, getThumbnailIFDs, getThumbSizeX, getThumbSizeY, getTileIndex, initTiffParser, openThumbBytes, 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, fileGroupOption, 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, getTileColumns, getTileRows, 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`

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

      `getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytes`

- - ### Field Detail

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      Logger for this class.

    - #### NEF_SUFFIX

          public static final java.lang.String[] NEF_SUFFIX

    - #### TIFF_EPS_STANDARD

          private static final int TIFF_EPS_STANDARD

      See Also:
        Constant Field Values

    - #### COLOR_MAP

          private static final int COLOR_MAP

      See Also:
        Constant Field Values

    - #### FIRMWARE_VERSION

          private static final int FIRMWARE_VERSION

      See Also:
        Constant Field Values

    - #### ISO

          private static final int ISO

      See Also:
        Constant Field Values

    - #### QUALITY

          private static final int QUALITY

      See Also:
        Constant Field Values

    - #### MAKER_WHITE_BALANCE

          private static final int MAKER_WHITE_BALANCE

      See Also:
        Constant Field Values

    - #### SHARPENING

          private static final int SHARPENING

      See Also:
        Constant Field Values

    - #### FOCUS_MODE

          private static final int FOCUS_MODE

      See Also:
        Constant Field Values

    - #### FLASH_SETTING

          private static final int FLASH_SETTING

      See Also:
        Constant Field Values

    - #### FLASH_MODE

          private static final int FLASH_MODE

      See Also:
        Constant Field Values

    - #### WHITE_BALANCE_FINE

          private static final int WHITE_BALANCE_FINE

      See Also:
        Constant Field Values

    - #### WHITE_BALANCE_RGB_COEFFS

          private static final int WHITE_BALANCE_RGB_COEFFS

      See Also:
        Constant Field Values

    - #### FLASH_COMPENSATION

          private static final int FLASH_COMPENSATION

      See Also:
        Constant Field Values

    - #### TONE_COMPENSATION

          private static final int TONE_COMPENSATION

      See Also:
        Constant Field Values

    - #### LENS_TYPE

          private static final int LENS_TYPE

      See Also:
        Constant Field Values

    - #### LENS

          private static final int LENS

      See Also:
        Constant Field Values

    - #### FLASH_USED

          private static final int FLASH_USED

      See Also:
        Constant Field Values

    - #### CURVE

          private static final int CURVE

      See Also:
        Constant Field Values

    - #### COLOR_MODE

          private static final int COLOR_MODE

      See Also:
        Constant Field Values

    - #### LIGHT_TYPE

          private static final int LIGHT_TYPE

      See Also:
        Constant Field Values

    - #### HUE

          private static final int HUE

      See Also:
        Constant Field Values

    - #### CAPTURE_EDITOR_DATA

          private static final int CAPTURE_EDITOR_DATA

      See Also:
        Constant Field Values

    - #### makerNoteOffset

          protected int makerNoteOffset

      Offset to the Nikon Maker Note.

    - #### original

          protected IFD original

      The original IFD.

    - #### whiteBalance

          private TiffRational[] whiteBalance

    - #### cfaPattern

          private java.lang.Object cfaPattern

    - #### curve

          private int[] curve

    - #### vPredictor

          private int[] vPredictor

    - #### lossyCompression

          private boolean lossyCompression

    - #### split

          private int split

    - #### lastPlane

          private byte[] lastPlane

    - #### lastIndex

          private int lastIndex

  - ### Constructor Detail

    - #### NikonReader

          public NikonReader()

      Constructs a new Nikon reader.

  - ### Method Detail

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

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

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

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

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

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

    - #### adjustForWhiteBalance

          private short adjustForWhiteBalance(short val,
                                              int index)

Copyright © 2026 Open Microscopy Environment