at.tuwien.ifs.somtoolbox.visualization
Class FlowBorderlineVisualizer

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
      extended by at.tuwien.ifs.somtoolbox.visualization.FlowBorderlineVisualizer
All Implemented Interfaces:
BackgroundImageVisualizer, Comparable<BackgroundImageVisualizer>

public class FlowBorderlineVisualizer
extends AbstractBackgroundImageVisualizer

This class provides two visualizations:

both described in:
Georg Poelzlbauer, Michael Dittenbach, Andreas Rauber. Advanced visualization of Self-Organizing Maps with vector fields. Neural Networks, 19(6-7):911-922, July-August 2006.

Version:
$Id: FlowBorderlineVisualizer.java 3883 2010-11-02 17:13:23Z frank $
Author:
Dominik Schnitzer, Peter Widhalm

Nested Class Summary
protected  class FlowBorderlineVisualizer.FlowBorderlineControlPanel
           
 
Nested classes/interfaces inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
AbstractBackgroundImageVisualizer.ContourInterpolationMode, AbstractBackgroundImageVisualizer.ContourMode, AbstractBackgroundImageVisualizer.VisualizationControlPanel
 
Field Summary
private  double[][] ax
           
private  double[][] ay
           
static String[] FLOWBORDER_SHORT_NAMES
           
private  GrowingSOM gsom
           
private  double maxa
           
private  double sigma
           
private  double stretchConst
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
cache, CACHE_KEY_SECTION_SEPARATOR, CACHE_KEY_SEPARATOR, contourInterpolationMode, contourMode, controlPanel, currentZDimSlice, inputObjects, interpolate, log, map, MAX_CACHE_SIZE_MB, neededInputObjects, NUM_VISUALIZATIONS, numberOfContours, opacity, preferredScaleFactor, VISUALIZATION_DESCRIPTIONS, VISUALIZATION_NAMES, VISUALIZATION_SHORT_NAMES, visualizationUpdateListener, zSize
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.visualization.BackgroundImageVisualizer
DEFAULT_BACKGROUND_VISUALIZATION_SCALE
 
Constructor Summary
FlowBorderlineVisualizer()
           
 
Method Summary
private  void calculateFlows()
          Formel 8, 9 10, 11, 12, 13, 14, 15, 16
private  void clearFlows()
           
 BufferedImage createVisualization(int index, GrowingSOM gsom, int width, int height)
          Creates a visualisation image.
private  double df(int x1, int y1, int x2, int y2)
          Formel 1 distance in feature space
private  double dout(int x1, int y1, int x2, int y2)
          Formel 2 distance in output space
private  void draw(int mode, Graphics2D g, int x, int y, double unitWidth, double stretchBorder)
           
protected  String getCacheKey(GrowingSOM gsom, int index, int width, int height)
          The key of a cache is created as follows: VisualisationShortName + Hashcode of the SOM + Width + Height + Opacity.
Sub-classes might add more information to the cache, if needed.
 int getPreferredScaleFactor()
          Scale for the FlowBorderlineVisualizer needs to be smaller, as the visualisation is made of lines, which cannot be scaled too much.
 HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height)
          Default implementation which returns a map of size 1 with the standard, unparameterised visualisation of the given variant.
 HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, int maxFlavours)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
 HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, Map<String,String> flavourParameters)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
private  double kernel(double dout)
          Formel 3
 
Methods inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
appendToCacheKey, buildCacheKey, checkNeededObjectsAvailable, checkVariantIndex, clearVisualisationCache, compareTo, createVisualization, drawBackground, getControlPanel, getHTMLVisualisationControl, getNumberOfVisualizations, getVariantException, getVisualization, getVisualizationDescription, getVisualizationDescriptions, getVisualizationName, getVisualizationNames, getVisualizationShortName, getVisualizationShortNames, invalidateCache, logImageCache, needsAdditionalFiles, setInputObjects, setMap, setSOMData, setVisualizationUpdateListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLOWBORDER_SHORT_NAMES

public static final String[] FLOWBORDER_SHORT_NAMES

sigma

private double sigma

stretchConst

private double stretchConst

gsom

private GrowingSOM gsom

ax

private double[][] ax

ay

private double[][] ay

maxa

private double maxa
Constructor Detail

FlowBorderlineVisualizer

public FlowBorderlineVisualizer()
Method Detail

clearFlows

private void clearFlows()

createVisualization

public BufferedImage createVisualization(int index,
                                         GrowingSOM gsom,
                                         int width,
                                         int height)
                                  throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Creates a visualisation image. Subclasses must implement this method.

Specified by:
createVisualization in class AbstractBackgroundImageVisualizer
Parameters:
index - the index of the variant to use
gsom - the GrowingSOM to take build the visualisation for
width - the desired width of the image, in pixels
height - the desired height of the image, in pixels.
Returns:
an image for this visualisation.
Throws:
SOMToolboxException

df

private double df(int x1,
                  int y1,
                  int x2,
                  int y2)
           throws LayerAccessException,
                  MetricException
Formel 1 distance in feature space

Throws:
LayerAccessException
MetricException

dout

private double dout(int x1,
                    int y1,
                    int x2,
                    int y2)
Formel 2 distance in output space


kernel

private double kernel(double dout)
Formel 3


calculateFlows

private void calculateFlows()
                     throws LayerAccessException,
                            MetricException
Formel 8, 9 10, 11, 12, 13, 14, 15, 16

Throws:
LayerAccessException
MetricException

draw

private void draw(int mode,
                  Graphics2D g,
                  int x,
                  int y,
                  double unitWidth,
                  double stretchBorder)

getPreferredScaleFactor

public int getPreferredScaleFactor()
Scale for the FlowBorderlineVisualizer needs to be smaller, as the visualisation is made of lines, which cannot be scaled too much.

Specified by:
getPreferredScaleFactor in interface BackgroundImageVisualizer
Overrides:
getPreferredScaleFactor in class AbstractBackgroundImageVisualizer

getCacheKey

protected String getCacheKey(GrowingSOM gsom,
                             int index,
                             int width,
                             int height)
Description copied from class: AbstractBackgroundImageVisualizer
The key of a cache is created as follows: VisualisationShortName + Hashcode of the SOM + Width + Height + Opacity.
Sub-classes might add more information to the cache, if needed.

Overrides:
getCacheKey in class AbstractBackgroundImageVisualizer

getVisualizationFlavours

public HashMap<String,BufferedImage> getVisualizationFlavours(int index,
                                                              GrowingSOM gsom,
                                                              int width,
                                                              int height)
                                                       throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation which returns a map of size 1 with the standard, unparameterised visualisation of the given variant. Subclasses that want to return more flavours should override this method.

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException

getVisualizationFlavours

public HashMap<String,BufferedImage> getVisualizationFlavours(int index,
                                                              GrowingSOM gsom,
                                                              int width,
                                                              int height,
                                                              int maxFlavours)
                                                       throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException

getVisualizationFlavours

public HashMap<String,BufferedImage> getVisualizationFlavours(int index,
                                                              GrowingSOM gsom,
                                                              int width,
                                                              int height,
                                                              Map<String,String> flavourParameters)
                                                       throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException