jAER project on SourceForge

ch.unizh.ini.jaer.projects.stereo3D
Class AEPacket3D

java.lang.Object
  extended by net.sf.jaer.aemonitor.AEPacket
      extended by ch.unizh.ini.jaer.projects.stereo3D.AEPacket3D

public class AEPacket3D
extends AEPacket

A structure containing a packer of AEs: addresses, timestamps. The AE packet efficiently packages a set of events: rather than using an object per event, it packs a lot of events into an object that references arrays of primitives. These arrays can be newly allocated or statically allocated to the capacity of the maximum buffer that is transferred from a device. Callers must use AEPacket.getNumEvents() to find out the capacity of the packet in the case that the arrays contain less events than their capacity, which is usually the case when the packet is reused in a device acquisition.

These AEPacket3D are used only for packaged 3D events (reconstructed from 3D filters/tarckers). For processed events, see the net.sf.jaer.event package.

Author:
tobi/rogister
See Also:
EventPacket

Field Summary
 boolean overrunOccuredFlag
          Signals that an overrun occured on this packet
 
Fields inherited from class net.sf.jaer.aemonitor.AEPacket
capacity, events, numEvents, timestamps
 
Constructor Summary
AEPacket3D()
          Creates a new instance of AEPacketRaw with 0 capacity
AEPacket3D(int[] coordinates_x, int[] coordinates_y, int[] coordinates_z, float[] values, int[] timestamps)
           
AEPacket3D(int[] coordinates_x, int[] coordinates_y, int[] disparities, int[] methods, int[] lead_sides, float[] values, int[] timestamps)
          Creates a new instance of AEPacketRaw from addresses and timestamps
AEPacket3D(int size, int type)
          Creates a new instance of AEPacketRaw with an initial capacity
 
Method Summary
 void addEvent(Event3D e)
           
protected  void allocateArrays(int size)
           
 void clear()
          sets number of events to zero
 float[] ensureCapacity(float[] array, int c)
           
 int[] ensureCapacity(int[] array, int c)
          ensure the capacity given.
 int getCapacity()
           
 int[] getCoordinates_x()
           
 int[] getCoordinates_y()
           
 int[] getCoordinates_z()
           
 int[] getDisparities()
           
 Event3D getEvent(int k)
          uses local EventRaw to return packaged event.
 int[] getLead_sides()
           
 int[] getMethods()
           
 AEPacket3D getPrunedCopy()
          Allocates a new AEPacketRaw and copies the events from this packet into the new one, returning it.
 int[] getTimestamps()
           
 int getType()
           
 float[] getValues()
           
 void setCoordinates_x(int[] coordinates)
           
 void setCoordinates_y(int[] coordinates)
           
 void setCoordinates_z(int[] coordinates)
           
 void setDisparities(int[] disparities)
           
 void setLead_sides(int[] lead_sides)
           
 void setMethods(int[] methods)
           
 void setType(int type)
           
 
Methods inherited from class net.sf.jaer.aemonitor.AEPacket
addEvent, ensureCapacity, getDt, getFirstTimestamp, getLastTimestamp, getNumEvents, getTimestamp, setNumEvents, setTimestamps, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

overrunOccuredFlag

public boolean overrunOccuredFlag
Signals that an overrun occured on this packet

Constructor Detail

AEPacket3D

public AEPacket3D()
Creates a new instance of AEPacketRaw with 0 capacity


AEPacket3D

public AEPacket3D(int[] coordinates_x,
                  int[] coordinates_y,
                  int[] disparities,
                  int[] methods,
                  int[] lead_sides,
                  float[] values,
                  int[] timestamps)
Creates a new instance of AEPacketRaw from addresses and timestamps

Parameters:
timestamps -

AEPacket3D

public AEPacket3D(int[] coordinates_x,
                  int[] coordinates_y,
                  int[] coordinates_z,
                  float[] values,
                  int[] timestamps)

AEPacket3D

public AEPacket3D(int size,
                  int type)
Creates a new instance of AEPacketRaw with an initial capacity

Parameters:
size - capacity in events
Method Detail

allocateArrays

protected void allocateArrays(int size)

getType

public int getType()

setType

public void setType(int type)

getTimestamps

public int[] getTimestamps()
Overrides:
getTimestamps in class AEPacket

getValues

public float[] getValues()

getCoordinates_x

public int[] getCoordinates_x()

getCoordinates_y

public int[] getCoordinates_y()

getCoordinates_z

public int[] getCoordinates_z()

getDisparities

public int[] getDisparities()

getMethods

public int[] getMethods()

getLead_sides

public int[] getLead_sides()

setCoordinates_x

public void setCoordinates_x(int[] coordinates)

setCoordinates_y

public void setCoordinates_y(int[] coordinates)

setCoordinates_z

public void setCoordinates_z(int[] coordinates)

setDisparities

public void setDisparities(int[] disparities)

setMethods

public void setMethods(int[] methods)

setLead_sides

public void setLead_sides(int[] lead_sides)

getEvent

public Event3D getEvent(int k)
uses local EventRaw to return packaged event. (Does not create a new object instance.)


getCapacity

public int getCapacity()
Overrides:
getCapacity in class AEPacket
Returns:
the maximum capacity for holding events in the packet. Not the number of events present now.

ensureCapacity

public int[] ensureCapacity(int[] array,
                            int c)
ensure the capacity given. If present capacity is less than capacity, then arrays are newly allocated.

Parameters:
c - the desired capacity

ensureCapacity

public float[] ensureCapacity(float[] array,
                              int c)

addEvent

public void addEvent(Event3D e)
Parameters:
e - an Event to add to the ones already present. Capacity is enlarged if necessary.

clear

public void clear()
sets number of events to zero

Overrides:
clear in class AEPacket

getPrunedCopy

public AEPacket3D getPrunedCopy()
Allocates a new AEPacketRaw and copies the events from this packet into the new one, returning it. The size of the new packet that is returned is exactly the number of events stored in the this packet. This method can be used to more efficiently use matlab memory, which handles java garbage collection poorly.

Returns:
a new packet sized to the src packet number of events

jAER project on SourceForge