at.tuwien.ifs.somtoolbox.input
Class SOMLibDataWinnerMapping

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.input.SOMLibDataWinnerMapping

public class SOMLibDataWinnerMapping
extends Object

Reads and encapsules the input data - winner information. This means units that are the best-matching ones for the single input data, and the distances to those units (the distances are used e.g. by the SmoothedDataHistograms in their weighted & normalised form.

Version:
$Id: SOMLibDataWinnerMapping.java 3988 2011-01-10 15:24:47Z mayer $
Author:
Michael Dittenbach, Rudolf Mayer

Nested Class Summary
private  class SOMLibDataWinnerMapping.DataInformation
          Inner class holding the list of a certain number of best-matching units for an certain input datum.
 
Field Summary
private  SOMLibDataWinnerMapping.DataInformation[] dataInfo
           
private  boolean is3D
           
private  boolean is3Dcached
           
static int MAX_DATA_WINNERS
          Maximum data winners that will be written per unit, unless specified otherwise.
private  String metric
           
private  int numBMUs
           
private  int numVectors
           
 
Constructor Summary
private SOMLibDataWinnerMapping()
           
  SOMLibDataWinnerMapping(String fileName)
          Sole constructor taking the name of the data-winner mapping file as an argument.
 
Method Summary
 SOMLibDataWinnerMapping clone()
           
 void flipH(int ySize)
          Flip around the horizontal axis
 void flipV(int xSize)
          Flip around the vertical axis
 double[] getDists(int datum)
          Returns an array of double values containing the distances between the input datum and the best-matching units sorted ascending.
static String getFileNameSuffix()
           
 SOMLibDataWinnerMapping.DataInformation[] getInternalDataRepresentationCopy()
           
 String[] getLabels()
           
 String getMetric()
           
 int getNumBMUs()
          Returns the number of best-matching units per input datum.
 int getNumVectors()
          Returns the number of input vectors.
 int getVectPos(String label)
          Finds the position of input vector by comparing its label.
 int[] getXPos(int datum)
          Returns an array of int values containing the horizontal positions of the the best-matching units of the input datum.
 int[] getYPos(int datum)
          Returns an array of int values containing the vertical positions of the the best-matching units of the input datum.
 int[] getZPos(int datum)
          Returns an array of int values containing the depth positions of the the best-matching units of the input datum.
 boolean is3D()
           
static void main(String[] args)
           
 void readDataWinnerMappingFile(String fileName)
          Reads from the file and fills the data structure.
 void rotate(int quadrants, int xSize, int ySize)
          Rotate the winner mapping.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DATA_WINNERS

public static final int MAX_DATA_WINNERS
Maximum data winners that will be written per unit, unless specified otherwise.

See Also:
Constant Field Values

dataInfo

private SOMLibDataWinnerMapping.DataInformation[] dataInfo

numBMUs

private int numBMUs

numVectors

private int numVectors

metric

private String metric

is3D

private boolean is3D

is3Dcached

private boolean is3Dcached
Constructor Detail

SOMLibDataWinnerMapping

public SOMLibDataWinnerMapping(String fileName)
                        throws FileNotFoundException,
                               SOMLibFileFormatException
Sole constructor taking the name of the data-winner mapping file as an argument.

Parameters:
fileName - the name of the data-winner mapping file.
Throws:
FileNotFoundException - if the file with the given name is not found.
SOMLibFileFormatException - if the format of the file is corrupt.

SOMLibDataWinnerMapping

private SOMLibDataWinnerMapping()
Method Detail

getDists

public double[] getDists(int datum)
Returns an array of double values containing the distances between the input datum and the best-matching units sorted ascending. If the argument datum is invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Parameters:
datum - the index of the input datum in the list.
Returns:
an array of double values containing the distances between the input datum and the best-matching units sorted ascending.

getNumBMUs

public int getNumBMUs()
Returns the number of best-matching units per input datum.

Returns:
the number of best-matching units per input datum.

getNumVectors

public int getNumVectors()
Returns the number of input vectors.

Returns:
the number of input vectors.

getXPos

public int[] getXPos(int datum)
Returns an array of int values containing the horizontal positions of the the best-matching units of the input datum. If the argument datum is invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Parameters:
datum - the index of the input datum in the list.
Returns:
an array of int values containing the horizontal positions of the the best-matching units of the input datum.

getYPos

public int[] getYPos(int datum)
Returns an array of int values containing the vertical positions of the the best-matching units of the input datum. If the argument datum is invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Parameters:
datum - the index of the input datum in the list.
Returns:
an array of int values containing the vertical positions of the the best-matching units of the input datum.

getZPos

public int[] getZPos(int datum)
Returns an array of int values containing the depth positions of the the best-matching units of the input datum. If the argument datum is invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Parameters:
datum - the index of the input datum in the list.
Returns:
an array of int values containing the depth positions of the the best-matching units of the input datum.

getLabels

public String[] getLabels()

getVectPos

public int getVectPos(String label)
               throws SOMToolboxException
Finds the position of input vector by comparing its label.

Parameters:
label - The label of the input vector
Returns:
Position of the input vector
Throws:
SOMToolboxException - when label is not found in data winner mapping file

readDataWinnerMappingFile

public void readDataWinnerMappingFile(String fileName)
                               throws FileNotFoundException,
                                      SOMLibFileFormatException
Reads from the file and fills the data structure.

Parameters:
fileName - the name of the file to open.
Throws:
FileNotFoundException - if the file with the given name is not found.
SOMLibFileFormatException - if the format of the file is corrupt.

is3D

public boolean is3D()

getMetric

public String getMetric()

clone

public SOMLibDataWinnerMapping clone()
Overrides:
clone in class Object

rotate

public void rotate(int quadrants,
                   int xSize,
                   int ySize)
Rotate the winner mapping.

Parameters:
quadrants - rotate the winners for quadrants x 90 degrees (clockwise)

flipH

public void flipH(int ySize)
Flip around the horizontal axis


flipV

public void flipV(int xSize)
Flip around the vertical axis


getInternalDataRepresentationCopy

public SOMLibDataWinnerMapping.DataInformation[] getInternalDataRepresentationCopy()

getFileNameSuffix

public static String getFileNameSuffix()

main

public static void main(String[] args)