net.sourceforge.nite.tools.videolabeler
Class FeeltraceAnnotationLayer

java.lang.Object
  extended by net.sourceforge.nite.tools.videolabeler.AnnotationLayer
      extended by net.sourceforge.nite.tools.videolabeler.FeeltraceAnnotationLayer

public class FeeltraceAnnotationLayer
extends AnnotationLayer

In this annotation layer the annotation targets are emotions, consisting of evaluation and activation. Both evaluation and activation are double values between -1.0 and +1.0. These values are specified in attributes of an annotation element. An emotion, defined as a two-dimensional point, can be displayed in a circle with radius 1 and origin (0,0), where the X value is the evaluation and the Y value is the activation. These coordinates define the label of an emotion. The layer uses a FeeltraceColourMap to map emotions to colours. This map can be obtained with getColourMap().


Constructor Summary
FeeltraceAnnotationLayer(NLayer layer, java.lang.String codeName, java.lang.String panelType, org.w3c.dom.Node layerInfo)
          Constructs a new feeltrace annotation layer.
 
Method Summary
 void createGap(NOMElement annotation, double startTime, double endTime)
          Splits an annotation, so there will be a gap between the specified start time and end time.
 double getActivation(NOMElement annotation)
          Returns the activation of an annotation.
 java.lang.String getActivationAttribute()
          Returns the name of the attribute that contains the activation value of an annotation.
 FeeltraceColourMap getColourMap()
          Returns the Feeltrace colour map that maps emotions to colours.
 double getEvaluation(NOMElement annotation)
          Returns the evaluation of an annotation.
 java.lang.String getEvaluationAttribute()
          Returns the name of the attribute that contains the evaluation value of an annotation.
 java.lang.String getLabel(NOMElement annotation)
          Returns the label of the specified annotation.
 java.util.HashMap getStyleMap()
          Returns a map that maps style names to styles.
 boolean sameTargets(NOMElement elem1, NOMElement elem2)
          Compares two annotations and returns true if they have the same evaluation and activation.
 boolean showAnnotationArea()
          Returns false.
 
Methods inherited from class net.sourceforge.nite.tools.videolabeler.AnnotationLayer
createTargetControlPanel, getCodeElement, getElementFormatter, getNLayer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeeltraceAnnotationLayer

public FeeltraceAnnotationLayer(NLayer layer,
                                java.lang.String codeName,
                                java.lang.String panelType,
                                org.w3c.dom.Node layerInfo)
                         throws java.lang.ClassNotFoundException,
                                java.lang.NoSuchMethodException,
                                java.lang.Exception

Constructs a new feeltrace annotation layer. The layerInfo parameter is the layerinfo element from the configuration file. It should have the following two attributes:

Parameters:
layer - the NXT layer
codeName - the name of the code elements that represent annotations in this layer
panelType - the qualified class name of the target control panel that should be used with this layer
layerInfo - the layerinfo element
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.Exception
Method Detail

getEvaluationAttribute

public java.lang.String getEvaluationAttribute()

Returns the name of the attribute that contains the evaluation value of an annotation.

Returns:
the name of the evaluation attribute

getActivationAttribute

public java.lang.String getActivationAttribute()

Returns the name of the attribute that contains the activation value of an annotation.

Returns:
the name of the activation attribute

getColourMap

public FeeltraceColourMap getColourMap()

Returns the Feeltrace colour map that maps emotions to colours.

Returns:
the Feeltrace colour map

getStyleMap

public java.util.HashMap getStyleMap()

Returns a map that maps style names to styles.

Overrides:
getStyleMap in class AnnotationLayer
Returns:
a map that maps style names to styles

showAnnotationArea

public boolean showAnnotationArea()

Returns false. An annotation frame for this layer should not show the annotation area, because annotations can be visualised in the target control panel.

Overrides:
showAnnotationArea in class AnnotationLayer
Returns:
false

getActivation

public double getActivation(NOMElement annotation)

Returns the activation of an annotation. This should be a value between -1.0 and +1.0. If no value could be retrieved, this method returns Double.NaN.

Parameters:
annotation - an annotation
Returns:
the activation of the specified annotation or Double.NaN

getEvaluation

public double getEvaluation(NOMElement annotation)

Returns the evaluation of an annotation. This should be a value between -1.0 and +1.0. If no value could be retrieved, this method returns Double.NaN.

Parameters:
annotation - an annotation
Returns:
the evaluation of the specified annotation or Double.NaN

getLabel

public java.lang.String getLabel(NOMElement annotation)

Returns the label of the specified annotation. The label will consist of the evaluation and the activation, separated by a comma. If no evaluation or activation could be retrieved from the annotation, this method returns null.

Specified by:
getLabel in class AnnotationLayer
Parameters:
annotation - an annotation
Returns:
the label of the annotation or null

createGap

public void createGap(NOMElement annotation,
                      double startTime,
                      double endTime)
               throws java.lang.Exception

Splits an annotation, so there will be a gap between the specified start time and end time. The specified annotation must start before the start time and it must end after the end time.

Specified by:
createGap in class AnnotationLayer
Parameters:
annotation - the annotation that will be split
startTime - the time where the gap will start
endTime - the time where the gap will end
Throws:
java.lang.Exception - if an error occurs

sameTargets

public boolean sameTargets(NOMElement elem1,
                           NOMElement elem2)

Compares two annotations and returns true if they have the same evaluation and activation. If the two annotations are adjacent, it means they can be merged into one annotation.

Specified by:
sameTargets in class AnnotationLayer
Parameters:
elem1 - the first annotation
elem2 - the second annotation
Returns:
true if both annotations have the same evaluation and activation, false otherwise