at.tuwien.ifs.somtoolbox.visualization
Class ThematicClassMapVisualizer

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

public class ThematicClassMapVisualizer
extends AbstractBackgroundImageVisualizer
implements BackgroundImageVisualizer

This visualisation colours the map according to the distribution of classes assigned to the data items. Helper methods are to be found in the package at.tuwien.ifs.somtoolbox.visualization.thematicmap.

Version:
$Id: ThematicClassMapVisualizer.java 3883 2010-11-02 17:13:23Z frank $
Author:
Taha Abdel Aziz, Florian Guggenberger, Ewald Peiszer, Andrei Grecu, Rudolf Mayer

Nested Class Summary
(package private)  class ThematicClassMapVisualizer.ClassVisControlPanel
           
 
Nested classes/interfaces inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
AbstractBackgroundImageVisualizer.ContourInterpolationMode, AbstractBackgroundImageVisualizer.ContourMode, AbstractBackgroundImageVisualizer.VisualizationControlPanel
 
Field Summary
(package private)  boolean chessBoard
           
static String CLASSMAP_SHORT_NAME
           
(package private)  double contrast
           
(package private)  double gain
           
(package private)  double gamma
           
private  double HSVRANGE
           
private  double maximumMatrixValue
           
(package private)  double method
           
private static int METHOD_ALPHA
           
private static int METHOD_BLACK
           
private static int METHOD_HSV_MODEL
           
private static int METHOD_NO_COMBINATION
           
private static int METHOD_WHITE
           
(package private)  double min_visible_class
           
private  double minimumMatrixValue
           
protected  Hashtable<String,RegionManager> regionCache
           
(package private)  boolean voronoi
           
private  int zoom
           
 
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
ThematicClassMapVisualizer()
           
 
Method Summary
private  void applyColourWeighting(GrowingSOM gsom, int width, int height, BufferedImage res, Graphics2D g)
           
private  int clamp(int a, int min, int max)
           
 BufferedImage createVisualization(int index, GrowingSOM gsom, int width, int height)
          Creates a visualisation image.
 BufferedImage createVisualization(int index, GrowingSOM gsom, int width, int height, int ClassID)
           
protected  String getCacheKey(GrowingSOM gsom, int currentVariant, 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.
private  double[][] getUmValues(GrowingSOM gsom, cern.colt.matrix.DoubleMatrix2D matrix, int width, int height)
          Adapted from AbstractMatrixVisualizer.createImage(GrowingSOM, DoubleMatrix2D, int, int, boolean).
FIXME: check if the two methods can be merged.
 HashMap<String,BufferedImage> getVisualizationFlavours(int variantIndex, 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 variantIndex, GrowingSOM gsom, int width, int height, int maxFlavours)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
 HashMap<String,BufferedImage> getVisualizationFlavours(int variantIndex, GrowingSOM gsom, int width, int height, Map<String,String> flavourParameters)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
 boolean hasClassInfo()
           
 void invalidateCache()
          Deletes all cached elements from this visualisation.
 void setInitialParams(boolean chessBoard, boolean voronoi, double minVisibleClass)
           
 void setZoom(int zoom)
           
 void update(double val, double gamma, double contrast, double gain, int method, boolean voronoi, boolean chessBoard)
           
 
Methods inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
appendToCacheKey, buildCacheKey, checkNeededObjectsAvailable, checkVariantIndex, clearVisualisationCache, compareTo, createVisualization, drawBackground, getControlPanel, getHTMLVisualisationControl, getNumberOfVisualizations, getPreferredScaleFactor, 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
 
Methods inherited from interface at.tuwien.ifs.somtoolbox.visualization.BackgroundImageVisualizer
getControlPanel, getHTMLVisualisationControl, getNumberOfVisualizations, getPreferredScaleFactor, getVisualization, getVisualizationDescription, getVisualizationDescriptions, getVisualizationName, getVisualizationNames, getVisualizationShortName, getVisualizationShortNames, needsAdditionalFiles, setInputObjects, setMap, setSOMData, setVisualizationUpdateListener
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

CLASSMAP_SHORT_NAME

public static final String CLASSMAP_SHORT_NAME
See Also:
Constant Field Values

METHOD_ALPHA

private static final int METHOD_ALPHA
See Also:
Constant Field Values

METHOD_BLACK

private static final int METHOD_BLACK
See Also:
Constant Field Values

METHOD_WHITE

private static final int METHOD_WHITE
See Also:
Constant Field Values

METHOD_NO_COMBINATION

private static final int METHOD_NO_COMBINATION
See Also:
Constant Field Values

METHOD_HSV_MODEL

private static final int METHOD_HSV_MODEL
See Also:
Constant Field Values

zoom

private int zoom

min_visible_class

double min_visible_class

gamma

double gamma

contrast

double contrast

gain

double gain

method

double method

voronoi

boolean voronoi

chessBoard

boolean chessBoard

regionCache

protected Hashtable<String,RegionManager> regionCache

minimumMatrixValue

private double minimumMatrixValue

maximumMatrixValue

private double maximumMatrixValue

HSVRANGE

private double HSVRANGE
Constructor Detail

ThematicClassMapVisualizer

public ThematicClassMapVisualizer()
Method Detail

getCacheKey

protected String getCacheKey(GrowingSOM gsom,
                             int currentVariant,
                             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

setInitialParams

public void setInitialParams(boolean chessBoard,
                             boolean voronoi,
                             double minVisibleClass)

clamp

private int clamp(int a,
                  int min,
                  int max)

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

createVisualization

public BufferedImage createVisualization(int index,
                                         GrowingSOM gsom,
                                         int width,
                                         int height,
                                         int ClassID)
                                  throws SOMToolboxException
Throws:
SOMToolboxException

applyColourWeighting

private void applyColourWeighting(GrowingSOM gsom,
                                  int width,
                                  int height,
                                  BufferedImage res,
                                  Graphics2D g)
                           throws SOMToolboxException
Throws:
SOMToolboxException

update

public void update(double val,
                   double gamma,
                   double contrast,
                   double gain,
                   int method,
                   boolean voronoi,
                   boolean chessBoard)

hasClassInfo

public boolean hasClassInfo()

getUmValues

private double[][] getUmValues(GrowingSOM gsom,
                               cern.colt.matrix.DoubleMatrix2D matrix,
                               int width,
                               int height)
Adapted from AbstractMatrixVisualizer.createImage(GrowingSOM, DoubleMatrix2D, int, int, boolean).
FIXME: check if the two methods can be merged. *


setZoom

public void setZoom(int zoom)

invalidateCache

public void invalidateCache()
Deletes all cached elements from this visualisation.


getVisualizationFlavours

public HashMap<String,BufferedImage> getVisualizationFlavours(int variantIndex,
                                                              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 variantIndex,
                                                              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 variantIndex,
                                                              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