io.loader.shared
Class NodeArea

java.lang.Object
  extended by io.loader.shared.NodeArea
Direct Known Subclasses:
NodeArea2D, NodeArea3D

public abstract class NodeArea
extends java.lang.Object

This is a helper class to handle ambigous junction nodes in some constellations of nodes. In 2D as well as in 3D, in some node constellations it can happen that in one crossing of skeleton branches, multiple skeleton nodes are recognized as junction nodes as they all have more than two neighbors. These junction nodes can than be grouped into a NodeArea. The cleanNodeArea() function will try to pick one of the nodes in a node area more or less wise.


Field Summary
protected  java.util.List<SkeletonNode> junctionNodes
          List of all found junction nodes, potentially containing redundant nodes.
protected  org.apache.log4j.Logger logger
          logger instance
 
Constructor Summary
NodeArea()
          Constructor.
NodeArea(java.util.List<SkeletonNode> nodes)
          Constructor.
 
Method Summary
 void addNode(SkeletonNode node)
           
abstract  SkeletonNode cleanNodeArea()
          extract the prefered junction node from this node area.
 boolean contains(SkeletonNode n)
          Test of this node area contains the specified skeleton node.
 boolean needsCleaning()
          Test if this is a "valid" Node area.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

junctionNodes

protected java.util.List<SkeletonNode> junctionNodes
List of all found junction nodes, potentially containing redundant nodes.


logger

protected org.apache.log4j.Logger logger
logger instance

Constructor Detail

NodeArea

public NodeArea()
Constructor. Create an empty list of skeleton nodes.


NodeArea

public NodeArea(java.util.List<SkeletonNode> nodes)
Constructor. Directly set the list of found junction nodes in this node area.

Parameters:
nodes - the list of nodes in this area
Method Detail

cleanNodeArea

public abstract SkeletonNode cleanNodeArea()
                                    throws InvalidSkeletonException
extract the prefered junction node from this node area.

Returns:
the prefered junction node from this NodeArea
Throws:
InvalidSkeletonException - if the skeleton is broken

addNode

public void addNode(SkeletonNode node)
             throws InvalidSkeletonException
Throws:
InvalidSkeletonException

contains

public boolean contains(SkeletonNode n)
                 throws InvalidSkeletonException
Test of this node area contains the specified skeleton node.

Parameters:
n - the skeleton node to test this node area for
Returns:
true if this node area contains the specified skeleton node, false if not
Throws:
InvalidSkeletonException

needsCleaning

public boolean needsCleaning()
Test if this is a "valid" Node area. A node area is assumed as needed if there are more junction nodes than one contained in it. Otherwise, it does not have to be "cleaned".

Returns:
true if this node area has to be cleaned, false if not

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object