public abstract class AbstractMatrixVisualizer extends AbstractBackgroundImageVisualizer implements MatrixVisualizer
AbstractBackgroundImageVisualizer.ContourInterpolationMode, AbstractBackgroundImageVisualizer.ContourMode, AbstractBackgroundImageVisualizer.VisualizationControlPanel
Modifier and Type | Field and Description |
---|---|
private boolean |
defaultInterpolate |
private boolean |
interpolate |
protected double |
maximumMatrixValue |
protected double |
minimumMatrixValue |
protected Palette |
palette |
cache, CACHE_KEY_SEPARATOR, contourInterpolationMode, contourMode, controlPanel, currentZDimSlice, inputObjects, log, map, MAX_CACHE_SIZE_MB, neededInputObjects, NUM_VISUALIZATIONS, numberOfContours, opacity, preferredScaleFactor, VISUALIZATION_DESCRIPTIONS, VISUALIZATION_NAMES, VISUALIZATION_SHORT_NAMES, visualizationUpdateListener, zSize
CACHE_KEY_SECTION_SEPARATOR, DEFAULT_BACKGROUND_VISUALIZATION_SCALE
Constructor and Description |
---|
AbstractMatrixVisualizer() |
Modifier and Type | Method and Description |
---|---|
protected cern.colt.matrix.DoubleMatrix2D |
computeHitHistogram(GrowingSOM gsom)
Computes the hit-histogram from the given
GrowingSOM . |
protected flanagan.interpolation.BiCubicSplineFast |
computeSpline(GrowingSOM gsom,
cern.colt.matrix.DoubleMatrix2D matrix,
int width,
int height,
int unitWidth,
int unitHeight) |
protected int |
constrainWithinPalette(int ci) |
protected BufferedImage |
createImage(GrowingSOM gsom,
cern.colt.matrix.DoubleMatrix2D matrix,
int width,
int height,
boolean interpolate)
Creates an image from a matrix of heights.
|
protected void |
drawContour(Graphics2D g,
cern.colt.matrix.DoubleMatrix2D matrix,
int width,
int height,
boolean fill) |
Palette |
getCurrentPalette()
Returns the
Palette this visualisation currently is set to. |
double |
getMaximumMatrixValue() |
double |
getMinimumMatrixValue() |
Color[] |
getPalette()
Gets the currently used palette.
|
String |
getPreferredPaletteName()
Default implementation using
Palettes.getDefaultPalette() . |
protected String |
getVisualisationSpecificCacheKey(int currentVariant) |
BufferedImage |
getVisualization(int index,
GrowingSOM gsom,
int width,
int height)
overriding the method in the superclass as we have a different cache key, and to set the min & max matrix values
to -1
|
void |
invalidateCache(Palette palette)
Deletes all cached elements that use the
Palette with the given index. |
boolean |
isInterpolate() |
void |
reversePalette()
Reverts the currently used palette.
|
void |
setDefaultInterpolate(boolean defaultInterpolate) |
void |
setInterpolate(boolean interpolate)
Sets whether this visualisation should interpolate the image
|
void |
setPalette(Palette newPalette)
Sets a new palette.
|
buildCacheKey, checkNeededObjectsAvailable, checkVariantIndex, clearVisualisationCache, compareTo, createVisualization, createVisualization, drawBackground, escapeFileName, getCache, getCacheKey, getControlPanel, getDefaultVisualisationFileName, getDefaultVisualisationFileName, getHTMLVisualisationControl, getNumberOfVisualizations, getPreferredScaleFactor, getVariantException, getVisualizationDescription, getVisualizationDescriptions, getVisualizationFlavours, getVisualizationFlavours, getVisualizationFlavours, getVisualizationName, getVisualizationNames, getVisualizationShortName, getVisualizationShortNames, invalidateCache, logImageCache, needsAdditionalFiles, setInputObjects, setMap, setSOMData, setVisualizationUpdateListener
protected Palette palette
private boolean interpolate
private boolean defaultInterpolate
protected double minimumMatrixValue
protected double maximumMatrixValue
public double getMinimumMatrixValue()
public double getMaximumMatrixValue()
public BufferedImage getVisualization(int index, GrowingSOM gsom, int width, int height) throws SOMToolboxException
getVisualization
in interface BackgroundImageVisualizer
getVisualization
in class AbstractBackgroundImageVisualizer
index
- the index of the variant to usegsom
- the GrowingSOM to take build the visualisation forwidth
- the desired width of the image, in pixelsheight
- the desired height of the image, in pixelsSOMToolboxException
- If there was an error creating the visualisationBackgroundImageVisualizer.getVisualization(int,
at.tuwien.ifs.somtoolbox.models.GrowingSOM, int, int)
protected String getVisualisationSpecificCacheKey(int currentVariant)
getVisualisationSpecificCacheKey
in class AbstractBackgroundImageVisualizer
public void setInterpolate(boolean interpolate)
MatrixVisualizer
setInterpolate
in interface MatrixVisualizer
public void setDefaultInterpolate(boolean defaultInterpolate)
public boolean isInterpolate()
isInterpolate
in interface MatrixVisualizer
protected void drawContour(Graphics2D g, cern.colt.matrix.DoubleMatrix2D matrix, int width, int height, boolean fill) throws SOMToolboxException
SOMToolboxException
protected BufferedImage createImage(GrowingSOM gsom, cern.colt.matrix.DoubleMatrix2D matrix, int width, int height, boolean interpolate) throws SOMToolboxException
gsom
- The GrowingSOM to generate the image formatrix
- The matrix with the calucalted heights.width
- the desired width of the image, in pixelsheight
- the desired height of the image, in pixels.interpolate
- indicates whether the image should be interpolated if the widht or height exceeds the matrix
dimensions.SOMToolboxException
protected flanagan.interpolation.BiCubicSplineFast computeSpline(GrowingSOM gsom, cern.colt.matrix.DoubleMatrix2D matrix, int width, int height, int unitWidth, int unitHeight)
protected int constrainWithinPalette(int ci)
public Color[] getPalette()
MatrixVisualizer
getPalette
in interface MatrixVisualizer
public void setPalette(Palette newPalette)
MatrixVisualizer
setPalette
in interface MatrixVisualizer
newPalette
- the new palettepublic void reversePalette()
MatrixVisualizer
reversePalette
in interface MatrixVisualizer
public Palette getCurrentPalette()
MatrixVisualizer
Palette
this visualisation currently is set to.getCurrentPalette
in interface MatrixVisualizer
public String getPreferredPaletteName()
Palettes.getDefaultPalette()
. Subclasses that want to use a different
palette should overwrite this method.getPreferredPaletteName
in interface MatrixVisualizer
public void invalidateCache(Palette palette)
Palette
with the given index.protected cern.colt.matrix.DoubleMatrix2D computeHitHistogram(GrowingSOM gsom) throws LayerAccessException
GrowingSOM
. Also sets the values of
minimumMatrixValue
and maximumMatrixValue
LayerAccessException