loci.formats
Class LegacyQTReader

java.lang.Object
  extended byloci.formats.FormatHandler
      extended byloci.formats.FormatReader
          extended byloci.formats.LegacyQTReader

public class LegacyQTReader
extends FormatReader

LegacyQTReader is the old file format reader for QuickTime movie files. To use it, QuickTime for Java must be installed. Much of this reader's code was adapted from Wayne Rasband's QuickTime Movie Opener plugin for ImageJ (available at http://rsb.info.nih.gov/ij/). TODO -- address efficiency issues; currently 200-550ms are required to process each plane, with an additional 2500+ ms of overhead


Field Summary
static String EXPIRED_QT_MSG
           
protected  boolean expiredQT
          Flag indicating QuickTime for Java has expired.
protected  Image image
          Image containing current frame.
protected  boolean initialized
          Flag indicating this reader has been initialized.
protected static ClassLoader LOADER
          This custom class loader searches additional paths for the QTJava.zip library.
protected static boolean MAC_OS_X
           
protected  boolean needsRedrawing
          Flag indicating QuickTime frame needs to be redrawn.
static String NO_QT_MSG
           
protected  boolean noQT
          Flag indicating QuickTime for Java is not installed.
protected  int numImages
          Number of images in current QuickTime movie.
protected  ReflectedUniverse r
          Reflection tool for QuickTime for Java calls.
protected static String[] SUFFIXES
           
protected  int timeStep
          Time increment between frames.
 
Fields inherited from class loci.formats.FormatReader
DEBUG, DEBUG_LEVEL, metadata, ome
 
Fields inherited from class loci.formats.FormatHandler
chooser, currentId, filters, format, suffixes
 
Constructor Summary
LegacyQTReader()
          Constructs a new QT reader.
 
Method Summary
 boolean canDoQT()
          Whether QuickTime is available to this JVM.
 void close()
          Closes any open files.
protected static ClassLoader constructLoader()
           
 int getImageCount(String id)
          Determines the number of images in the given QuickTime file.
 Dimension getPictDimensions(byte[] bytes)
          Gets width and height for the given PICT bytes.
 ReflectedUniverse getUniverse()
          Gets QuickTime for Java reflected universe.
protected  void initFile(String id)
          Initializes the given QuickTime file.
protected  void initReader()
          Initializes the QuickTime reader.
 boolean isQTExpired()
          Whether QuickTime for Java has expired.
 boolean isThisType(byte[] block)
          Checks if the given block is a valid header for a QuickTime file.
static void main(String[] args)
           
 BufferedImage open(String id, int no)
          Obtains the specified image from the given QuickTime file.
 Image pictToImage(byte[] bytes)
          Converts the given byte array in PICT format to a Java image.
 
Methods inherited from class loci.formats.FormatReader
createFilters, getMetadata, getMetadataValue, getOMENode, open, testRead
 
Methods inherited from class loci.formats.FormatHandler
getFileChooser, getFileFilters, getFormat, getSuffixes, isThisType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_QT_MSG

public static final String NO_QT_MSG
See Also:
Constant Field Values

EXPIRED_QT_MSG

public static final String EXPIRED_QT_MSG
See Also:
Constant Field Values

SUFFIXES

protected static final String[] SUFFIXES

MAC_OS_X

protected static final boolean MAC_OS_X

LOADER

protected static final ClassLoader LOADER
This custom class loader searches additional paths for the QTJava.zip library. Java has a restriction where only one class loader can have a native library loaded within a JVM. So the class loader must be static, shared by all QTForms, or else an UnsatisfiedLinkError is thrown when attempting to initialize QTJava within multiple QTForms.


initialized

protected boolean initialized
Flag indicating this reader has been initialized.


noQT

protected boolean noQT
Flag indicating QuickTime for Java is not installed.


expiredQT

protected boolean expiredQT
Flag indicating QuickTime for Java has expired.


r

protected ReflectedUniverse r
Reflection tool for QuickTime for Java calls.


numImages

protected int numImages
Number of images in current QuickTime movie.


timeStep

protected int timeStep
Time increment between frames.


needsRedrawing

protected boolean needsRedrawing
Flag indicating QuickTime frame needs to be redrawn.


image

protected Image image
Image containing current frame.

Constructor Detail

LegacyQTReader

public LegacyQTReader()
Constructs a new QT reader.

Method Detail

constructLoader

protected static ClassLoader constructLoader()

initReader

protected void initReader()
Initializes the QuickTime reader.


canDoQT

public boolean canDoQT()
Whether QuickTime is available to this JVM.


isQTExpired

public boolean isQTExpired()
Whether QuickTime for Java has expired.


getUniverse

public ReflectedUniverse getUniverse()
Gets QuickTime for Java reflected universe.


getPictDimensions

public Dimension getPictDimensions(byte[] bytes)
                            throws FormatException,
                                   ReflectException
Gets width and height for the given PICT bytes.

Throws:
FormatException
ReflectException

pictToImage

public Image pictToImage(byte[] bytes)
                  throws FormatException
Converts the given byte array in PICT format to a Java image.

Throws:
FormatException

isThisType

public boolean isThisType(byte[] block)
Checks if the given block is a valid header for a QuickTime file.

Specified by:
isThisType in class FormatReader

getImageCount

public int getImageCount(String id)
                  throws FormatException,
                         IOException
Determines the number of images in the given QuickTime file.

Specified by:
getImageCount in class FormatReader
Throws:
FormatException
IOException

open

public BufferedImage open(String id,
                          int no)
                   throws FormatException,
                          IOException
Obtains the specified image from the given QuickTime file.

Specified by:
open in class FormatReader
Throws:
FormatException
IOException

close

public void close()
           throws FormatException,
                  IOException
Closes any open files.

Specified by:
close in class FormatReader
Throws:
FormatException
IOException

initFile

protected void initFile(String id)
                 throws FormatException,
                        IOException
Initializes the given QuickTime file.

Overrides:
initFile in class FormatReader
Throws:
FormatException
IOException

main

public static void main(String[] args)
                 throws FormatException,
                        IOException
Throws:
FormatException
IOException