loci.formats.in

## Class PictReader

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

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

      public class PictReader
      extends FormatReader

  PictReader is the file format reader for Apple PICT files. Most of this code was adapted from the PICT readers in JIMI (http://java.sun.com/products/jimi/index.html), ImageMagick (http://www.imagemagick.org), and Java QuickDraw.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static byte[]` | `EXPANSION_TABLE` Table used in expanding pixels that use less than 8 bits.
    `private java.util.Vector<java.lang.Long>` | `jpegOffsets`
    `protected byte[][]` | `lookup` Color lookup table for palette color images.
    `private static int` | `PICT_9A`
    `private static int` | `PICT_BITSRECT`
    `private static int` | `PICT_BITSRGN`
    `private static int` | `PICT_CLIP_RGN`
    `private static int` | `PICT_END`
    `private static int` | `PICT_JPEG`
    `private static int` | `PICT_LONGCOMMENT`
    `private static int` | `PICT_PACKBITSRECT`
    `private static int` | `PICT_PACKBITSRGN`
    `private static int` | `PICT_TYPE_1`
    `private static int` | `PICT_TYPE_2`
    `protected int` | `rowBytes` Number of bytes in a row of pixel data (variable).
    `protected java.util.Vector` | `strips` Vector of byte arrays representing individual rows.
    `protected boolean` | `versionOne` Whether or not the file is PICT v1.

    - ### 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
    `PictReader()` Constructs a new PICT 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 boolean` | `drivePictDecoder(int opcode)` Handles the opcodes in the PICT file.
    `private void` | `expandPixels(int bitSize, byte[] ib, byte[] ob, int outLen)` Expand an array of bytes.
    `byte[][]` | `get8BitLookupTable()` Gets the 8-bit color lookup table associated with the most recently opened image.
    `private void` | `handleBitmap(int opcode)` Extract the image data in a PICT bitmap structure.
    `private void` | `handlePixmap(int opcode)` Extracts the image data in a PICT pixmap structure.
    `private void` | `handlePixmap(int pixelSize, int compCount)` Handles the unpacking of the image data.
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `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` | `readImageHeader(int opcode)`
    `private void` | `unpackBits(byte[] ib, int[] ob)` PackBits variant that outputs an int array.

    - ### 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, fileGroupOption, flattenHashtables, get16BitLookupTable, 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, 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

    - #### PICT_CLIP_RGN

          private static final int PICT_CLIP_RGN

      See Also:
        Constant Field Values

    - #### PICT_BITSRECT

          private static final int PICT_BITSRECT

      See Also:
        Constant Field Values

    - #### PICT_BITSRGN

          private static final int PICT_BITSRGN

      See Also:
        Constant Field Values

    - #### PICT_PACKBITSRECT

          private static final int PICT_PACKBITSRECT

      See Also:
        Constant Field Values

    - #### PICT_PACKBITSRGN

          private static final int PICT_PACKBITSRGN

      See Also:
        Constant Field Values

    - #### PICT_9A

          private static final int PICT_9A

      See Also:
        Constant Field Values

    - #### PICT_END

          private static final int PICT_END

      See Also:
        Constant Field Values

    - #### PICT_LONGCOMMENT

          private static final int PICT_LONGCOMMENT

      See Also:
        Constant Field Values

    - #### PICT_JPEG

          private static final int PICT_JPEG

      See Also:
        Constant Field Values

    - #### PICT_TYPE_1

          private static final int PICT_TYPE_1

      See Also:
        Constant Field Values

    - #### PICT_TYPE_2

          private static final int PICT_TYPE_2

      See Also:
        Constant Field Values

    - #### EXPANSION_TABLE

          private static final byte[] EXPANSION_TABLE

      Table used in expanding pixels that use less than 8 bits.

    - #### rowBytes

          protected int rowBytes

      Number of bytes in a row of pixel data (variable).

    - #### strips

          protected java.util.Vector strips

      Vector of byte arrays representing individual rows.

    - #### versionOne

          protected boolean versionOne

      Whether or not the file is PICT v1.

    - #### lookup

          protected byte[][] lookup

      Color lookup table for palette color images.

    - #### jpegOffsets

          private java.util.Vector<java.lang.Long> jpegOffsets

  - ### Constructor Detail

    - #### PictReader

          public PictReader()

      Constructs a new PICT reader.

  - ### Method Detail

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

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

    - #### drivePictDecoder

          private boolean drivePictDecoder(int opcode)
                                    throws FormatException,
                                           java.io.IOException

      Handles the opcodes in the PICT file.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### readImageHeader

          private void readImageHeader(int opcode)
                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### handleBitmap

          private void handleBitmap(int opcode)
                             throws FormatException,
                                    java.io.IOException

      Extract the image data in a PICT bitmap structure.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### handlePixmap

          private void handlePixmap(int opcode)
                             throws FormatException,
                                    java.io.IOException

      Extracts the image data in a PICT pixmap structure.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### handlePixmap

          private void handlePixmap(int pixelSize,
                                    int compCount)
                             throws FormatException,
                                    java.io.IOException

      Handles the unpacking of the image data.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### expandPixels

          private void expandPixels(int bitSize,
                                    byte[] ib,
                                    byte[] ob,
                                    int outLen)
                             throws FormatException

      Expand an array of bytes.
      Throws:
        `FormatException`

    - #### unpackBits

          private void unpackBits(byte[] ib,
                                  int[] ob)

      PackBits variant that outputs an int array.

Copyright © 2026 Open Microscopy Environment