jAER project on SourceForge

net.sf.jaer.graphics
Class AEChipRenderer

java.lang.Object
  extended by net.sf.jaer.graphics.Chip2DRenderer
      extended by net.sf.jaer.graphics.AEChipRenderer
All Implemented Interfaces:
java.util.Observer
Direct Known Subclasses:
AdaptiveIntensityRenderer, BinocularRenderer, CochleaAMSNoBiasgen.Renderer, Dollbrain1Renderer, RetinaRenderer

public class AEChipRenderer
extends Chip2DRenderer

Superclass for classes that render AEs to a memory buffer so that they can be painted on the screen. Note these classes do not actually render to the graphcs device; they take AEPacket's and render them to a memory buffer that later gets painted by a ChipCanvas. The method chosen (by user cycling method from GUI) chooses how the events are painted. In effect the events are histogrammed for most rendering methods except for "color-time", and even there they are histogrammed or averaged. For methods that render polarized events (such as ON-OFF) then ON events increase the rendered value while OFF events decreases it. Thus the rendered image fr can be drawn in 3-d if desired and it will represent a histogram, although the default method using for drawing the rendered frame is to paint the cell brightness.

Author:
tobi

Nested Class Summary
static class AEChipRenderer.ColorMode
           
 
Field Summary
protected  AEChip chip
          chip shadows Chip2D's chip to declare it as AEChip
protected static int[] HUES
          perceptually separated hues - as estimated quickly by tobi
protected  boolean ignorePolarityEnabled
          the chip rendered for
protected  java.util.logging.Logger log
           
static int NUM_METHODS
          the number of rendering methods implemented
static int NUM_TIME_COLORS
          number of colors used to represent time of event
protected  EventPacket packet
           
protected  SpikeSound spikeSound
           
protected  float step
           
protected  boolean stereoEnabled
           
protected  int subsampleThresholdEventCount
           
protected  boolean subsamplingEnabled
          determines subSampling of rendered events (for speed)
protected  float[][] timeColors
           
protected  float[][] typeColorRGBComponents
          Used for rendering multiple cell types in different RGB colors.
protected  java.awt.Color[] typeColors
          The Colors that different cell types are painted.
 
Fields inherited from class net.sf.jaer.graphics.Chip2DRenderer
accumulateEnabled, annotators, autoscaleEnabled, autoScaleValue, colorScale, eventContrast, fr, grayValue, pixmap, prefs, selectedPixelEventCount, xsel, ysel
 
Constructor Summary
AEChipRenderer(AEChip chip)
           
 
Method Summary
protected  void autoScaleFrame(float[] fr)
          autoscales frame data so that max value is 1.
protected  void autoScaleFrame(float[][][] fr, float gray)
          autoscales frame data so that max value is 1.
