edu.mit.sketch.ddg
Class ObjectDescription

java.lang.Object
  extended by edu.mit.sketch.ddg.ObjectDescription
All Implemented Interfaces:
java.io.Serializable

public class ObjectDescription
extends java.lang.Object
implements java.io.Serializable

ObjectDescription is a representation of an object in the sketch as a set of primitives, subobjects and a constraints between them.

The object description stores several levels of description hypotheses. This allows preserving the initial information so that the description could evolve with addition of more data.
Levels:
Raw Strokes - the original drawing example/examples
Initial constraints - all the constraints originally inferred, with their initial confidence and relevance values
HighConfidence constraints - original constraints filtered by confidence (what we decide is present in the drawing)
HighRelevanceConstraints - high confidence constraints filtered by relevance (what we decide is the essence of the figure)
Subobjects - higer level constraints inferred from highRelevanceConstraints.
Eventually there should be other higher level constraints added like "inside" or "overlaps", and others that are applied to whole shapes, rather than low-level constraints. Also a further level of representation would be a minimal constraint list that is mathematically equivalent to the highRelevanceConstraints. That list will be arrived at by geometrical reasoning. This stuff is to be implemented later.

Needed Improvements:
Now the group constrains are recorded in the separate group constraint list in the function that finds groups. Only highly relevant constraints are retained. Need to retain the initial confidence and relevance too. Need to think how to encorporate the group constraints into the search for subobjects. Right now subobject search does not look at those constraints in either object.
Object description should be eventually separated from the reasoning support for it. These should probably be two different classes.

ObjectDescription.java Created: Sat Nov 20 19:43:00 2001

Author:
Olya Veselova
See Also:
Serialized Form

Field Summary
static double BETWEEN_TENSION_LINES_RELEVANCE_RATING
          The larger the constant, the more the relevance of same-length constraint goes up for two primitives that are between two horizontal or vertical tension lines.
static double DEFAULT_CONFIDENCE_THRESHOLD
          Threshold for removing constraints with low confidence.
static java.lang.String DEFAULT_NAME
          Default name for the object if the name was not given
static double DEFAULT_RELEVANCE_THRESHOLD
          Threshold for removing constraints with low relevance.
static int DEFAULT_STARTING_INDEX
          Default index that primitives labelled from (for example 0 or 1)
static double INTERFERENCE_STRENGTH
          The larger the constant, the less the fall-off of the interference of lines with distance
 
Constructor Summary
ObjectDescription()
          Constructs an empty object description
ObjectDescription(java.lang.String name)
          Constructs an empty object description with a given name.
 
Method Summary
 ConstraintList allConstraints()
          Get all the final constraints - the final decision, icluding all the constraints in all subobjects, recursively.
 ConstraintList constraints()
          Get final constraints - the final decision.
 java.util.Vector findConnectedComponents(ConstraintList constraints)
          Find all connected components in this object, given a constraint list to work on.
 void findTensionLines(ConstraintList constraints)
          Find and record the tension lines that are present in the object
 void generateDescription(java.util.Vector strokes, DomainDescription domainDescription)
          Generate object description.
 ConstraintList groupConstraints()
          Get the group constraints
 GroupingTree grouping()
          Get Grouping tree
 java.lang.String name()
          Name of the object
 boolean orientationMatters()
          Return whether this object can be in any orientation
 PrimitiveList primitives()
          Return the primitives in this object
 java.util.HashMap primToGeomParts()
          Returns the correspondence of primitives to geom parts from the user example stroke that this description was based on
 void print(java.io.PrintStream out, boolean printDetails, boolean printInitial, boolean printHighConfidence, boolean printHighRelevance, boolean printGroups, boolean printNonRedundant, boolean printSubobjects)
          Print the description of the object, given an output stream.
 void printObjectParameters(java.io.PrintStream out)
          Print all the object parameters used in the computation
 void printObstruction(java.io.PrintStream out)
          Print the obstruction matrix for the symbol
 void printProximity(java.io.PrintStream out)
          Print the proximity matrix for this symbol
 boolean sameAs(ObjectDescription object, java.util.Vector mappingList)
          Determines whether a given object is the same as the other one.
 void setConstraints(ConstraintList constraints)
          Set high confidence constraints
 void setGroupConstraints(ConstraintList constraints)
          Set the group constraints
 void setGrouping(GroupingTree tree)
          set Grouping tree
 void setName(java.lang.String name)
          Set the name of the object
 void setOrientationMatters(boolean value)
          Set whether this object can be in any orientation
 void setPrimitives(PrimitiveList primitives)
          Set the primitives of the object description
 java.util.Vector strokes()
          Get the strokes of the original example
 java.util.Vector subobjectPrimitiveMapping(ConstraintList targetConstraints, ConstraintList dataConstraints, boolean exactMatch, java.util.Vector relabelLists, java.util.Vector nonRelabelLists)
          Find ALL mappings between the primitives of this object and the primitives of the target template object, assuming that the target object is a subobject (Example: find a rectangle in the symbol for the house).
 java.util.Vector subobjects()
          Get subobjects
 TensionLineList tensionLines()
          Return the tension lines
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONFIDENCE_THRESHOLD

