Reasoner
Class ObjectInference

java.lang.Object
  |
  +--Reasoner.ObjectInference

public class ObjectInference
extends java.lang.Object

Serves as a wrapper for the details of a single object inferred by the Reasoner and necessary for the Renderer to depict its interpretation. For each run of the Monte Carlo simulation, a slightly different set of inferences will be made. Each set is designed to be stored in its own MonteCarloRunSet for later distillation.

Version:
Created 14 March 2003
Author:
Dan Tappan
See Also:
Reasoner, MonteCarloRunSet, Attitude, Dimensions, Position, RegionSet

Nested Class Summary
 class ObjectInference.ObjectInferenceRegionPairing
          Defines a pairing of an object inference with a region name.
 class ObjectInference.VarianceWrapper
          Defines a wrapper of position, dimensions, and attitudes for the distiller to record the variance from the mean of a population of object inferences.
 
Field Summary
static java.lang.String FIELD_PIPPER
           
protected  java.util.HashMap m_active_regions
           
private  Attitude m_attitude
           
private  int m_cluster_id
           
private  Dimensions m_dimensions
           
private  boolean m_is_attitude_propagated
           
private  boolean m_is_position_propagated
           
private  MonteCarloRunSet m_monte_carlo_run_set
           
private  java.lang.String m_object_name
           
private  ObjectTemplate m_object_template
           
private  Position m_position
           
private  RegionSet m_region_set
           
private  float m_transparency
           
private  ObjectInference.VarianceWrapper m_variance
           
static int NO_CLUSTER_ID
           
static java.lang.String OBJECT_WORLD_CENTER
           
private  float PIPPER_RANGE
           
 
Constructor Summary
ObjectInference(ObjectTemplate object_template, Position position, Dimensions dimensions, Attitude attitude, RegionSet region_set)
          Creates a new inference for a single object produced by the Reasoner.
 
