at.tuwien.ifs.somtoolbox.output
Class HTMLOutputter

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.output.HTMLOutputter
All Implemented Interfaces:
SOMToolboxApp

public class HTMLOutputter
extends Object
implements SOMToolboxApp

Version:
$Id: HTMLOutputter.java 3830 2010-10-06 16:29:11Z mayer $
Author:
Michael Dittenbach, Christoph Becker, Rudolf Mayer

Nested Class Summary
 
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
SOMToolboxApp.Type
 
Field Summary
private static String _bodyTag
           
private static String _bodyTagClose
           
private static String _docType
           
private static String _headTag
           
private static String _headTagClose
           
private static String _htmlTag
           
private static String _htmlTagClose
           
private static String _linkToStyle
           
private static String _scriptTag
           
private static String _titleTag
           
private static String _titleTagClose
           
private static String _xmlHeader
           
static SOMToolboxApp.Type APPLICATION_TYPE
           
static String DESCRIPTION
           
private  String linksuffix
          suffix to append to hrefs.
static String LONG_DESCRIPTION
           
static com.martiansoftware.jsap.Parameter[] OPTIONS
           
private static String styleFileName
           
private static String tooltipFileName
           
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
DEV_BY_STRING, HOMEPAGE, REQUIRED_MEMBERS, TYPE_GROUPED_COMPARATOR
 
Constructor Summary
HTMLOutputter()
           
 
Method Summary
private  void _write(GrowingSOM gsom, String fDir, String fName, String[] dataNames)
           
private  double[] calcMinMax(GrowingSOM gsom)
           
private  String createHTML(GrowingSOM gsom, String fDir, String fName, double[] minmax, String[] dataNames)
          Creates the string containing the HTML representation of a map.
private  String createMiniMap(String fName, Unit u)
           
private  String createTooltipDataTable(String[] names, double[] distances, double minDistance, double maxDistance, String[] hlDataNames)
           
private  String emptyUnitRepresentation(Unit u)
           
private  String expandedUnitRepresentation(Unit u, double[] minmax, String fDir, String fName, String[] hlDataNames)
           
 String getLinksuffix()
           
private  String labelInfo(Unit u, double[] minmax)
           
private  String leafUnitRepresentation(Unit u, double[] minmax, String[] hlDataNames)
           
static void main(String[] args)
          Main method for standalone operation.
private  String mapQuantizationInfo(GrowingSOM gsom)
           
private  String mapRepresentation(GrowingSOM gsom, double[] minmax, String fDir, String fName, String[] dataNames)
           
private  String nonEmptyUnitRepresentation(Unit u, double[] minmax, String fDir, String fName, String[] hlDataNames)
           
 void setLinksuffix(String linksuffix)
           
private  String unitRepresentation(Unit u, double[] minmax, String fDir, String fName, String[] dataNames)
           
private  String upperLayerMapInfo(String name, Unit su)
           
 void write(GHSOM ghsom, String fDir, String fName)
           
 void write(GHSOM ghsom, String fDir, String fName, String[] dataNames)
          Writes the HTML representation of a GHSOM to a file.
 void write(GrowingSOM gsom, String fDir, String fName)
           
 void write(GrowingSOM gsom, String fDir, String fName, String[] dataNames)
          Writes the HTML representation of a GrowingSOM to a file.
private static void writeStyleFile(String fDir)
           