protected  void checkTypeColors(int numCellTypes)
          Creates colors for each cell type (e.g.
 void cycleColorMode()
          go on to next rendering method
 AEChip getChip()
           
 AEChipRenderer.ColorMode getColorMode()
           
 EventPacket getPacket()
          returns the last packet rendered
 int getSubsampleThresholdEventCount()
           
 float[][] getTypeColorRGBComponents()
           
 java.awt.Color[] getTypeColors()
           
 boolean isIgnorePolarityEnabled()
           
protected  boolean isMethodMonochrome()
           
 boolean isStereoEnabled()
           
 boolean isSubsamplingEnabled()
           
protected  void playSpike(int type)
           
 void render(EventPacket packet)
          does the rendering using selected method.
 void setChip(AEChip chip)
           
 void setColorMode(AEChipRenderer.ColorMode colorMode)
           
 void setIgnorePolarityEnabled(boolean ignorePolarityEnabled)
           
 void setStereoEnabled(boolean stereoEnabled)
           
 void setSubsampleThresholdEventCount(int subsampleThresholdEventCount)
           
 void setSubsamplingEnabled(boolean subsamplingEnabled)
           
 void setTypeColorRGBComponents(float[][] typeColors)
           
 void setTypeColors(java.awt.Color[] typeColors)
           
 
Methods inherited from class net.sf.jaer.graphics.Chip2DRenderer
checkFr, checkPixmapAllocation, decreaseContrast, getColorScale, getGrayValue, getPixmap, getPixmapArray, getPixMapIndex, getPixmapRGB, getSelectedPixelEventCount, getXsel, getYsel, increaseContrast, isAccumulateEnabled, isAutoscaleEnabled, isPixelSelected, removeAllAnnotators, resetFrame, setAccumulateEnabled, setAutoscaleEnabled, setColorScale, setGrayValue, setPixmapPosition, setPixmapRGB, setXsel, setYsel, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HUES

protected static final int[] HUES
perceptually separated hues - as estimated quickly by tobi


NUM_METHODS

public static int NUM_METHODS
the number of rendering methods implemented


NUM_TIME_COLORS

public static final int NUM_TIME_COLORS
number of colors used to represent time of event

See Also:
Constant Field Values

chip

protected AEChip chip
chip shadows Chip2D's chip to declare it as AEChip


packet

protected EventPacket packet

ignorePolarityEnabled

protected boolean ignorePolarityEnabled
the chip rendered for


log

protected java.util.logging.Logger log

typeColors

protected java.awt.Color[] typeColors
The Colors that different cell types are painted. checkTypeColors should populate this array.


typeColorRGBComponents

protected float[][] typeColorRGBComponents
Used for rendering multiple cell types in different RGB colors. checkTypeColors should populate this array of [numTypes][3] size.


spikeSound

protected SpikeSound spikeSound

step

protected float step

stereoEnabled

protected boolean stereoEnabled

subsampleThresholdEventCount

protected int subsampleThresholdEventCount

subsamplingEnabled

protected boolean subsamplingEnabled
determines subSampling of rendered events (for speed)


timeColors

protected float[][] timeColors
Constructor Detail

AEChipRenderer

public AEChipRenderer(AEChip chip)
Method Detail

getTypeColorRGBComponents

public float[][] getTypeColorRGBComponents()
See Also:
typeColorRGBComponents

setTypeColorRGBComponents

public void setTypeColorRGBComponents(float[][] typeColors)
See Also:
typeColorRGBComponents

getTypeColors

public java.awt.Color[] getTypeColors()
See Also:
typeColors

setTypeColors

public void setTypeColors(java.awt.Color[] typeColors)
See Also:
typeColors

render

public void render(EventPacket packet)
does the rendering using selected method.

Parameters:
packet - a packet of events (already extracted from raw events)
See Also:
setColorMode(net.sf.jaer.graphics.AEChipRenderer.ColorMode)

autoScaleFrame

protected void autoScaleFrame(float[][][] fr,
                              float gray)
autoscales frame data so that max value is 1. If autoscale is disabled, then values are just clipped to 0-1 range. If autoscale is enabled, then gray is mapped back to gray and following occurs:

Global normalizer is tricky because we want to map max value to 1 OR min value to 0, whichever is greater magnitude, max or min. ALSO, max and min are distances from gray level in positive and negative directions. After global normalizer is computed, all values are divided by normalizer in order to keep gray level constant.

Parameters:
fr - the frame rgb data [y][x][rgb]
gray - the gray level

autoScaleFrame

protected void autoScaleFrame(float[] fr)
autoscales frame data so that max value is 1. If autoscale is disabled, then values are just clipped to 0-1 range. If autoscale is enabled, then gray is mapped back to gray and following occurs:

Global normalizer is tricky because we want to map max value to 1 OR min value to 0, whichever is greater magnitude, max or min. ALSO, max and min are distances from gray level in positive and negative directions. After global normalizer is computed, all values are divided by normalizer in order to keep gray level constant.

Parameters:
fr - the frame rgb data pixmap

checkTypeColors

protected void checkTypeColors(int numCellTypes)
Creates colors for each cell type (e.g. orientation) so that they are spread over hue space in a manner to attempt to be maximally different in hue.

Subclasses can override this method to customize the colors drawn but the subclasses should check if the color have been created since checkTypeColors is called on every rendering cycle. This method should first check if typeColorRGBComponents already exists and has the correct number of elements. If not, allocate and populate typeColorRGBComponents so that type t corresponds to typeColorRGBComponents[t][0] for red, typeColorRGBComponents[t][1] for green, and typeColorRGBComponents[t][3] for blue. It should also populate the Color[] typeColors.

Parameters:
numCellTypes - the number of colors to generate
See Also:
typeColors, typeColorRGBComponents

cycleColorMode

public void cycleColorMode()
go on to next rendering method


getPacket

public EventPacket getPacket()
returns the last packet rendered

Returns:
the last packet that was rendered

setChip

public void setChip(AEChip chip)

getChip

public AEChip getChip()

getColorMode

public AEChipRenderer.ColorMode getColorMode()

getSubsampleThresholdEventCount

public int getSubsampleThresholdEventCount()

isIgnorePolarityEnabled

public boolean isIgnorePolarityEnabled()

isMethodMonochrome

protected boolean isMethodMonochrome()

isStereoEnabled

public boolean isStereoEnabled()

isSubsamplingEnabled

public boolean isSubsamplingEnabled()

playSpike

protected void playSpike(int type)

setIgnorePolarityEnabled

public void setIgnorePolarityEnabled(boolean ignorePolarityEnabled)

setColorMode

public void setColorMode(AEChipRenderer.ColorMode colorMode)
Parameters:
colorMode - the rendering method, e.g. gray, red/green opponency, time encoded.

setStereoEnabled

public void setStereoEnabled(boolean stereoEnabled)

setSubsampleThresholdEventCount

public void setSubsampleThresholdEventCount(int subsampleThresholdEventCount)

setSubsamplingEnabled

public void setSubsamplingEnabled(boolean subsamplingEnabled)

jAER project on SourceForge