geometry.object
Class Skeleton

java.lang.Object
  extended by geometry.object.Skeleton

public class Skeleton
extends java.lang.Object

A data structure to hold information about the skeleton data.

Basically, a skeleton is defined by its end nodes, ordered in clockwise direction after traversing the object contour. For each of these end nodes, a list of all emanating skeleton paths from this end node is known.


Field Summary
private  java.util.List<SkeletonNode> endnodes
          list containing all skeleton endnodes.
private  org.apache.log4j.Logger logger
          logger instance
private  java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> paths
          list containing all skeleton paths emanating from every skeleton node.
 
Constructor Summary
Skeleton()
           
 
Method Summary
 void addPaths(java.util.List<SkeletonPath> paths, SkeletonNode endnode)
          add a list of paths to the skeleton's paths.
 java.util.List<SkeletonNode> getAllEndNodes()
          Return the skeleton's end nodes.
 java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> getAllSkeletonPaths()
          Get all skeleton paths.
 SkeletonPath getSkeletonPathByEndnodes(SkeletonNode node1, SkeletonNode node2)
          get the skeleton path between the specified end nodes.
 java.util.List<SkeletonPath> getSkeletonPathsByEndnode(SkeletonNode node)
          Get a list of all skeleton paths emanating from the specified end node.The specified end node has to be the key to the path map to be a match.
 void setAllEndnodes(java.util.List<SkeletonNode> endnodes)
          set the skeleton's endnodes.
 void setPaths(java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> allPaths)
          set the skeleton's skeleton paths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endnodes

private java.util.List<SkeletonNode> endnodes
list containing all skeleton endnodes. should be ordered clockwise, traversing the contour.


logger

private org.apache.log4j.Logger logger
logger instance


paths

private java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> paths
list containing all skeleton paths emanating from every skeleton node. the key of the map is the skeleton node the list of paths is emanating from.

Constructor Detail

Skeleton

public Skeleton()
Method Detail

addPaths

public void addPaths(java.util.List<SkeletonPath> paths,
                     SkeletonNode endnode)
add a list of paths to the skeleton's paths.

The specified list should be all skeleton paths emanating from the specified end node.

If the old map of paths previously contained a key with the value of the specified endnode, the old value is replaced.

Parameters:
paths - a list of paths to be added
endnode - the endnode the specified paths belong to

getAllEndNodes

public java.util.List<SkeletonNode> getAllEndNodes()
Return the skeleton's end nodes.

They should have been already set by an external algorithm as a sorted list. Otherwise (if the list is still null at this point) the end nodes are extracted from the skeleton paths. This could result in unsorted end nodes. If no skeleton paths are given either, null is returned.

Returns:
list of all endnodes, null if no end nodes can be extracted.

getAllSkeletonPaths

public java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> getAllSkeletonPaths()
Get all skeleton paths. If no paths were set yet, a new, empty map is created.

Returns:
all skeleton paths in this skeleton, key in the hash map is the endnode these paths belong to.

getSkeletonPathsByEndnode

public java.util.List<SkeletonPath> getSkeletonPathsByEndnode(SkeletonNode node)
                                                       throws InvalidSkeletonException
Get a list of all skeleton paths emanating from the specified end node.The specified end node has to be the key to the path map to be a match. See SkeletonNode.equals(SkeletonNode) for more information on when two skeleton nodes are assumed as equal.

Parameters:
node - the startpoint of all returned skeleton paths
Returns:
list of all skeleton paths emanating from the specified node, null if no matching skeleton paths are found.
Throws:
InvalidSkeletonException - if the specified node is no end node, but an equal node is found, or other way around.

getSkeletonPathByEndnodes

public SkeletonPath getSkeletonPathByEndnodes(SkeletonNode node1,
                                              SkeletonNode node2)
                                       throws InvalidSkeletonException
get the skeleton path between the specified end nodes.

For being a match, node1 has to be the key in the path map, and the path's first endnode has to be equals node1, and the path's second endnode has to be equals node2.

See SkeletonNode.equals(SkeletonNode) for more information on when two skeleton nodes are assumed as equal.

Parameters:
node1 - key in the path map and the skeleton path's first end node
node2 - the skeleton path's second end node
Returns:
skeletonpath between these two endnodes
Throws:
InvalidSkeletonException

setAllEndnodes

public void setAllEndnodes(java.util.List<SkeletonNode> endnodes)
set the skeleton's endnodes. Please make sure they are sorted clockwise along the contour.

Parameters:
endnodes - a list of the skeleton's endnodes

setPaths

public void setPaths(java.util.Map<SkeletonNode,java.util.List<SkeletonPath>> allPaths)
set the skeleton's skeleton paths. There should be an entry for each skeleton end node, and the coresponding list should contain all paths emanating from the node specified by the key.

Parameters:
allPaths - the skeleton paths to be set.