private static void writeTooltipFile(String fDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONS

public static final com.martiansoftware.jsap.Parameter[] OPTIONS

DESCRIPTION

public static String DESCRIPTION

LONG_DESCRIPTION

public static String LONG_DESCRIPTION

APPLICATION_TYPE

public static final SOMToolboxApp.Type APPLICATION_TYPE

styleFileName

private static final String styleFileName
See Also:
Constant Field Values

tooltipFileName

private static final String tooltipFileName
See Also:
Constant Field Values

_xmlHeader

private static final String _xmlHeader
See Also:
Constant Field Values

_docType

private static final String _docType
See Also:
Constant Field Values

_htmlTag

private static final String _htmlTag
See Also:
Constant Field Values

_headTag

private static final String _headTag
See Also:
Constant Field Values

_linkToStyle

private static final String _linkToStyle
See Also:
Constant Field Values

_titleTag

private static final String _titleTag
See Also:
Constant Field Values

_titleTagClose

private static final String _titleTagClose
See Also:
Constant Field Values

_headTagClose

private static final String _headTagClose
See Also:
Constant Field Values

_bodyTag

private static final String _bodyTag
See Also:
Constant Field Values

_scriptTag

private static final String _scriptTag
See Also:
Constant Field Values

_bodyTagClose

private static final String _bodyTagClose
See Also:
Constant Field Values

_htmlTagClose

private static final String _htmlTagClose
See Also:
Constant Field Values

linksuffix

private String linksuffix
suffix to append to hrefs. This allows the labelling of hrefs to omit the filesuffix, looks much better. defaults to empty string for backwards compatibility

Constructor Detail

HTMLOutputter

public HTMLOutputter()
Method Detail

getLinksuffix

public String getLinksuffix()
Returns:
the linksuffix currently used
See Also:
linksuffix

setLinksuffix

public void setLinksuffix(String linksuffix)
Parameters:
linksuffix - the new suffix to use
See Also:
linksuffix

main

public static void main(String[] args)
Main method for standalone operation. Three possible uses:
  1. generate HTML representation directly from unit description file
  2. label the already mapped data and generate HTML
  3. map data onto a trained SOM, label the data and generate HTML output.
b. and c. are convenience functions.

Options are:

Parameters:
args - the execution arguments as stated above.

write

public void write(GHSOM ghsom,
                  String fDir,
                  String fName,
                  String[] dataNames)
           throws IOException
Writes the HTML representation of a GHSOM to a file.

Parameters:
ghsom - The GHSOM to be written.
fDir - Directory where to write the file to.
fName - Filename without suffix. Usually the name of the training run.
Throws:
IOException

write

public void write(GHSOM ghsom,
                  String fDir,
                  String fName)
           throws IOException
Throws:
IOException

write

public void write(GrowingSOM gsom,
                  String fDir,
                  String fName,
                  String[] dataNames)
           throws IOException
Writes the HTML representation of a GrowingSOM to a file.

Parameters:
gsom - The growing SOM to be written.
fDir - Directory where to write the file to.
fName - Filename without suffix. Usually the name of the training run.
Throws:
IOException

write

public void write(GrowingSOM gsom,
                  String fDir,
                  String fName)
           throws IOException
Throws:
IOException

_write

private void _write(GrowingSOM gsom,
                    String fDir,
                    String fName,
                    String[] dataNames)
             throws IOException
Throws:
IOException

createHTML

private String createHTML(GrowingSOM gsom,
                          String fDir,
                          String fName,
                          double[] minmax,
                          String[] dataNames)
                   throws IOException
Creates the string containing the HTML representation of a map.

Parameters:
gsom - The GrowingSOM to be written.
fDir - Directory where to write the file.
fName - Filename without suffix. Usually the name of the training run.
minmax - Array of double containing the minima and maxima of distances between data items and weight vectors, and label values respectively. These values are used for coloring. [0] minimum distance, [1] maximum distance, [2] minimum label value, [3] maximum label value.
dataNames - Array of strings containing data items to highlight on the map
Returns:
String containing the HTML representation.
Throws:
IOException

upperLayerMapInfo

private String upperLayerMapInfo(String name,
                                 Unit su)

mapQuantizationInfo

private String mapQuantizationInfo(GrowingSOM gsom)

mapRepresentation

private String mapRepresentation(GrowingSOM gsom,
                                 double[] minmax,
                                 String fDir,
                                 String fName,
                                 String[] dataNames)
                          throws IOException
Throws:
IOException

unitRepresentation

private String unitRepresentation(Unit u,
                                  double[] minmax,
                                  String fDir,
                                  String fName,
                                  String[] dataNames)
                           throws IOException
Throws:
IOException

emptyUnitRepresentation

private String emptyUnitRepresentation(Unit u)

nonEmptyUnitRepresentation

private String nonEmptyUnitRepresentation(Unit u,
                                          double[] minmax,
                                          String fDir,
                                          String fName,
                                          String[] hlDataNames)
                                   throws IOException
Throws:
IOException

expandedUnitRepresentation

private String expandedUnitRepresentation(Unit u,
                                          double[] minmax,
                                          String fDir,
                                          String fName,
                                          String[] hlDataNames)
                                   throws IOException
Throws:
IOException

leafUnitRepresentation

private String leafUnitRepresentation(Unit u,
                                      double[] minmax,
                                      String[] hlDataNames)

labelInfo

private String labelInfo(Unit u,
                         double[] minmax)

createTooltipDataTable

private String createTooltipDataTable(String[] names,
                                      double[] distances,
                                      double minDistance,
                                      double maxDistance,
                                      String[] hlDataNames)

createMiniMap

private String createMiniMap(String fName,
                             Unit u)

calcMinMax

private double[] calcMinMax(GrowingSOM gsom)

writeTooltipFile

private static void writeTooltipFile(String fDir)

writeStyleFile

private static void writeStyleFile(String fDir)