loci.formats.in

## Class QTReader

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

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

      public class QTReader
      extends FormatReader

  QTReader is the file format reader for QuickTime movie files. It does not require any external libraries to be installed. Video codecs currently supported: raw, rle, jpeg, mjpb, rpza. Additional video codecs will be added as time permits.
  Author:
    Melissa Linkert melissa at glencoesoftware.com

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.lang.String` | `altCodec` Some movies use two video codecs -- this is the second codec.
    `private int` | `altPlanes` Number of frames that use the alternate codec.
    `private int` | `bitsPerPixel` Pixel depth.
    `private boolean` | `canUsePrevious` Flag indicating whether we can safely use prevPixels.
    `private java.util.Vector<java.lang.Integer>` | `chunkSizes` Number of bytes in each plane.
    `private java.lang.String` | `codec` Video codec used by this movie.
    `private static java.lang.String[]` | `CONTAINER_TYPES` List of identifiers for each container atom.
    `private boolean` | `flip`
    `private java.lang.String` | `forkFile`
    `private boolean` | `interlaced` Set to true if the scanlines in a plane are interlaced (mjpb only).
    `private java.util.Vector<java.lang.Integer>` | `offsets` Offsets to each plane's pixel data.
    `private long` | `pixelBytes` Total number of bytes of pixel data.
    `private long` | `pixelOffset` Offset to start of pixel data.
    `private byte[]` | `prevPixels` Pixel data for the previous image plane.
    `private int` | `prevPlane` Previous plane number.
    `private int` | `rawSize` Raw plane size, in bytes.
    `private int` | `scale` Amount to subtract from each offset.
    `private boolean` | `separatedFork` Flag indicating whether the resource and data fork are separated.

    - ### 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
    `QTReader()` Constructs a new QuickTime reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(boolean fileOnly)` Closes the currently open file.
    `java.lang.String[]` | `getSeriesUsedFiles(boolean noPixels)` Returns an array of filenames needed to open the current series.
    `protected void` | `initFile(java.lang.String id)` Initializes the given file (parsing header information, etc.).
    `private boolean` | `isContainer(java.lang.String type)` Checks if the given String is a container atom type.
    `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` | `parse(int depth, long offset, long length)` Parse all of the atoms in the file.
    `private void` | `print(int depth, long size, java.lang.String type)` Debugging method; prints information on an atom.
    `private void` | `stripHeader()` Cut off header bytes from a resource fork file.
    `private byte[]` | `uncompress(byte[] pixs, java.lang.String code)` Uncompresses an image plane according to the the codec identifier.

    - ### 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, 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, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, 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

    - #### CONTAINER_TYPES

          private static final java.lang.String[] CONTAINER_TYPES

      List of identifiers for each container atom.

    - #### pixelOffset

          private long pixelOffset

      Offset to start of pixel data.

    - #### pixelBytes

          private long pixelBytes

      Total number of bytes of pixel data.

    - #### bitsPerPixel

          private int bitsPerPixel

      Pixel depth.

    - #### rawSize

          private int rawSize

      Raw plane size, in bytes.

    - #### offsets

          private java.util.Vector<java.lang.Integer> offsets

      Offsets to each plane's pixel data.

    - #### prevPixels

          private byte[] prevPixels

      Pixel data for the previous image plane.

    - #### prevPlane

          private int prevPlane

      Previous plane number.

    - #### canUsePrevious

          private boolean canUsePrevious

      Flag indicating whether we can safely use prevPixels.

    - #### codec

          private java.lang.String codec

      Video codec used by this movie.

    - #### altCodec

          private java.lang.String altCodec

      Some movies use two video codecs -- this is the second codec.

    - #### altPlanes

          private int altPlanes

      Number of frames that use the alternate codec.

    - #### scale

          private int scale

      Amount to subtract from each offset.

    - #### chunkSizes

          private java.util.Vector<java.lang.Integer> chunkSizes

      Number of bytes in each plane.

    - #### interlaced

          private boolean interlaced

      Set to true if the scanlines in a plane are interlaced (mjpb only).

    - #### separatedFork

          private boolean separatedFork

      Flag indicating whether the resource and data fork are separated.

    - #### forkFile

          private java.lang.String forkFile

    - #### flip

          private boolean flip

  - ### Constructor Detail

    - #### QTReader

          public QTReader()

      Constructs a new QuickTime reader.

  - ### Method Detail

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

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

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

    - #### parse

          private void parse(int depth,
                             long offset,
                             long length)
                      throws FormatException,
                             java.io.IOException

      Parse all of the atoms in the file.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### isContainer

          private boolean isContainer(java.lang.String type)

      Checks if the given String is a container atom type.

    - #### print

          private void print(int depth,
                             long size,
                             java.lang.String type)

      Debugging method; prints information on an atom.

    - #### uncompress

          private byte[] uncompress(byte[] pixs,
                                    java.lang.String code)
                             throws FormatException,
                                    java.io.IOException

      Uncompresses an image plane according to the the codec identifier.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### stripHeader

          private void stripHeader()
                            throws java.io.IOException

      Cut off header bytes from a resource fork file.
      Throws:
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment