Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.astro.louisville.edu/software/astroimagej/imagej/api/ij/plugin/AVI_Reader.html
Дата изменения: Thu Dec 2 23:03:11 2010
Дата индексирования: Mon Oct 1 22:13:21 2012
Кодировка:

Поисковые слова: http astro.uni-altai.ru pub article.html id 1542
AVI_Reader (ImageJ API)

ij.plugin
Class AVI_Reader

java.lang.Object
  extended by ij.ImageStack
      extended by ij.VirtualStack
          extended by ij.plugin.AVI_Reader
All Implemented Interfaces:
PlugIn

public class AVI_Reader
extends VirtualStack
implements PlugIn

 ImageJ Plugin for reading an AVI file into an image stack
  (one slice per video frame)
 
  Version 2008-07-03 by Michael Schmid, based on a plugin by
  Daniel Marsh and Wayne Rasband

 Restrictions and Notes:
      - Only few formats supported:
          - uncompressed 8 bit with palette (=LUT)
          - uncompressed 8 & 16 bit grayscale
          - uncompressed 24 & 32 bit RGB (alpha channel ignored)
          - uncompressed 32 bit AYUV (alpha channel ignored)
          - various YUV 4:2:2 compressed formats
          - png or jpeg-encoded individual frames.
            Note that most MJPG (motion-JPEG) formats are not read correctly.
      - Does not read avi formats with more than one frame per chunk
      - Palette changes during the video not supported
      - Out-of-sequence frames (sequence given by index) not supported
      - Different frame sizes in one file (rcFrame) not supported
      - Conversion of (A)YUV formats to grayscale is non-standard:
        All 255 levels are kept as in the input (i.e. the full dynamic
        range of data from a frame grabber is preserved).
        For standard behavior, use "Brightness&Contrast", Press "Set",
        enter "Min." 16, "Max." 235, and press "Apply".
 Version History:
   2008-07-03
      - Support for 16bit AVIs coded by MIL (Matrox Imaging Library)
   2008-06-08
      - Support for png and jpeg/mjpg encoded files added
      - Retrieves animation speed from image frame rate
      - Exception handling without multiple error messages
   2008-04-29
      - Support for several other formats added, especially some YUV
        (also named YCbCr) formats
      - Uneven chunk sizes fixed
      - Negative biHeight fixed  
      - Audio or second video stream don't cause a problem
      - Can read part of a file (specify start & end frame numbers)
      - Can convert YUV and RGB to grayscale (does not convert 8-bit with palette)
      - Can flip vertically
      - Can create a virtual stack
      - Added slice label: time of the frame in the movie
      - Added a public method 'getStack' that does not create an image window
      - More compact code, especially for reading the header (rewritten)
      - In the code, bitmapinfo items have their canonical names

 The AVI format looks like this:
 RIFF                     RIFF HEADER
 |-AVI                    AVI CHUNK  
   |LIST hdrl             MAIN AVI HEADER
   | |-avih               AVI HEADER
   | |LIST strl           STREAM LIST(s) (One per stream)
   | | |-strh             STREAM HEADER (Required after above; fourcc type is 'vids' for video stream)
   | | |-strf             STREAM FORMAT (for video: BitMapInfo; may also contain palette)
   | | |-strd             OPTIONAL -- STREAM DATA (ignored in this plugin)
   | | |-strn             OPTIONAL -- STREAM NAME (ignored in this plugin)
   |LIST movi             MOVIE DATA
   | | [rec]              RECORD DATA (one record per frame for interleaved video; optional, unsupported in this plugin)
   | |  |-dataSubchunks   RAW DATA: '??wb' for audio, '??db' and '??dc' for uncompressed and
   |                      compressed video, respectively. "??" denotes stream number, usually "00" or "01"
   |-idx1                 AVI INDEX (required by some programs, ignored in this plugin)
 


Constructor Summary
AVI_Reader()
           
 
Method Summary
 void deleteSlice(int n)
          Deletes the specified image from this virtual stack (if it is one), where 1<=n<=nslices.
 int getHeight()
          Returns the image height of the virtual stack
 ImagePlus getImagePlus()
          Returns the ImagePlus opened by run().
 ImageProcessor getProcessor(int n)
          Returns an ImageProcessor for the specified frame of this virtual stack (if it is one) where 1<=n<=nslices.
 int getSize()
          Returns the number of images in this virtual stack (if it is one)
 java.lang.String getSliceLabel(int n)
          Returns the label of the specified slice in this virtual stack (if it is one).
 int getWidth()
          Returns the image width of the virtual stack
 ImageStack makeStack(java.lang.String path, int firstFrameNumber, int lastFrameNumber, boolean isVirtual, boolean convertToGray, boolean flipVertical)
          Create an ImageStack from an avi file with given path.
 void run(java.lang.String arg)
          The plugin is invoked by ImageJ using this method.
 
Methods inherited from class ij.VirtualStack
addSlice, addSlice, addSlice, addSlice, deleteLastSlice, getBitDepth, getDirectory, getFileName, getImageArray, getPixels, isVirtual, saveChanges, setBitDepth, setPixels, setSliceLabel, trim
 
Methods inherited from class ij.ImageStack
addUnsignedShortSlice, getColorModel, getRoi, getShortSliceLabel, getSliceLabels, isHSB, isRGB, setColorModel, setRoi, toString, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AVI_Reader

public AVI_Reader()
Method Detail

run

public void run(java.lang.String arg)
The plugin is invoked by ImageJ using this method. String 'arg' may be used to select the path.

Specified by:
run in interface PlugIn

getImagePlus

public ImagePlus getImagePlus()
Returns the ImagePlus opened by run().


makeStack

public ImageStack makeStack(java.lang.String path,
                            int firstFrameNumber,
                            int lastFrameNumber,
                            boolean isVirtual,
                            boolean convertToGray,
                            boolean flipVertical)
Create an ImageStack from an avi file with given path.

Parameters:
path - Directoy+filename of the avi file
firstFrameNumber - Number of first frame to read (first frame of the file is 1)
lastFrameNumber - Number of last frame to read or 0 for reading all, -1 for all but last...
isVirtual - Whether to return a virtual stack
convertToGray - Whether to convert color images to grayscale
Returns:
Returns the stack; null on failure. The stack returned may be non-null, but have a length of zero if no suitable frames were found

getProcessor

public ImageProcessor getProcessor(int n)
Returns an ImageProcessor for the specified frame of this virtual stack (if it is one) where 1<=n<=nslices. Returns null if no virtual stack or no slices.

Overrides:
getProcessor in class VirtualStack

getWidth

public int getWidth()
Returns the image width of the virtual stack

Overrides:
getWidth in class ImageStack

getHeight

public int getHeight()
Returns the image height of the virtual stack

Overrides:
getHeight in class ImageStack

getSize

public int getSize()
Returns the number of images in this virtual stack (if it is one)

Overrides:
getSize in class VirtualStack

getSliceLabel

public java.lang.String getSliceLabel(int n)
Returns the label of the specified slice in this virtual stack (if it is one).

Overrides:
getSliceLabel in class VirtualStack

deleteSlice

public void deleteSlice(int n)
Deletes the specified image from this virtual stack (if it is one), where 1<=n<=nslices.

Overrides:
deleteSlice in class VirtualStack