|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdatabionics.esom.renderer.Renderer
public class Renderer
Render an ESOM to a 2D image. The rendering is decomposed into basic steps and care is taken that after some properties are changed render() only repeats steps depending on those properties. The work of calculating the height above each neuron from the grid of weights is delegated to a class of type BackgroundRenderer. Zooming, mapping to a color table and tiling is done here. Drawing a foreground on top of the image is delegated to a class of type ForegroundRenderer. Only works with rectangular quad-grids, i.e. all subclasses of RectangularGrid.
Field Summary | |
---|---|
protected boolean |
autoRender
Flag whether render() is called after properties are changed |
protected BackgroundRenderer |
background
The renderer for the background |
protected BackgroundTool |
backgroundTool
|
protected BMFile |
bestmatches
List with best match positions |
protected java.awt.image.BufferedImage |
bgImage
The background image in 1:1 size |
protected java.lang.String |
bmFilename
|
protected java.util.ArrayList |
bmListeners
|
protected int |
bmSize
int for size of bm |
protected cern.colt.list.IntArrayList |
classes
list with class numbers of lrn File |
protected double |
clip
The clip factor for clipped heights |
protected boolean |
clipping
Flag if clipping is active |
protected java.awt.image.BufferedImage |
clonedBgImage
|
protected float |
colorify
factor for colorification |
protected boolean |
colorifying
flag wether to colorify or not |
protected ColorMapping |
colorMap
Colors really used to render background dependend on colors&colorSteps |
protected ColorTable |
colors
Colors used to render the background |
protected int |
colorSteps
Number of steps in Colortable to be used |
protected cern.colt.list.IntArrayList |
components
List with weight components to use |
protected boolean |
contours
Flag for countour lines |
protected cern.colt.matrix.DoubleMatrix2D |
data
matrix with training data |
protected DataTool |
dataTool
|
protected ForegroundTool |
foregroundTool
|
protected boolean |
frame
|
protected RectangularGrid |
grid
The grid of neurons |
protected boolean |
gridChanged
Flag for show changes on actual grid TODO: only the setter is needed right now. |
protected int |
height
The original height of the display in 2D |
protected boolean |
hexagonal
Flag for hexagonal neurons |
protected java.awt.image.BufferedImage |
image
The image to render to |
protected InfoTool |
infoTool
|
protected LegendTool |
legendTool
|
protected static org.apache.log4j.Logger |
log
interface to log4j system |
protected LrnFile |
lrn
LrnFile with data |
protected boolean |
lrnChanged
Flag for show changes on actual lrn file |
protected java.lang.String |
lrnFilename
|
protected java.util.ArrayList |
lrnListeners
|
protected ForegroundList |
maskForegrounds
|
protected cern.colt.matrix.DoubleMatrix2D |
matrix
The height above each neuron |
protected NamesFile |
names
names of bestmatches |
protected java.lang.String |
namesFilename
|
protected boolean |
noForeground
|
protected cern.colt.matrix.DoubleMatrix2D |
opinionMatrix
The Place to store the calculated OpinionMatrix |
protected ForegroundList |
posttileForegrounds
|
protected ForegroundList |
pretileForegrounds
The rendererlists for the foregrounds |
protected boolean |
reDraw
Flag whether drawBackground needs to be called again |
protected boolean |
reMask
Flag for drawing island/frame etc. |
protected boolean |
rePostFore
Flag for drawing cls/bm/opn etc. |
protected boolean |
rePreFore
Flag for drawing areas/colorize etc. |
protected boolean |
reRender
Flag whether renderBackground needs to be called again |
protected boolean |
reTile
Flag whether tileBackground needs to be called again |
protected boolean |
reZoom
Flag whether zoomBackground needs to be called again |
protected int |
shiftX
Horizontal shift of original matrix (only in toroid mode) |
protected int |
shiftY
Vertical shift of original matrix (only in toroid mode) |
protected boolean |
tiled
Flag for tiled projection |
protected java.awt.image.BufferedImage |
tiledImage
The possibly tiled background image |
protected boolean |
toroid
Flag for toroid renderering |
protected java.lang.String |
toroidLayout
Layout for toroid projection |
protected java.lang.String |
umxFilename
|
protected int |
width
The original width of the display in 2D |
protected java.lang.String |
wtsFilename
|
protected java.util.ArrayList |
wtsListeners
|
protected int |
zoom
The scaling factor |
protected cern.colt.matrix.DoubleMatrix2D |
zoomedMatrix
The interpolated height above each pixal |
protected cern.colt.matrix.DoubleMatrix2D |
zoomedOpn
|
Constructor Summary | |
---|---|
Renderer()
Standard constructor |
|
Renderer(cern.colt.matrix.DoubleMatrix2D matrix)
Constructor with precalculated matrix |
|
Renderer(Grid grid)
Constructor with weights |
Method Summary | |
---|---|
void |
addBmListener(BmChangeListener listener)
|
void |
addLrnListener(LrnChangeListener listener)
|
void |
addWtsListener(WtsChangeListener listener)
|
protected void |
cloneBgImage()
Copy zoomed image to current image. |
protected void |
cloneImage()
Copy zoomed image to current image. |
protected void |
colorizeBackground()
|
protected void |
drawBackground()
|
BackgroundRenderer |
getBackgroundRenderer()
Get the background renderer |
BMFile |
getBestMatches()
Get the bestmatches in grid |
java.awt.image.BufferedImage |
getBgImage()
|
java.lang.String |
getBmFilename()
|
int |
getBmSize()
|
cern.colt.list.IntArrayList |
getClasses()
|
double |
getClip()
|
java.awt.image.BufferedImage |
getClonedBgImage()
|
float |
getColorify()
|
ColorMapping |
getColorMap()
|
ColorTable |
getColors()
Get the color table |
int |
getColorSteps()
Returns the Number of Colorsteps to be made |
cern.colt.list.IntArrayList |
getComponents()
Get the selected weight components. |
cern.colt.function.VectorVectorFunction |
getDistanceFunction()
Get the distance function in data space |
RectangularGrid |
getGrid()
Get the grid of weight vectors. |
java.awt.image.BufferedImage |
getImage()
Get the generated image |
static org.apache.log4j.Logger |
getLog()
|
LrnFile |
getLrnFile()
|
java.lang.String |
getLrnFilename()
|
cern.colt.matrix.DoubleMatrix2D |
getMatrix()
Get the matrix |
NamesFile |
getNames()
get names |
java.lang.String |
getNamesFilename()
|
int |
getQuadrantOfPixel(int x,
int y)
returns the Quadrant of the map. |
int |
getShiftX()
get shiftX |
int |
getShiftY()
get shiftY |
ColorStatistics |
getStats()
|
java.awt.image.BufferedImage |
getTiledImage()
|
java.lang.String |
getToroidLayout()
Get the toroid layout |
java.lang.String |
getUmxFilename()
|
java.lang.String |
getWtsFilename()
|
int |
getZoom()
Get the zoom factor |
cern.colt.matrix.DoubleMatrix2D |
getZoomedMatrix()
|
boolean |
isAutoRender()
Get the auto render flag |
boolean |
isClipping()
|
protected boolean |
isColorBackground()
|
boolean |
isColorifying()
|
boolean |
isContours()
Get the contour flag |
boolean |
isFrame()
Deprecated. |
boolean |
isGridChanged()
|
boolean |
isHexagonal()
Get the hexagonal flag |
boolean |
isLrnChanged()
|
boolean |
isNoForeground()
|
boolean |
isReDraw()
|
boolean |
isReMask()
|
boolean |
isRePostFore()
|
boolean |
isRePreFore()
|
boolean |
isReRender()
|
boolean |
isReTile()
|
boolean |
isReZoom()
|
boolean |
isTiled()
Get the tiled flag |
boolean |
isToroid()
|
boolean |
loadBestMatches(java.lang.String filename)
Load the indices of the bestmatches from a *.bm file |
boolean |
loadData(java.lang.String filename)
Load the training data and keys from a *.lrn file |
boolean |
loadMatrix(java.lang.String filename)
Load the matrix from a *.umx file |
boolean |
loadNames(java.lang.String filename)
Load the data names from a *.names file |
void |
notifyBmListeners()
|
void |
notifyLrnListeners()
|
void |
notifyWtsListeners()
|
java.awt.image.BufferedImage |
render()
Render the image. |
void |
render(java.lang.String filename)
Render the image to a file |
void |
renderBackground()
If a grid of weights is available (field grid not null) let the background renderer caluclate the height values and store it in the field matrix. |
cern.colt.matrix.DoubleMatrix2D |
renderBackground(Grid grid)
|
void |
reset()
|
boolean |
saveMatrix(java.lang.String filename)
Save the matrix to a *.umx file |
void |
setAutoRender(boolean v)
Set the auto render flag |
void |
setBackgroundRenderer(BackgroundRenderer v)
Set the background renderer |
void |
setBackgroundTool(BackgroundTool backgroundTool)
|
void |
setBestMatches(BMFile v)
Set the bestmatches in grid |
void |
setBmFilename(java.lang.String string)
|
void |
setBmSize(int i)
|
void |
setClasses(cern.colt.list.IntArrayList list)
|
void |
setClip(double d)
Sets the height percentage where the heigths matrix shall be clipped |
void |
setClipping(boolean b)
|
void |
setClonedBgImage(java.awt.image.BufferedImage clonedBgImage)
|
void |
setColorify(float colorify)
|
void |
setColorifying(boolean colorifying)
|
void |
setColorMap(ColorMapping mapping)
|
void |
setColors(ColorTable v)
Set the color table |
void |
setColorSteps(int q)
Set the number of color-steps to be made |
void |
setComponents(cern.colt.list.IntArrayList v)
Set the selected weight components. |
void |
setComponents(java.lang.String v)
Set the selected weight components as a string. |
void |
setContours(boolean v)
Set the contour flag |
void |
setDataTool(DataTool dataTool)
|
void |
setForegroundTool(ForegroundTool foregroundTool)
|
void |
setFrame(boolean b)
Deprecated. |
void |
setGrid(Grid v)
Set the grid of weight vectors. |
protected void |
setGridChanged(boolean gridChanged)
|
void |
setHexagonal(boolean v)
Set the hexagonal flag |
void |
setImage(java.awt.image.BufferedImage image)
|
void |
setInfoTool(InfoTool infoTool)
|
void |
setLegendTool(LegendTool legendTool)
|
void |
setLrnChanged(boolean flag)
|
void |
setLrnFile(LrnFile file)
|
void |
setLrnFilename(java.lang.String filename)
|
void |
setMaskForegrounds(ForegroundList maskForegrounds)
|
void |
setMatrix(cern.colt.matrix.DoubleMatrix2D v)
Set the matrix |
void |
setNames(NamesFile file)
|
void |
setNoForeground(boolean noForeground)
|
void |
setPosttileForegrounds(ForegroundList posttileForegrounds)
|
void |
setPretileForegrounds(ForegroundList pretileForegrounds)
|
void |
setReDraw(boolean b)
|
void |
setReMask(boolean reMask)
|
void |
setRePostFore(boolean rePostFore)
|
void |
setRePreFore(boolean rePreFore)
|
void |
setReRender(boolean b)
|
void |
setReTile(boolean b)
|
void |
setReZoom(boolean b)
|
void |
setTiled(boolean v)
Set the tiled flag |
void |
setToroid(boolean toroid)
|
void |
setToroidLayout(java.lang.String v)
Set the toroid layout |
void |
setWtsFilename(java.lang.String string)
|
void |
setZoom(int v)
Set the zoom factor |
protected void |
tileBackground()
Tile the background image for toroid projection. |
protected void |
zoomBackground()
|
protected cern.colt.matrix.DoubleMatrix2D |
zoomColorMatrix(cern.colt.matrix.DoubleMatrix2D matrix)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger log
protected boolean gridChanged
protected RectangularGrid grid
protected java.util.ArrayList wtsListeners
protected cern.colt.matrix.DoubleMatrix2D matrix
protected NamesFile names
protected BMFile bestmatches
protected java.util.ArrayList bmListeners
protected cern.colt.matrix.DoubleMatrix2D data
protected boolean lrnChanged
protected LrnFile lrn
protected java.util.ArrayList lrnListeners
protected cern.colt.list.IntArrayList components
protected cern.colt.matrix.DoubleMatrix2D zoomedMatrix
protected cern.colt.matrix.DoubleMatrix2D opinionMatrix
protected cern.colt.matrix.DoubleMatrix2D zoomedOpn
protected int height
protected int width
protected double clip
protected boolean clipping
protected boolean noForeground
protected BackgroundTool backgroundTool
protected ForegroundTool foregroundTool
protected InfoTool infoTool
protected LegendTool legendTool
protected DataTool dataTool
protected cern.colt.list.IntArrayList classes
protected java.awt.image.BufferedImage bgImage
protected java.awt.image.BufferedImage clonedBgImage
protected java.awt.image.BufferedImage tiledImage
protected java.awt.image.BufferedImage image
protected ForegroundList pretileForegrounds
protected ForegroundList posttileForegrounds
protected ForegroundList maskForegrounds
protected BackgroundRenderer background
protected boolean tiled
protected boolean toroid
protected java.lang.String toroidLayout
protected int shiftX
protected int shiftY
protected boolean hexagonal
protected int zoom
protected ColorTable colors
protected ColorMapping colorMap
protected boolean contours
protected int colorSteps
protected float colorify
protected int bmSize
protected boolean colorifying
protected boolean reRender
protected boolean reZoom
protected boolean reDraw
protected boolean reTile
protected boolean autoRender
protected boolean rePreFore
protected boolean rePostFore
protected boolean reMask
protected boolean frame
protected java.lang.String wtsFilename
protected java.lang.String bmFilename
protected java.lang.String lrnFilename
protected java.lang.String umxFilename
protected java.lang.String namesFilename
Constructor Detail |
---|
public Renderer()
public Renderer(Grid grid)
grid
- grid of weight vectorspublic Renderer(cern.colt.matrix.DoubleMatrix2D matrix)
matrix
- matrix of heightsMethod Detail |
---|
public RectangularGrid getGrid()
public void setGrid(Grid v)
v
- Value to assign to grid.public cern.colt.function.VectorVectorFunction getDistanceFunction()
public cern.colt.list.IntArrayList getComponents()
public void setComponents(cern.colt.list.IntArrayList v)
v
- Value to assign to components.public void setComponents(java.lang.String v)
v
- Value to assign to components, comma seperated integerspublic cern.colt.matrix.DoubleMatrix2D getMatrix()
public void setMatrix(cern.colt.matrix.DoubleMatrix2D v)
v
- Value to assign to matrix.public boolean loadMatrix(java.lang.String filename)
filename
- Name of the filepublic boolean saveMatrix(java.lang.String filename)
filename
- Name of the filepublic BMFile getBestMatches()
public void setBestMatches(BMFile v)
v
- Value to assign to bestmatches.public boolean loadBestMatches(java.lang.String filename)
filename
- filename Name of the filepublic NamesFile getNames()
public boolean loadNames(java.lang.String filename)
filename
- filename Name of the filepublic boolean loadData(java.lang.String filename)
filename
- Name of the filepublic java.awt.image.BufferedImage getImage()
public BackgroundRenderer getBackgroundRenderer()
public void setBackgroundRenderer(BackgroundRenderer v)
v
- Value to assign to background.public boolean isTiled()
public void setTiled(boolean v)
v
- Value to assign to tiledpublic java.lang.String getToroidLayout()
public void setToroidLayout(java.lang.String v)
v
- Value to assign to toroid layoutpublic boolean isHexagonal()
public void setHexagonal(boolean v)
v
- Value to assign to hexagonalpublic int getZoom()
public int getShiftX()
public int getShiftY()
public void setZoom(int v)
v
- Value to assign to zoompublic ColorTable getColors()
public void setColors(ColorTable v)
v
- Value to assign to colorspublic void setColorSteps(int q)
q
- number of ColorStepspublic int getColorSteps()
public boolean isContours()
public void setContours(boolean v)
v
- Value to assign to hexagonalpublic boolean isAutoRender()
public void setAutoRender(boolean v)
v
- Value to assign to auto renderpublic cern.colt.matrix.DoubleMatrix2D renderBackground(Grid grid)
public void renderBackground()
protected cern.colt.matrix.DoubleMatrix2D zoomColorMatrix(cern.colt.matrix.DoubleMatrix2D matrix)
protected void zoomBackground()
protected void drawBackground()
protected void colorizeBackground()
protected void tileBackground()
protected void cloneImage()
protected void cloneBgImage()
public java.awt.image.BufferedImage render()
public void render(java.lang.String filename)
public void reset()
public boolean isReRender()
public void setReRender(boolean b)
b
- public java.lang.String getBmFilename()
public java.lang.String getLrnFilename()
public java.lang.String getUmxFilename()
public java.lang.String getWtsFilename()
public void setWtsFilename(java.lang.String string)
string
- public java.lang.String getNamesFilename()
public boolean isReZoom()
public void setReZoom(boolean b)
b
- public boolean isReDraw()
public void setReDraw(boolean b)
b
- public boolean isReTile()
public void setReTile(boolean b)
b
- public void setClip(double d)
d
- the clip heigth between 0 and 1public double getClip()
public static org.apache.log4j.Logger getLog()
public boolean isFrame()
public void setFrame(boolean b)
b
- public void setImage(java.awt.image.BufferedImage image)
image
- public void setClipping(boolean b)
b
- public cern.colt.list.IntArrayList getClasses()
public void setClasses(cern.colt.list.IntArrayList list)
list
- public LrnFile getLrnFile()
public void setLrnFile(LrnFile file)
file
- public boolean isLrnChanged()
public void setLrnChanged(boolean flag)
flag
- has to be set true if the actual lrn file is changedpublic void addLrnListener(LrnChangeListener listener)
public void notifyLrnListeners()
public void addWtsListener(WtsChangeListener listener)
public void notifyWtsListeners()
public void addBmListener(BmChangeListener listener)
public void notifyBmListeners()
public int getQuadrantOfPixel(int x, int y)
x
- x-coordinate of pixel on zoomed imagey
- y-coordinate of pixel on zoomed image
public float getColorify()
public void setColorify(float colorify)
colorify
- The colorify to set.public boolean isColorifying()
public void setColorifying(boolean colorifying)
colorifying
- The colorifying to set.protected boolean isColorBackground()
public void setLrnFilename(java.lang.String filename)
public cern.colt.matrix.DoubleMatrix2D getZoomedMatrix()
public java.awt.image.BufferedImage getTiledImage()
public boolean isToroid()
public void setToroid(boolean toroid)
toroid
- The toroid to set.public int getBmSize()
public void setBmSize(int i)
i
- public void setNames(NamesFile file)
file
- public void setBmFilename(java.lang.String string)
string
- public boolean isClipping()
public ColorMapping getColorMap()
public void setColorMap(ColorMapping mapping)
mapping
- public ColorStatistics getStats()
public void setInfoTool(InfoTool infoTool)
infoTool
- The infoTool to set.public void setDataTool(DataTool dataTool)
dataTool
- The dataTool to set.public void setLegendTool(LegendTool legendTool)
legendTool
- The legendTool to set.public boolean isNoForeground()
public void setNoForeground(boolean noForeground)
noForeground
- The noForeground to set.public boolean isGridChanged()
protected void setGridChanged(boolean gridChanged)
gridChanged
- The gridChanged to set.public void setBackgroundTool(BackgroundTool backgroundTool)
backgroundTool
- The backgroundTool to set.public void setForegroundTool(ForegroundTool foregroundTool)
foregroundTool
- The foregroundTool to set.public boolean isRePreFore()
public void setRePreFore(boolean rePreFore)
rePreFore
- The rePreFore to set.public boolean isRePostFore()
public void setRePostFore(boolean rePostFore)
rePostFore
- The rePostFore to set.public boolean isReMask()
public void setReMask(boolean reMask)
reMask
- The reMask to set.public void setMaskForegrounds(ForegroundList maskForegrounds)
maskForegrounds
- The maskForegrounds to set.public void setPosttileForegrounds(ForegroundList posttileForegrounds)
posttileForegrounds
- The posttileForegrounds to set.public void setPretileForegrounds(ForegroundList pretileForegrounds)
pretileForegrounds
- The pretileForegrounds to set.public java.awt.image.BufferedImage getClonedBgImage()
public void setClonedBgImage(java.awt.image.BufferedImage clonedBgImage)
clonedBgImage
- The clonedBgImage to set.public java.awt.image.BufferedImage getBgImage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |