io.loader.shared
Class SkeletonParser

java.lang.Object
  extended by io.loader.shared.SkeletonParser
Direct Known Subclasses:
SkeletonParser2D, SkeletonParser3D

public abstract class SkeletonParser
extends java.lang.Object

Abstract class to handle the parsing of 2D and 3D skeletons, respectively.


Field Summary
protected  java.util.List<SkeletonNode> allEndnodes
          list containing all skeleton end nodes
protected  java.util.List<SkeletonNode> allJunctionNodes
          list containing all skeleton junction nodes
protected  Config config
           
protected  org.apache.log4j.Logger logger
          logger instance
protected  SkeletonObject skeletonObject
          meta skeleton object
 
Constructor Summary
SkeletonParser(Config config)
          Constructor.
 
Method Summary
protected  void deleteUnconnectedComponents(SkeletonGraph graph)
          In some cases, the skeletons might not be connected (that is, there are "holes" in the skeleton which makes the sampling of the whole paths impossible).
protected  void deleteUnnecessaryBranches(SkeletonGraph graph)
          Deletes short branches from the skeleton, based on their length.
protected  void extractPaths(SkeletonGraph graph)
          From the skeleton graph, extract all skeleton paths.
protected abstract  void getCriticalNodes()
          extract all critical nodes, that is, end nodes and junction nodes
protected abstract  void getDistanceTransform()
          compute and set the shape's distance transform
 SkeletonObject getSkeleton()
          parse the skeleton and return it, according to the specified parameters.
protected  void parse()
          Parse the skeleton.
protected  void preprocessGraph(SkeletonGraph graph)
          In case that the skeleton is not continous, throw out skeleton parts that are not connected to the "main skeleton"
protected abstract  java.util.Map<SkeletonNode,java.util.List<SkeletonBranch>> sampleParts()
          sample all SkeletonBranches emanating from each critical node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

skeletonObject

protected SkeletonObject skeletonObject
meta skeleton object


allEndnodes

protected java.util.List<SkeletonNode> allEndnodes
list containing all skeleton end nodes


allJunctionNodes

protected java.util.List<SkeletonNode> allJunctionNodes
list containing all skeleton junction nodes


config

protected Config config

logger

protected org.apache.log4j.Logger logger
logger instance

Constructor Detail

SkeletonParser

public SkeletonParser(Config config)
Constructor. Create a new skeleton object and skeleton to make sure both are initialized before usage.

Method Detail

getDistanceTransform

protected abstract void getDistanceTransform()
                                      throws java.io.IOException
compute and set the shape's distance transform

Throws:
java.io.IOException - if the shape file could not be found

sampleParts

protected abstract java.util.Map<SkeletonNode,java.util.List<SkeletonBranch>> sampleParts()
                                                                                   throws InvalidSkeletonException
sample all SkeletonBranches emanating from each critical node. For each critical node, a list of all emanating parts is stored. The key in the map is the critical node, the value is the list of all skeleton branches emanating from the node that is the key.

Returns:
a map containing all skeleton branches. The key in the return map is a critical node, the value in the map is a list of all skeleton branches emanating from the node key.
Throws:
InvalidSkeletonException

getCriticalNodes

protected abstract void getCriticalNodes()
                                  throws InvalidSkeletonException
extract all critical nodes, that is, end nodes and junction nodes

Throws:
InvalidSkeletonException

getSkeleton

public SkeletonObject getSkeleton()
                           throws InvalidSkeletonException,
                                  java.io.IOException
parse the skeleton and return it, according to the specified parameters.

Returns:
ready-to-use skeleton
Throws:
InvalidSkeletonException - - if the skeleton seems to be broken
java.io.IOException - if one of the input file has not been found

parse

protected void parse()
              throws InvalidSkeletonException,
                     java.io.IOException
Parse the skeleton.

Throws:
InvalidSkeletonException - if the skeleton seems to be broken
java.io.IOException - if one of the input files was not found

deleteUnconnectedComponents

protected void deleteUnconnectedComponents(SkeletonGraph graph)
In some cases, the skeletons might not be connected (that is, there are "holes" in the skeleton which makes the sampling of the whole paths impossible). Based on the skeleton's skeleton graph, the disconnected parts are just ignored and deleted from the skeleton.

Parameters:
graph - the skeleton's skeleton graph

deleteUnnecessaryBranches

protected void deleteUnnecessaryBranches(SkeletonGraph graph)
Deletes short branches from the skeleton, based on their length. See Preprocessor.deleteSpuriousBranches(SkeletonObject, Config) for more details.

Parameters:
graph - the skeleton's skeleton graph

preprocessGraph

protected void preprocessGraph(SkeletonGraph graph)
In case that the skeleton is not continous, throw out skeleton parts that are not connected to the "main skeleton"

Parameters:
graph - the graph where the unconnected components will be deleted

extractPaths

protected void extractPaths(SkeletonGraph graph)
                     throws InvalidSkeletonException
From the skeleton graph, extract all skeleton paths. The skeleton graph is a skeleton reduction to just end and junction nodes. With the shortest path algorithm on a DAG, the shortest paths can be extracted

Parameters:
graph - the skeleton graph
Throws:
InvalidSkeletonException - - if the skeleton seems to be broken