de.lmu.ifi.dbs.elki.visualization.opticsplot
Class OPTICSPlot<D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.opticsplot.OPTICSPlot<D>
Type Parameters:
D - Distance type
All Implemented Interfaces:
Result

public class OPTICSPlot<D extends Distance<D>>
extends Object
implements Result

Class to produce an OPTICS plot image.


Field Summary
(package private)  ClusterOrderResult<D> co
          The result to plot
(package private)  OPTICSColorAdapter colors
          Color adapter to use
(package private)  OPTICSDistanceAdapter<D> distanceAdapter
          The mapping from cluster order entry to value
(package private)  int height
          Height of plot
private static String IMGFILEPREFIX
          Prefix for filenames
protected static Logging logger
          Logger
protected  RenderedImage plot
          The Optics plot.
(package private)  LinearScale scale
          Scale to use
protected  File tempFile
          The plot saved to a temp file.
(package private)  int width
          Width of plot
 
Constructor Summary
OPTICSPlot(ClusterOrderResult<D> co, OPTICSColorAdapter colors)
          Constructor, with automatic distance adapter detection.
OPTICSPlot(ClusterOrderResult<D> co, OPTICSColorAdapter colors, OPTICSDistanceAdapter<D> distanceAdapter)
          Constructor.
 
Method Summary
static
<D extends Distance<D>>
boolean
canPlot(ClusterOrderResult<D> co)
          Test whether this class can produce an OPTICS plot for the given cluster order.
protected  LinearScale computeScale(List<ClusterOrderEntry<D>> order)
          Compute the scale (value range)
 void forgetRenderedImage()
          Free memory used by rendered image.
private static
<D extends Distance<D>>
OPTICSDistanceAdapter<D>
getAdapterForDistance(ClusterOrderResult<D> co)
          Try to find a distance adapter.
 File getAsTempFile()
          Get a temporary file for the optics plot.
 ClusterOrderResult<D> getClusterOrder()
          Get the cluster order we are attached to.
 OPTICSDistanceAdapter<D> getDistanceAdapter()
          Get the distance adapter-
 int getHeight()
           
 String getLongName()
          A "pretty" name for the result, for use in titles, captions and menus.
 RenderedImage getPlot()
          Get the OPTICS plot.
 double getRatio()
          Get width-to-height ratio of image.
 LinearScale getScale()
           
 String getShortName()
          A short name for the result, useful for file names.
 int getWidth()
           
static
<D extends Distance<D>>
OPTICSPlot<D>
plotForClusterOrder(ClusterOrderResult<D> co, VisualizerContext context)
          Static method to find an optics plot for a result, or to create a new one using the given context.
 void replot()
          Trigger a redraw of the OPTICS plot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logging logger
Logger


IMGFILEPREFIX

private static final String IMGFILEPREFIX
Prefix for filenames

See Also:
Constant Field Values

scale

LinearScale scale
Scale to use


width

int width
Width of plot


height

int height
Height of plot


co

final ClusterOrderResult<D extends Distance<D>> co
The result to plot


colors

final OPTICSColorAdapter colors
Color adapter to use


distanceAdapter

final OPTICSDistanceAdapter<D extends Distance<D>> distanceAdapter
The mapping from cluster order entry to value


plot

protected RenderedImage plot
The Optics plot.


tempFile

protected File tempFile
The plot saved to a temp file.

Constructor Detail

OPTICSPlot

public OPTICSPlot(ClusterOrderResult<D> co,
                  OPTICSColorAdapter colors,
                  OPTICSDistanceAdapter<D> distanceAdapter)
Constructor.

Parameters:
co - Cluster order to plot.
colors - Coloring strategy
distanceAdapter - Distance adapter

OPTICSPlot

public OPTICSPlot(ClusterOrderResult<D> co,
                  OPTICSColorAdapter colors)
Constructor, with automatic distance adapter detection.

Parameters:
co - Cluster order to plot.
colors - Coloring strategy
Method Detail

getAdapterForDistance

private static <D extends Distance<D>> OPTICSDistanceAdapter<D> getAdapterForDistance(ClusterOrderResult<D> co)
Try to find a distance adapter.

Type Parameters:
D - distance type
Parameters:
co - ClusterOrderResult
Returns:
distance adapter

canPlot

public static <D extends Distance<D>> boolean canPlot(ClusterOrderResult<D> co)
Test whether this class can produce an OPTICS plot for the given cluster order.

Type Parameters:
D - Distance type
Parameters:
co - Cluster order result
Returns:
test result

replot

public void replot()
Trigger a redraw of the OPTICS plot


computeScale

protected LinearScale computeScale(List<ClusterOrderEntry<D>> order)
Compute the scale (value range)

Parameters:
order - Cluster order to process
Returns:
Scale for value range of cluster order

getScale

public LinearScale getScale()
Returns:
the scale

getWidth

public int getWidth()
Returns:
the width

getHeight

public int getHeight()
Returns:
the height

getRatio

public double getRatio()
Get width-to-height ratio of image.

Returns:
width / height

getPlot

public RenderedImage getPlot()
Get the OPTICS plot.

Returns:
plot image

getDistanceAdapter

public OPTICSDistanceAdapter<D> getDistanceAdapter()
Get the distance adapter-

Returns:
the distanceAdapter

getAsTempFile

public File getAsTempFile()
                   throws IOException
Get a temporary file for the optics plot.

Returns:
Temp file containing the plot
Throws:
IOException

forgetRenderedImage

public void forgetRenderedImage()
Free memory used by rendered image.


getLongName

public String getLongName()
Description copied from interface: Result
A "pretty" name for the result, for use in titles, captions and menus.

Specified by:
getLongName in interface Result
Returns:
result name

getShortName

public String getShortName()
Description copied from interface: Result
A short name for the result, useful for file names.

Specified by:
getShortName in interface Result
Returns:
result name

plotForClusterOrder

public static <D extends Distance<D>> OPTICSPlot<D> plotForClusterOrder(ClusterOrderResult<D> co,
                                                                        VisualizerContext context)
Static method to find an optics plot for a result, or to create a new one using the given context.

Type Parameters:
D - Distance type
Parameters:
co - Cluster order
context - Context (for colors and reference clustering)
Returns:
New or existing optics plot

getClusterOrder

public ClusterOrderResult<D> getClusterOrder()
Get the cluster order we are attached to.

Returns:
Cluster order

Release 0.4.0 (2011-09-20_1324)