loci.formats.out

## Class QTWriter

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatWriter
    - - loci.formats.out.QTWriter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler

      public class QTWriter
      extends FormatWriter

  QTWriter is the file format writer for uncompressed QuickTime movie files.
  Author:
    Melissa Linkert melissa at glencoesoftware.com

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static long` | `BYTE_COUNT_OFFSET` Seek to this offset to update the total number of pixel bytes.
    `protected int` | `codec` The codec to use.
    `static int` | `CODEC_ANIMATION` Value indicating Animation codec.
    `static int` | `CODEC_CINEPAK` Value indicating Cinepak codec.
    `static int` | `CODEC_H_263` Value indicating H.263 codec.
    `static int` | `CODEC_MOTION_JPEG_B` Value indicating Motion JPEG-B codec.
    `static int` | `CODEC_MPEG_4` Value indicating MPEG-4 codec.
    `static int` | `CODEC_RAW` Value indicating Raw codec.
    `static int` | `CODEC_SORENSON` Value indicating Sorenson codec.
    `static int` | `CODEC_SORENSON_3` Value indicating Sorenson 3 codec.
    `protected int` | `created` Time the file was created.
    `protected int` | `numBytes` Total number of pixel bytes.
    `private int` | `numWritten`
    `protected java.util.List<java.lang.Integer>` | `offsets` Vector of plane offsets.
    `protected int` | `pad` Number of padding bytes in each row.
    `protected int` | `quality` The quality to use.
    `static int` | `QUALITY_HIGH` Value indicating High quality.
    `static int` | `QUALITY_LOW` Value indicating Low quality.
    `static int` | `QUALITY_MAXIMUM` Value indicating Maximum quality.
    `static int` | `QUALITY_NORMAL` Value indicating Normal quality.

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

      `cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBits`

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

      `COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QTWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canDoStacks()` Reports whether the writer can save multiple images to a single file.
    `void` | `close()`
    `int[]` | `getPixelTypes(java.lang.String codec)` Gets the supported pixel types for the given codec.
    `void` | `saveBytes(int no, byte[] buf, int x, int y, int w, int h)` Saves the given image tile to the current series in the current file.
    `private void` | `setCodec()`
    `void` | `setCodec(int codec)` Sets the encoded movie's codec.
    `void` | `setId(java.lang.String id)` Initializes a writer from the input file name.
    `void` | `setQuality(int quality)` Sets the quality of the encoded movie.
    `private void` | `writeAtom(int length, java.lang.String type)` Write the atom length and type.
    `private void` | `writeFooter()`
    `private void` | `writeRotationMatrix()` Write the 3x3 matrix that describes how to rotate the image.

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

      `changeOutputFile, checkParams, createOutputStream, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFramesPerSecond, getMetadataRetrieve, getPixelTypes, getPlaneCount, getPlaneCount, getResolution, getResolutionCount, getResolutions, getSamplesPerPixel, getSamplesPerPixel, getSeries, getSizeX, getSizeY, getTileSizeX, getTileSizeY, hasResolutions, isFullPlane, isInterleaved, isSupportedType, saveBytes, saveBytes, savePlane, savePlane, savePlane, seekToPlaneOffset, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setInterleaved, setMetadataRetrieve, setResolution, setResolutions, setSeries, setTileSizeX, setTileSizeY, setValidBitsPerPixel, setWriteSequentially`

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

      `checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, 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, isThisType`

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

      `getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions`

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

      `getCodec, saveCompressedBytes`

- - ### Field Detail

    - #### CODEC_MOTION_JPEG_B

          public static final int CODEC_MOTION_JPEG_B

      Value indicating Motion JPEG-B codec.
      See Also:
        Constant Field Values

    - #### CODEC_CINEPAK

          public static final int CODEC_CINEPAK

      Value indicating Cinepak codec.
      See Also:
        Constant Field Values

    - #### CODEC_ANIMATION

          public static final int CODEC_ANIMATION

      Value indicating Animation codec.
      See Also:
        Constant Field Values

    - #### CODEC_H_263

          public static final int CODEC_H_263

      Value indicating H.263 codec.
      See Also:
        Constant Field Values

    - #### CODEC_SORENSON

          public static final int CODEC_SORENSON

      Value indicating Sorenson codec.
      See Also:
        Constant Field Values

    - #### CODEC_SORENSON_3

          public static final int CODEC_SORENSON_3

      Value indicating Sorenson 3 codec.
      See Also:
        Constant Field Values

    - #### CODEC_MPEG_4

          public static final int CODEC_MPEG_4

      Value indicating MPEG-4 codec.
      See Also:
        Constant Field Values

    - #### CODEC_RAW

          public static final int CODEC_RAW

      Value indicating Raw codec.
      See Also:
        Constant Field Values

    - #### QUALITY_LOW

          public static final int QUALITY_LOW

      Value indicating Low quality.
      See Also:
        Constant Field Values

    - #### QUALITY_NORMAL

          public static final int QUALITY_NORMAL

      Value indicating Normal quality.
      See Also:
        Constant Field Values

    - #### QUALITY_HIGH

          public static final int QUALITY_HIGH

      Value indicating High quality.
      See Also:
        Constant Field Values

    - #### QUALITY_MAXIMUM

          public static final int QUALITY_MAXIMUM

      Value indicating Maximum quality.
      See Also:
        Constant Field Values

    - #### BYTE_COUNT_OFFSET

          private static final long BYTE_COUNT_OFFSET

      Seek to this offset to update the total number of pixel bytes.
      See Also:
        Constant Field Values

    - #### codec

          protected int codec

      The codec to use.

    - #### quality

          protected int quality

      The quality to use.

    - #### numBytes

          protected int numBytes

      Total number of pixel bytes.

    - #### offsets

          protected java.util.List<java.lang.Integer> offsets

      Vector of plane offsets.

    - #### created

          protected int created

      Time the file was created.

    - #### pad

          protected int pad

      Number of padding bytes in each row.

    - #### numWritten

          private int numWritten

  - ### Constructor Detail

    - #### QTWriter

          public QTWriter()

  - ### Method Detail

    - #### setCodec

          public void setCodec(int codec)

      Sets the encoded movie's codec.
      Parameters:
        `codec` - Codec value:
        - QTWriterCODEC_CINEPAK
        - QTWriter.CODEC_ANIMATION
        - QTWriter.CODEC_H_263
        - QTWriter.CODEC_SORENSON
        - QTWriter.CODEC_SORENSON_3
        - QTWriter.CODEC_MPEG_4
        - QTWriter.CODEC_RAW

    - #### setQuality

          public void setQuality(int quality)

      Sets the quality of the encoded movie.
      Parameters:
        `quality` - Quality value:
        - QTWriter.QUALITY_LOW
        - QTWriter.QUALITY_MEDIUM
        - QTWriter.QUALITY_HIGH
        - QTWriter.QUALITY_MAXIMUM

    - #### saveBytes

          public void saveBytes(int no,
                                byte[] buf,
                                int x,
                                int y,
                                int w,
                                int h)
                         throws FormatException,
                                java.io.IOException

      Description copied from interface: `IFormatWriter`
      Saves the given image tile to the current series in the current file.
      Parameters:
        `no` - the plane index within the series.
        `buf` - the byte array that represents the image tile.
        `x` - the X coordinate of the upper-left corner of the image tile.
        `y` - the Y coordinate of the upper-left corner of the image tile.
        `w` - the width (in pixels) of the image tile.
        `h` - the height (in pixels) of the image tile.
      Throws:
        `FormatException` - if one of the parameters is invalid.
        `java.io.IOException` - if there was a problem writing to the file.
      See Also:
        `IFormatWriter.saveBytes(int, byte[], int, int, int, int)`

    - #### canDoStacks

          public boolean canDoStacks()

      Description copied from interface: `IFormatWriter`
      Reports whether the writer can save multiple images to a single file.
      Specified by:
        `canDoStacks` in interface `IFormatWriter`
      Overrides:
        `canDoStacks` in class `FormatWriter`

    - #### getPixelTypes

          public int[] getPixelTypes(java.lang.String codec)

      Description copied from interface: `IFormatWriter`
      Gets the supported pixel types for the given codec.
      Specified by:
        `getPixelTypes` in interface `IFormatWriter`
      Overrides:
        `getPixelTypes` in class `FormatWriter`

    - #### setId

          public void setId(java.lang.String id)
                     throws FormatException,
                            java.io.IOException

      Description copied from class: `FormatWriter`
      Initializes a writer from the input file name. Initializes a `RandomAccessOutputStream` for the output file and initializes the metadata for all the series using `FormatWriter.setSeries(int)`.
      Specified by:
        `setId` in interface `IFormatHandler`
      Overrides:
        `setId` in class `FormatWriter`
      Parameters:
        `id` - a `String` specifying the path to the file
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `FormatWriter`
      Throws:
        `java.io.IOException`

    - #### setCodec

          private void setCodec()

    - #### writeFooter

          private void writeFooter()
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeRotationMatrix

          private void writeRotationMatrix()
                                    throws java.io.IOException

      Write the 3x3 matrix that describes how to rotate the image.
      Throws:
        `java.io.IOException`

    - #### writeAtom

          private void writeAtom(int length,
                                 java.lang.String type)
                          throws java.io.IOException

      Write the atom length and type.
      Throws:
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment