org.generation5.util
Class TimeSeries

java.lang.Object
  extended byorg.generation5.util.TimeSeries
All Implemented Interfaces:
Visualizable
Direct Known Subclasses:
AutoTimeSeries

public class TimeSeries
extends java.lang.Object
implements Visualizable

This class creates a time-series of images. Snapshots of a Visualizable object are added on-the-fly, before specifying the row/column layout and rendering or writing the time-series image. For automatic time-series diagrams, see AutoTimeSeries.

See Also:
AutoTimeSeries

Field Summary
static int ANTIALIAS
          Anti-alias all captured images (default).
protected  java.awt.Color backColor
          The background colour.
static int BORDERS
          Draw both inner and outer borders (default).
protected  int columns
          The number of columns in the time-series diagram.
protected  int drawFlags
          The drawing options for the diagram.
protected  java.util.LinkedList imgArray
          The image linked list.
static int INNER_BORDER
          Draw inner borders.
protected  java.awt.Color innerBorder
          The inner border colour.
static int NONE
          No drawing options specified.
static int OUTER_BORDER
          Draw outer borders.
protected  java.awt.Color outerBorder
          The outer border colour.
protected  int rows
          The number of rows in the time-series diagram.
 
Constructor Summary
TimeSeries()
          Creates a new instance of TimeSeries
 
Method Summary
 void addSnapshot(java.awt.image.BufferedImage snapshot)
          Directly add an image to the time-series.
 void addSnapshot(Visualizable visObject, int width, int height)
          Add a snapshot to the time-series image.
 int getSnapshots()
          Return the number of snapshots currently stored.
static void main(java.lang.String[] args)
           
 void render(java.awt.Graphics g, int width, int height)
          Renders the time-series diagram.
 void setBackgroundColor(java.awt.Color back)
          Set the background colour.
 void setBorderColor(java.awt.Color borderColor)
          Set the border colour.
 void setBorderColors(java.awt.Color innerBorder, java.awt.Color outerBorder)
          Set the inner and outer border colours separately.
 void setDimensions(int rows, int columns)
          Set the row/column layout of the image.
 void setFormat(int flags)
          Set the drawing options.
 void writeImage(java.lang.String s, int width, int height)
          Write an image using the class data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rows

protected int rows
The number of rows in the time-series diagram.


columns

protected int columns
The number of columns in the time-series diagram.


drawFlags

protected int drawFlags
The drawing options for the diagram. Currently supported options are anti- aliasing (default) and inner/outer border options (defaults to both).


backColor

protected java.awt.Color backColor
The background colour.


innerBorder

protected java.awt.Color innerBorder
The inner border colour.


outerBorder

protected java.awt.Color outerBorder
The outer border colour.


imgArray

protected java.util.LinkedList imgArray
The image linked list.


NONE

public static final int NONE
No drawing options specified.

See Also:
Constant Field Values

OUTER_BORDER

public static final int OUTER_BORDER
Draw outer borders.

See Also:
Constant Field Values

INNER_BORDER

public static final int INNER_BORDER
Draw inner borders.

See Also:
Constant Field Values

BORDERS

public static final int BORDERS
Draw both inner and outer borders (default).

See Also:
Constant Field Values

ANTIALIAS

public static final int ANTIALIAS
Anti-alias all captured images (default).

See Also:
Constant Field Values
Constructor Detail

TimeSeries

public TimeSeries()
Creates a new instance of TimeSeries

Method Detail

setDimensions

public void setDimensions(int rows,
                          int columns)
Set the row/column layout of the image.

Parameters:
rows - number of rows.
columns - number of columns.

setBackgroundColor

public void setBackgroundColor(java.awt.Color back)
Set the background colour. This only sets the background colour for the image itself, not the visualized data.

Parameters:
back - the background colour.

setFormat

public void setFormat(int flags)
Set the drawing options.

Parameters:
flags - the drawing options.

setBorderColor

public void setBorderColor(java.awt.Color borderColor)
Set the border colour. This is equivalent to calling: setBorderColors(borderColor, borderColor);

Parameters:
borderColor - the inner/outer border colour.

setBorderColors

public void setBorderColors(java.awt.Color innerBorder,
                            java.awt.Color outerBorder)
Set the inner and outer border colours separately.

Parameters:
innerBorder - the inner border colour.
outerBorder - the outer border colour.

addSnapshot

public void addSnapshot(Visualizable visObject,
                        int width,
                        int height)
Add a snapshot to the time-series image. Note that the width and height of the object does not necessarily relate to the final size in the rendered time-series image. See render for more details.

Parameters:
visObject - the object to capture.
width - the width of the snapshot.
height - the height of the snapshot.
See Also:
render(java.awt.Graphics, int, int)

addSnapshot

public void addSnapshot(java.awt.image.BufferedImage snapshot)
Directly add an image to the time-series. This is useful for creating composite images from, for example, the output of the machine vision filter classes.

Parameters:
snapshot - the buffered image snapshot.

getSnapshots

public int getSnapshots()
Return the number of snapshots currently stored.

Returns:
the number of snapshots.

render

public void render(java.awt.Graphics g,
                   int width,
                   int height)
Renders the time-series diagram. This renders the stored snapshots in sequence, filling out each column in the row before moving down to the next row. For example: 4x4, with 9 images x x x x x x x x x _ _ _ _ _ _ _ 3x3, with 9 images x x x x x x x x x It is also important to note that the captured images are cropped (if necessary) to the appropriate cell size for the time-series image. For example, if snapshots are taken at 200x200, but render is called to draw the time-series image at 600x600 with a layout of 6x6, the captured images will be cropped (not resized).

Specified by:
render in interface Visualizable
Parameters:
g - the graphics context.
width - the width of the context.
height - the height of the context.

writeImage

public void writeImage(java.lang.String s,
                       int width,
                       int height)
Description copied from interface: Visualizable
Write an image using the class data. This function should usually use the render function to write the image.

Specified by:
writeImage in interface Visualizable
Parameters:
s - the filename of the image to write
width - the width of the image
height - the height of the image

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

This documentation is part of the Generation5 JDK.