jAER project on SourceForge

net.sf.jaer.graphics
Class Chip2DRenderer

java.lang.Object
  extended by net.sf.jaer.graphics.Chip2DRenderer
All Implemented Interfaces:
java.util.Observer
Direct Known Subclasses:
AEChipRenderer

public class Chip2DRenderer
extends java.lang.Object
implements java.util.Observer

A general class for rendering chip output to a 2d array of float values for drawing. Various modes are possible, e.g. gray scale, red/green for polarity events, color-time, multi-color for representing orientation or direction. Also allows continuous integration (accumulation) or time slices.

Author:
tobi
See Also:
for the class that renders AEChip events to a pixmap histogram

Field Summary
protected  boolean accumulateEnabled
          determines whether frame is reset to starting value on each rendering cycle.
protected  java.util.ArrayList<FrameAnnotater> annotators
           
protected  boolean autoscaleEnabled
          false for manual scaling, true for autoscaling of contrast
protected  int autoScaleValue
           
protected  Chip2D chip
          the chip rendered for
protected  int colorScale
          the number of events for full scale saturated color
protected  float eventContrast
          the constrast attributed to an event, either level is multiplied or divided by this value depending on polarity of event.
protected  float[][][] fr
          Deprecated. replaced by pixmap direct float buffer.
protected  float grayValue
           
protected  java.nio.FloatBuffer pixmap
          The rendered pixel map, ordered by rgb/row/col.
protected  java.util.prefs.Preferences prefs
           
protected  int selectedPixelEventCount
          The count of spikes in the "selected" pixel.
protected  short xsel
           
protected  short ysel
           
 
Constructor Summary
Chip2DRenderer()
           
Chip2DRenderer(Chip2D chip)
           
 
Method Summary
 void checkFr()
          Deprecated. replaced by pixmap
protected  void checkPixmapAllocation()
           
 int decreaseContrast()
          decrease contrast
 int getColorScale()
           
 float getGrayValue()
           
 java.nio.FloatBuffer getPixmap()
          The rendered pixel map, ordered by rgb/row/col.
 float[] getPixmapArray()
           
 int getPixMapIndex(int x, int y)
           
 float[] getPixmapRGB(int x, int y)
           
 int getSelectedPixelEventCount()
          Returns the number of spikes in the selected pixel in the last rendered packet
 short getXsel()
          A single pixel can be selected via the mouse and this returns the x pixel value
 short getYsel()
          A single pixel can be selected via the mouse and this returns the y pixel value
 int increaseContrast()
          increase image contrast
 boolean isAccumulateEnabled()
           
 boolean isAutoscaleEnabled()
           
 boolean isPixelSelected()
           
 void removeAllAnnotators()
           
 void resetFrame(float value)
          Resets the pixmap frame buffer to a given gray level.
 void setAccumulateEnabled(boolean accumulateEnabled)
           
 void setAutoscaleEnabled(boolean autoscaleEnabled)
           
 void setColorScale(int colorScale)
          set the color scale.
 void setGrayValue(float value)
           
 void setPixmapPosition(int x, int y)
           
 void setPixmapRGB(int x, int y, float[] rgb)
           
 void setXsel(short xsel)
           
 void setYsel(short ysel)
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefs

protected java.util.prefs.Preferences prefs

chip

protected Chip2D chip
the chip rendered for


accumulateEnabled

protected boolean accumulateEnabled
determines whether frame is reset to starting value on each rendering cycle. True to accumlate.


annotators

protected java.util.ArrayList<FrameAnnotater> annotators

autoScaleValue

protected int autoScaleValue

autoscaleEnabled

protected boolean autoscaleEnabled
false for manual scaling, true for autoscaling of contrast


colorScale

protected int colorScale
the number of events for full scale saturated color


eventContrast

protected float eventContrast
the constrast attributed to an event, either level is multiplied or divided by this value depending on polarity of event. Gets set by setColorScale


fr

protected float[][][] fr
Deprecated. replaced by pixmap direct float buffer.
the rendered frame, RGB matrix of pixel values in 0-1 range. In matlab convention, the first dimesion is y, the second dimension is x, the third dimension is a 3 vector of RGB values.


pixmap

protected java.nio.FloatBuffer pixmap
The rendered pixel map, ordered by rgb/row/col. The first 3 elements are the RBB float values of the LL pixel (x=0,y=0). The next 3 are the RGB of the second pixel from the left in the bottom row (x=1,y=0). Pixel (0,1) is at position starting at 3*(chip.getSizeX()).


grayValue

protected float grayValue

xsel

protected short xsel

ysel

protected short ysel

selectedPixelEventCount

protected int selectedPixelEventCount
The count of spikes in the "selected" pixel. Rendering methods are responsible for maintaining this

Constructor Detail

Chip2DRenderer

public Chip2DRenderer()

Chip2DRenderer

public Chip2DRenderer(Chip2D chip)
Method Detail

getPixmap

public java.nio.FloatBuffer getPixmap()
The rendered pixel map, ordered by rgb/row/col. The first 3 elements are the RBB float values of the LL pixel (x=0,y=0). The next 3 are the RGB of the second pixel from the left in the bottom row (x=1,y=0). Pixel (0,1) is at position starting at 3*(chip.getSizeX()).

Returns:
the pixmap

setPixmapRGB

public void setPixmapRGB(int x,
                         int y,
                         float[] rgb)

getPixmapRGB

public float[] getPixmapRGB(int x,
                            int y)

getPixMapIndex

public int getPixMapIndex(int x,
                          int y)

getPixmapArray

public float[] getPixmapArray()

setPixmapPosition

public void setPixmapPosition(int x,
                              int y)

checkPixmapAllocation

protected void checkPixmapAllocation()

decreaseContrast

public int decreaseContrast()
decrease contrast


getColorScale

public int getColorScale()
Returns:
current color scale, full scale in events

getGrayValue

public float getGrayValue()
Returns:
the gray level of the rendered data; used to determine whether a pixel needs to be drawn

setGrayValue

public void setGrayValue(float value)

getXsel

public short getXsel()
A single pixel can be selected via the mouse and this returns the x pixel value


getYsel

public short getYsel()
A single pixel can be selected via the mouse and this returns the y pixel value


increaseContrast

public int increaseContrast()
increase image contrast


isAccumulateEnabled

public boolean isAccumulateEnabled()

isAutoscaleEnabled

public boolean isAutoscaleEnabled()

isPixelSelected

public boolean isPixelSelected()

removeAllAnnotators

public void removeAllAnnotators()

checkFr

public void checkFr()
Deprecated. replaced by pixmap

Checks the frame buffer for the correct sizes; when constructed in superclass of a chip, sizes may not yet be set for chip. we can check every time


resetFrame

public void resetFrame(float value)
Resets the pixmap frame buffer to a given gray level.

Parameters:
value - gray level 0-1.

setAccumulateEnabled

public void setAccumulateEnabled(boolean accumulateEnabled)
Parameters:
accumulateEnabled - true to accumulate data to frame (don't reset to start value each cycle)

setAutoscaleEnabled

public void setAutoscaleEnabled(boolean autoscaleEnabled)

setColorScale

public void setColorScale(int colorScale)
set the color scale. 1 means a single event is full scale, 2 means a single event is half scale, etc. only applies to some rendering methods.


setXsel

public void setXsel(short xsel)

setYsel

public void setYsel(short ysel)

getSelectedPixelEventCount

public int getSelectedPixelEventCount()
Returns the number of spikes in the selected pixel in the last rendered packet


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

jAER project on SourceForge