|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectbaseCode.gui.ColorMatrix
Title: ColorMatrix
Description: Creates a color matrix from a matrix of doubles
Copyright (c) 2004
Institution:: Columbia University
| Field Summary | |
protected java.awt.Color[] |
m_colorMap
|
protected java.awt.Color[][] |
m_colors
|
protected double |
m_displayMax
|
protected double |
m_displayMin
Min and max values to display, which might not be the actual min and max values in the matrix. |
protected AbstractNamedDoubleMatrix |
m_matrix
|
protected DoubleMatrixReader |
m_matrixReader
|
protected double |
m_max
|
protected double |
m_min
|
protected java.awt.Color |
m_missingColor
|
protected int[] |
m_rowKeys
to be able to sort the rows by an arbitrary key |
protected int |
m_totalColumns
|
protected int |
m_totalRows
|
| Constructor Summary | |
ColorMatrix(AbstractNamedDoubleMatrix matrix,
java.awt.Color[] colorMap,
java.awt.Color missingColor)
|
|
ColorMatrix(DenseDoubleMatrix2DNamed matrix)
|
|
ColorMatrix(java.lang.String filename)
|
|
ColorMatrix(java.lang.String filename,
java.awt.Color[] colorMap,
java.awt.Color missingColor)
|
|
| Method Summary | |
java.lang.Object |
clone()
|
protected int[] |
createRowKeys()
To be able to sort the rows by an arbitrary key. |
java.awt.Color |
getColor(int row,
int column)
|
int |
getColumnCount()
|
java.lang.String |
getColumnName(int column)
|
java.lang.String[] |
getColumnNames()
|
double |
getDisplayMax()
|
double |
getDisplayMin()
|
AbstractNamedDoubleMatrix |
getMatrix()
|
double[] |
getRow(int row)
|
double[] |
getRowByName(java.lang.String rowName)
|
int |
getRowCount()
|
int |
getRowIndexByName(java.lang.String rowName)
|
java.lang.String |
getRowName(int row)
|
java.lang.String[] |
getRowNames()
|
protected int |
getTrueRowIndex(int row)
|
double |
getValue(int row,
int column)
|
void |
init(AbstractNamedDoubleMatrix matrix)
|
void |
loadMatrixFromFile(java.lang.String filename)
A convenience method for loading data files |
void |
mapValuesToColors()
|
void |
resetRowKeys()
|
void |
setColor(int row,
int column,
java.awt.Color newColor)
|
void |
setColorMap(java.awt.Color[] colorMap)
|
void |
setDisplayRange(double min,
double max)
|
protected void |
setRow(int row,
double[] values)
Changes values in a row, clipping if there are more values than columns. |
void |
setRowKeys(int[] rowKeys)
|
void |
standardize()
Normalizes the elements of a matrix to variance one and mean zero, ignoring missing values todo move this to matrixstats or something. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected double m_displayMin
protected double m_displayMax
protected double m_min
protected double m_max
protected java.awt.Color[][] m_colors
protected java.awt.Color m_missingColor
protected java.awt.Color[] m_colorMap
protected AbstractNamedDoubleMatrix m_matrix
protected DoubleMatrixReader m_matrixReader
protected int m_totalRows
protected int m_totalColumns
protected int[] m_rowKeys
| Constructor Detail |
public ColorMatrix(java.lang.String filename)
throws java.io.IOException
filename - either an absolute path, or if providing a relative path (e.g. data.txt), then keep in mind that
it will be relative to the java interpreter, not the class (not my fault -- that's how java treats relative
paths)
java.io.IOExceptionpublic ColorMatrix(DenseDoubleMatrix2DNamed matrix)
public ColorMatrix(java.lang.String filename,
java.awt.Color[] colorMap,
java.awt.Color missingColor)
throws java.io.IOException
filename - data filenamecolorMap - the simplest color map is one with just two colors: { minColor, maxColor }missingColor - values missing from the matrix or non-numeric entries will be displayed using this color
java.io.IOException
public ColorMatrix(AbstractNamedDoubleMatrix matrix,
java.awt.Color[] colorMap,
java.awt.Color missingColor)
matrix - the matrixcolorMap - the simplest color map is one with just two colors: { minColor, maxColor }missingColor - values missing from the matrix or non-numeric entries will be displayed using this color| Method Detail |
public int getRowCount()
public int getColumnCount()
protected int getTrueRowIndex(int row)
public double getValue(int row,
int column)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public double[] getRow(int row)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptionpublic double[] getRowByName(java.lang.String rowName)
public java.awt.Color getColor(int row,
int column)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public void setColor(int row,
int column,
java.awt.Color newColor)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getRowName(int row)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getColumnName(int column)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptionpublic java.lang.String[] getRowNames()
public java.lang.String[] getColumnNames()
public int getRowIndexByName(java.lang.String rowName)
protected void setRow(int row,
double[] values)
row - row whose values we want to changevalues - new row valuesprotected int[] createRowKeys()
m_rowKeys array and initializes it in
ascending order from 0 to m_totalRows -1, so that by default it matches the physical order of the
columns: [0,1,2,...,m_totalRows-1]
public void setRowKeys(int[] rowKeys)
public void resetRowKeys()
public void init(AbstractNamedDoubleMatrix matrix)
public void loadMatrixFromFile(java.lang.String filename)
throws java.io.IOException
filename - the name of the data file
java.io.IOExceptionpublic void standardize()
public AbstractNamedDoubleMatrix getMatrix()
public void setDisplayRange(double min,
double max)
public double getDisplayMin()
public double getDisplayMax()
public void setColorMap(java.awt.Color[] colorMap)
throws java.lang.IllegalArgumentException
colorMap - an array of colors which define the midpoints in the color map; this can be one of the constants
defined in the ColorMap class, like ColorMap.REDGREEN_COLORMAP and ColorMap.BLACKBODY_COLORMAP
java.lang.IllegalArgumentException - if the colorMap array argument contains less than two colors.public void mapValuesToColors()
public java.lang.Object clone()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||