Method Summary
 boolean doRegionsOverlap(java.lang.String region1_name, ObjectInference object_inference2, java.lang.String region2_name)
          Returns whether a region in this object inference overlaps a region of another object inference.
 Attitude getAttitude()
          Returns the attitude component of this inference.
 ObjectInference getClone()
          Returns a deep copy of this object except for its RegionSet and regions-in-use list, which are not designed to be changed in later processing stages.
 int getClusterID()
          Returns the cluster ID of this inference.
 Dimensions getDimensions()
          Returns the dimensions component of this inference.
 Position getInverseRandomPositionInRegion(java.lang.String region_name, ObjectInference target_object_inference)
          Returns a random position of an object inference that could have been used to position this object inference.
 java.lang.String getModelName()
          Returns the name of the model associated with this inference.
 MonteCarloRunSet getMonteCarloRunSet()
          Gets the Monte Carlo run set this object inference resides in.
 java.lang.String getObjectName()
          Returns the name of the object associated with this inference.
 ObjectTemplate getObjectTemplate()
          Returns the object template associated with this inference.
 Position getPipperPosition()
          Returns the position of the pipper, which is a virtual sight positioned at azimuth 0 and a fixed range.
 Position getPosition()
          Returns the position component of this inference.
 Attitude getRandomAttitudeInRegion(java.lang.String region_name)
          Returns a random attitude that would face this object inference within a region by placing its pipper there.
 Position getRandomPositionInIntersectedRegions(java.util.ArrayList object_inference_pairings, int max_attempts)
          /* Returns a position that satisfies the intersection of a set of regions.
 Position getRandomPositionInIntersectedRegions(java.lang.String[] region_names)
          Returns a random position contained within the intersection of multiple geometries of a region and generated based on their topologies.
 Position getRandomPositionInRegion(java.lang.String region_name)
          Returns a random position contained within the geometry of a region and generated based on its topology.
 RegionSet getRegionSet()
          Return all the regions associated with this inference, even those not in use.
 java.util.Collection getRegionsInUse()
          Return only the regions associated with this inference that are in use.
 float getTransparency()
          Returns the transparency value to be used in rendering this inference.
 ObjectInference.VarianceWrapper getVariance()
          Gets the variance of the position, dimensions, and attitude of this object inference.
 boolean isAttitudePropagated()
          Returns whether the attitude of this object inference has been propagated.
 void isAttitudePropagated(boolean state)
          Sets whether the attitude of this object inference has been propagated.
 boolean isPipperInRegion(java.lang.String region_name)
          Returns whether the pipper of this object inference is contained within the geometry of a region.
 boolean isPositionInRegion(Position position, java.lang.String region_name)
          Returns whether a position is contained within the geometry of a region.
 boolean isPositionPropagated()
          Returns whether the position of this object inference has been propagated.
 void isPositionPropagated(boolean state)
          Sets whether the position of this object inference has been propagated.
 boolean isSpatiallyEquivalent(ObjectInference object_inference, float tolerance)
          Returns whether two object inferences are close enough in position, dimensions, and attitude to be considered reasonably equivalent for interpretation purposes.
 void recodeObjectName(java.lang.String object_name)
          Changes the name of the object associated with this inference.
 void registerRegionInUse(Region region)
          Records that a region is in use so it can be rendered as a metaoverlay.
 void setClusterID(int cluster_id)
          Sets the cluster ID of this inference, which is used to relate object inferences across multiple Monte Carlo run sets.
 void setMonteCarloRunSet(MonteCarloRunSet monte_carlo_run_set)
          Sets the Monte Carlo run set this object inference resides in.
 void setTransparency(float transparency)
          Sets the transparency value to be used in rendering this inference.
 void setVariance(Position position_variance, Dimensions dimensions_variance, Attitude attitude_variance)
          Sets the variance of the position, dimensions, and attitude of this object inference.
 java.lang.String toHTMLString()
          Returns an indented HTML string representation of this object to be displayed by the Representation Viewer.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_object_name

private java.lang.String m_object_name

m_position

private Position m_position

m_dimensions

private Dimensions m_dimensions

m_attitude

private Attitude m_attitude

m_variance

private ObjectInference.VarianceWrapper m_variance

m_object_template

private ObjectTemplate m_object_template

m_transparency

private float m_transparency

m_region_set

private RegionSet m_region_set

m_active_regions

protected java.util.HashMap m_active_regions

m_is_position_propagated

private boolean m_is_position_propagated

m_is_attitude_propagated

private boolean m_is_attitude_propagated

m_monte_carlo_run_set

private MonteCarloRunSet m_monte_carlo_run_set

PIPPER_RANGE

private final float PIPPER_RANGE
See Also:
Constant Field Values

NO_CLUSTER_ID

public static final int NO_CLUSTER_ID
See Also:
Constant Field Values

m_cluster_id

private int m_cluster_id

OBJECT_WORLD_CENTER

public static final java.lang.String OBJECT_WORLD_CENTER
See Also:
Constant Field Values

FIELD_PIPPER

public static final java.lang.String FIELD_PIPPER
See Also:
Constant Field Values
Constructor Detail

ObjectInference

public ObjectInference(ObjectTemplate object_template,
                       Position position,
                       Dimensions dimensions,
                       Attitude attitude,
                       RegionSet region_set)
Creates a new inference for a single object produced by the Reasoner.

Parameters:
object_template - - the object template this object inference is based on
position - - the particular position of the object in this interpretation
dimensions - - the particular dimensions of the object in this interpretation
attitude - - the particular attitude of the object in this interpretation
region_set - - the optional set of regions to associate with this object; otherwise null

Note that object_name within object_template must be held the same across all MonteCarloRunSets.

Method Detail

doRegionsOverlap

public boolean doRegionsOverlap(java.lang.String region1_name,
                                ObjectInference object_inference2,
                                java.lang.String region2_name)
                         throws java.lang.Exception
Returns whether a region in this object inference overlaps a region of another object inference. This accounts for scaling, translation, and rotation of both object inferences.

Parameters:
region1_name - - the name of the region associated with this object inference
object_inference2 - - the object inference containing the second region
region2_name - - the name of the region associated with object_inference2
Returns:
whether the regions overlap
Throws:
java.lang.Exception - - if either region is not associated with its object inference

getAttitude

public Attitude getAttitude()
Returns the attitude component of this inference.

Returns:
the attitude component

getClone

public ObjectInference getClone()
Returns a deep copy of this object except for its RegionSet and regions-in-use list, which are not designed to be changed in later processing stages.

Returns:
the clone

getClusterID

public int getClusterID()
Returns the cluster ID of this inference.

Returns:
the cluster ID
See Also:
setClusterID(int)

getDimensions

public Dimensions getDimensions()
Returns the dimensions component of this inference.

Returns:
the dimensions component

getInverseRandomPositionInRegion

public Position getInverseRandomPositionInRegion(java.lang.String region_name,
                                                 ObjectInference target_object_inference)
                                          throws java.lang.Exception
Returns a random position of an object inference that could have been used to position this object inference. This answers the question of where another object inference would have to be with respect to a region in order to generate this position.

Parameters:
region_name - - the region containing the inverse object inference
Returns:
the position
Throws:
java.lang.Exception - - if the region is not associated with this inference
See Also:
getRandomPositionInRegion(java.lang.String)

getModelName

public java.lang.String getModelName()
Returns the name of the model associated with this inference.

Returns:
the name

getMonteCarloRunSet

public MonteCarloRunSet getMonteCarloRunSet()
Gets the Monte Carlo run set this object inference resides in.

Returns:
the run set
See Also:
setMonteCarloRunSet(Reasoner.MonteCarloRunSet)

getObjectName

public java.lang.String getObjectName()
Returns the name of the object associated with this inference.

Returns:
the name

getObjectTemplate

public ObjectTemplate getObjectTemplate()
Returns the object template associated with this inference.

Returns:
the object template

getPipperPosition

public Position getPipperPosition()
Returns the position of the pipper, which is a virtual sight positioned at azimuth 0 and a fixed range.

Returns:
the object template
See Also:
getRandomAttitudeInRegion(java.lang.String)

getPosition

public Position getPosition()
Returns the position component of this inference.

Returns:
the position component

getRandomAttitudeInRegion

public Attitude getRandomAttitudeInRegion(java.lang.String region_name)
                                   throws java.lang.Exception
Returns a random attitude that would face this object inference within a region by placing its pipper there.

Parameters:
region_name - - the region name
Returns:
the attitude
Throws:
java.lang.Exception - - if the region is not associated with this inference
See Also:
getPipperPosition()

getRandomPositionInRegion

public Position getRandomPositionInRegion(java.lang.String region_name)
                                   throws java.lang.Exception
Returns a random position contained within the geometry of a region and generated based on its topology. This accounts for scaling, translation, and rotation of the inference.

Parameters:
region_name - - the region
Returns:
the position
Throws:
java.lang.Exception - - if the region is not associated with this inference
See Also:
getInverseRandomPositionInRegion(java.lang.String, Reasoner.ObjectInference)

getRandomPositionInIntersectedRegions

public Position getRandomPositionInIntersectedRegions(java.lang.String[] region_names)
                                               throws java.lang.Exception
Returns a random position contained within the intersection of multiple geometries of a region and generated based on their topologies. This accounts for scaling, translation, and rotation of the inference.

Parameters:
region_names - - the regions
Returns:
the position
Throws:
java.lang.Exception - - if any region is not associated with this inference

getRandomPositionInIntersectedRegions

public Position getRandomPositionInIntersectedRegions(java.util.ArrayList object_inference_pairings,
                                                      int max_attempts)
                                               throws java.lang.Exception
/* Returns a position that satisfies the intersection of a set of regions.

Oddly enough, none of the object inferences in the pairing need to associated in any way with this one. In fact, this could be defined as a static function.

Parameters:
object_inference_pairings - - the object inferences and regions to intersect
max_attempts - - the maximum number of attempts to satisfy the intersection
Returns:
the position, or null is the maximum number of attempts was exceeded
Throws:
java.lang.Exception - - if generation fails

getRegionSet

public RegionSet getRegionSet()
Return all the regions associated with this inference, even those not in use.

Returns:
the region set
See Also:
getRegionsInUse()

getRegionsInUse

public java.util.Collection getRegionsInUse()
Return only the regions associated with this inference that are in use.

Returns:
the regions
See Also:
getRegionSet()

getTransparency

public float getTransparency()
Returns the transparency value to be used in rendering this inference.

Returns:
the transparency

getVariance

public ObjectInference.VarianceWrapper getVariance()
Gets the variance of the position, dimensions, and attitude of this object inference. The variance is the delta from the mean of a population or sample of object inferences. It must be calculated externally.

Returns:
the variance wrapper
See Also:
setVariance(Renderer.Position, Renderer.Dimensions, Renderer.Attitude), Distiller

isAttitudePropagated

public boolean isAttitudePropagated()
Returns whether the attitude of this object inference has been propagated.

Returns:
the state

isAttitudePropagated

public void isAttitudePropagated(boolean state)
Sets whether the attitude of this object inference has been propagated.

Parameters:
state - - the state

isPositionInRegion

public boolean isPositionInRegion(Position position,
                                  java.lang.String region_name)
                           throws java.lang.Exception
Returns whether a position is contained within the geometry of a region. This accounts for scaling, translation, and rotation of the inference.

Parameters:
position - - the position
region_name - - the region
Returns:
whether the position is contained
Throws:
java.lang.Exception - - if the region is not associated with this inference

isPositionPropagated

public boolean isPositionPropagated()
Returns whether the position of this object inference has been propagated.

Returns:
the state

isPositionPropagated

public void isPositionPropagated(boolean state)
Sets whether the position of this object inference has been propagated.

Parameters:
state - - the state

isPipperInRegion

public boolean isPipperInRegion(java.lang.String region_name)
                         throws java.lang.Exception
Returns whether the pipper of this object inference is contained within the geometry of a region. This accounts for scaling, translation, and rotation of the inference.

Parameters:
region_name - - the region
Returns:
the outcome
Throws:
java.lang.Exception - - if the region is not associated with this inference

isSpatiallyEquivalent

public boolean isSpatiallyEquivalent(ObjectInference object_inference,
                                     float tolerance)
Returns whether two object inferences are close enough in position, dimensions, and attitude to be considered reasonably equivalent for interpretation purposes.

Parameters:
object_inference - - the inference to compare
tolerance - - the tolerance
Returns:
the outcome

recodeObjectName

public void recodeObjectName(java.lang.String object_name)
Changes the name of the object associated with this inference. Normally the object name (and model name) must be held the same across all MonteCarloRunSets. The composite run set is the exception as it contains all instances of all inferences. In this case, the names would be treated as duplicates within the same set. To avoid this, the names can be recoded in a cloned set so they are all unique. The internal method is to add a version number; e.g., dog dog dog become dog1 dog2 dog3.

This is for internal use by the Distiller only.

Parameters:
object_name - - the new object name

registerRegionInUse

public void registerRegionInUse(Region region)
Records that a region is in use so it can be rendered as a metaoverlay.

Parameters:
region - - the region

setClusterID

public void setClusterID(int cluster_id)
Sets the cluster ID of this inference, which is used to relate object inferences across multiple Monte Carlo run sets.

Parameters:
cluster_id - - the cluster ID
See Also:
getClusterID()

setMonteCarloRunSet

public void setMonteCarloRunSet(MonteCarloRunSet monte_carlo_run_set)
Sets the Monte Carlo run set this object inference resides in.

Parameters:
monte_carlo_run_set - - the run set
See Also:
getMonteCarloRunSet()

setTransparency

public void setTransparency(float transparency)
Sets the transparency value to be used in rendering this inference. This is normally used just for the composite Sandbox.

Parameters:
transparency - - the transparency

setVariance

public void setVariance(Position position_variance,
                        Dimensions dimensions_variance,
                        Attitude attitude_variance)
Sets the variance of the position, dimensions, and attitude of this object inference. The variance is the delta from the mean of a population or sample of object inferences.

Parameters:
position_variance - - the position variance
dimensions_variance - - the dimensions variance
attitude_variance - - the attitude variance
See Also:
getVariance(), Distiller

toHTMLString

public java.lang.String toHTMLString()
Returns an indented HTML string representation of this object to be displayed by the Representation Viewer.

Returns:
the String representation
See Also:
RepresentationViewer

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
the String representation
See Also:
Support.toPrettyString(java.lang.String)