public static final double DEFAULT_CONFIDENCE_THRESHOLD
Threshold for removing constraints with low confidence.

See Also:
Constant Field Values

DEFAULT_RELEVANCE_THRESHOLD

public static double DEFAULT_RELEVANCE_THRESHOLD
Threshold for removing constraints with low relevance.


DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
Default name for the object if the name was not given

See Also:
Constant Field Values

DEFAULT_STARTING_INDEX

public static final int DEFAULT_STARTING_INDEX
Default index that primitives labelled from (for example 0 or 1)

See Also:
Constant Field Values

INTERFERENCE_STRENGTH

public static double INTERFERENCE_STRENGTH
The larger the constant, the less the fall-off of the interference of lines with distance


BETWEEN_TENSION_LINES_RELEVANCE_RATING

public static double BETWEEN_TENSION_LINES_RELEVANCE_RATING
The larger the constant, the more the relevance of same-length constraint goes up for two primitives that are between two horizontal or vertical tension lines.

Constructor Detail

ObjectDescription

public ObjectDescription()
Constructs an empty object description


ObjectDescription

public ObjectDescription(java.lang.String name)
Constructs an empty object description with a given name.

Method Detail

generateDescription

public void generateDescription(java.util.Vector strokes,
                                DomainDescription domainDescription)
Generate object description. Figures out the geometric primitives and the initial constraints between them from the users strokes and records that information. Proceeds to construct further levels of hypothesis from the initial constraints. Finds subobjects in the current object from the given list of target objects Type of Vector: StrokeInput


findTensionLines

public void findTensionLines(ConstraintList constraints)
Find and record the tension lines that are present in the object


findConnectedComponents

public java.util.Vector findConnectedComponents(ConstraintList constraints)
Find all connected components in this object, given a constraint list to work on. Returns a vector of PrimitiveLists in each component. The list will be empty if the object description is empty.


printObstruction

public void printObstruction(java.io.PrintStream out)
Print the obstruction matrix for the symbol


printProximity

public void printProximity(java.io.PrintStream out)
Print the proximity matrix for this symbol


print

public void print(java.io.PrintStream out,
                  boolean printDetails,
                  boolean printInitial,
                  boolean printHighConfidence,
                  boolean printHighRelevance,
                  boolean printGroups,
                  boolean printNonRedundant,
                  boolean printSubobjects)
Print the description of the object, given an output stream. The parameters allow specifying what levels of representation should be printed and in what detail.


printObjectParameters

public void printObjectParameters(java.io.PrintStream out)
Print all the object parameters used in the computation


name

public java.lang.String name()
Name of the object


setName

public void setName(java.lang.String name)
Set the name of the object


primitives

public PrimitiveList primitives()
Return the primitives in this object


setPrimitives

public void setPrimitives(PrimitiveList primitives)
Set the primitives of the object description


primToGeomParts

public java.util.HashMap primToGeomParts()
Returns the correspondence of primitives to geom parts from the user example stroke that this description was based on


strokes

public java.util.Vector strokes()
Get the strokes of the original example


constraints

public ConstraintList constraints()
Get final constraints - the final decision. This list will not include the constraints that are part of the suboject.


allConstraints

public ConstraintList allConstraints()
Get all the final constraints - the final decision, icluding all the constraints in all subobjects, recursively.


setConstraints

public void setConstraints(ConstraintList constraints)
Set high confidence constraints


groupConstraints

public ConstraintList groupConstraints()
Get the group constraints


setGroupConstraints

public void setGroupConstraints(ConstraintList constraints)
Set the group constraints


tensionLines

public TensionLineList tensionLines()
Return the tension lines


grouping

public GroupingTree grouping()
Get Grouping tree


setGrouping

public void setGrouping(GroupingTree tree)
set Grouping tree


orientationMatters

public boolean orientationMatters()
Return whether this object can be in any orientation


setOrientationMatters

public void setOrientationMatters(boolean value)
Set whether this object can be in any orientation


subobjects

public java.util.Vector subobjects()
Get subobjects


sameAs

public boolean sameAs(ObjectDescription object,
                      java.util.Vector mappingList)
Determines whether a given object is the same as the other one. Stores the mappings between the primitives that make the objects the same adding them to whichever already was in the list. The mapping list will be empty if the objects are not the same. Type of Vector: PrimitiveMapping.


subobjectPrimitiveMapping

public java.util.Vector subobjectPrimitiveMapping(ConstraintList targetConstraints,
                                                  ConstraintList dataConstraints,
                                                  boolean exactMatch,
                                                  java.util.Vector relabelLists,
                                                  java.util.Vector nonRelabelLists)
Find ALL mappings between the primitives of this object and the primitives of the target template object, assuming that the target object is a subobject (Example: find a rectangle in the symbol for the house). Return an empty vector if no subobjects are found. Otherwise rturn a list of all the found mappings. Looks for subobject if exactMatch is false, and looks for exact equivalence between objects if exactMatch is true.