io.loader.load3D
Class SkeletonParser3D

java.lang.Object
  extended by io.loader.shared.SkeletonParser
      extended by io.loader.load3D.SkeletonParser3D

public class SkeletonParser3D
extends SkeletonParser

Load a skeleton from the input data.

To load one 3D skeleton, 4 input files are needed:


Field Summary
private  double depthDim
          the voxelsÄ z dimension
private  double heightDim
          the voxels' y dimension
private  org.apache.log4j.Logger logger
          the logger instance
private  int[][][] segmentationcube
          the cube containing the volume information
private  java.lang.String shapeinfoPath
          the path to the volume meta information file
private  java.lang.String shapePath
          the path to the volume data
private  int[][][] thinningcube
          the cube containing the skeleton information
private  java.lang.String thinninginfoPath
          the path tp the skeleton meta information file
private  java.lang.String thinningPath
          the path to the skeleton data
private  double widthDim
          the voxels' x dimension
 
Fields inherited from class io.loader.shared.SkeletonParser
allEndnodes, allJunctionNodes, config, skeletonObject
 
Constructor Summary
SkeletonParser3D(java.lang.String thinningPath, java.lang.String thinninginfoPath, java.lang.String shapePath, java.lang.String shapeinfoPath, Config config)
          Constructor.
 
Method Summary
private  void cleanJunctionNodes(java.util.List<SkeletonNode> junctionnodes, int[][][] thinningcube)
          Clean the list of junction nodes.
protected  void getCriticalNodes()
          extract all critical nodes, that is, end nodes and junction nodes
 void getDistanceTransform()
          compute and set the shape's distance transform
 int[][][] getSegmentationcube()
          Get the 3D cube containing the volume data (0 = background, 255 = foreground)
 int[][][] getThinningCube()
          Read the thinning cube.
private  int[][][] readBin(java.lang.String file, int width, int height, int depth)
          read raw data and save it to 1D-array
private  void readThinningInfo()
          read thinning info file
protected  java.util.Map<SkeletonNode,java.util.List<SkeletonBranch>> sampleParts()
          sample all SkeletonBranches emanating from each critical node.
 void setSegmentationcube(int[][][] segmentationcube)
          Set the volume data.
 
Methods inherited from class io.loader.shared.SkeletonParser
deleteUnconnectedComponents, deleteUnnecessaryBranches, extractPaths, getSkeleton, parse, preprocessGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

widthDim

private double widthDim
the voxels' x dimension


heightDim

private double heightDim
the voxels' y dimension


depthDim

private double depthDim
the voxelsÄ z dimension


thinningPath

private final java.lang.String thinningPath
the path to the skeleton data


thinninginfoPath

private final java.lang.String thinninginfoPath
the path tp the skeleton meta information file


shapePath

private final java.lang.String shapePath
the path to the volume data


shapeinfoPath

private final java.lang.String shapeinfoPath
the path to the volume meta information file


thinningcube

private final int[][][] thinningcube
the cube containing the skeleton information


segmentationcube

private int[][][] segmentationcube
the cube containing the volume information


logger

private final org.apache.log4j.Logger logger
the logger instance

Constructor Detail

SkeletonParser3D

public SkeletonParser3D(java.lang.String thinningPath,
                        java.lang.String thinninginfoPath,
                        java.lang.String shapePath,
                        java.lang.String shapeinfoPath,
                        Config config)
                 throws java.io.IOException
Constructor.

Parameters:
thinningPath - - path to the skeleton data file
thinninginfoPath - - path to the skeleton meta data file (like width, height)
shapePath - - path to the shape data file
shapeinfoPath - - path to the meta data shape file (like width, height)
Throws:
java.io.IOException
Method Detail

getDistanceTransform

public void getDistanceTransform()
                          throws java.io.IOException
Description copied from class: SkeletonParser
compute and set the shape's distance transform

Specified by:
getDistanceTransform in class SkeletonParser
Throws:
java.io.IOException - if the shape file could not be found

getSegmentationcube

public int[][][] getSegmentationcube()
                              throws java.io.IOException
Get the 3D cube containing the volume data (0 = background, 255 = foreground)

Returns:
the segmentationcube the volume data
Throws:
java.io.IOException - if the shape path could not be found

setSegmentationcube

public void setSegmentationcube(int[][][] segmentationcube)
Set the volume data.

Parameters:
segmentationcube - the segmentationcube to set

getCriticalNodes

protected void getCriticalNodes()
                         throws InvalidSkeletonException
Description copied from class: SkeletonParser
extract all critical nodes, that is, end nodes and junction nodes

Specified by:
getCriticalNodes in class SkeletonParser
Throws:
InvalidSkeletonException

sampleParts

protected java.util.Map<SkeletonNode,java.util.List<SkeletonBranch>> sampleParts()
                                                                          throws InvalidSkeletonException
Description copied from class: SkeletonParser
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.

Specified by:
sampleParts in class SkeletonParser
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

cleanJunctionNodes

private void cleanJunctionNodes(java.util.List<SkeletonNode> junctionnodes,
                                int[][][] thinningcube)
                         throws InvalidSkeletonException
Clean the list of junction nodes.

In some constellations, it might happen that "wrong" junction nodes are recognized as juncion nodes, such that multiple junction nodes are directly adjacent. This is information we have no use for, so one of the adjacent junction nodes has to be selected as "real" junction nodes. In this function, the junction node with the most surface neighbors is selected as the real junction node.

The class member SkeletonParser.allJunctionNodes is manipulated directly, so no return type is needed.

Parameters:
junctionnodes - - list of all junction nodes - probably containing "wrong" junction nodes
thinningcube - - 3D array containing skeleton information
Throws:
InvalidSkeletonException - - if skeleton seems to be broken

getThinningCube

public int[][][] getThinningCube()
                          throws java.io.IOException
Read the thinning cube.

Returns:
1d-array, containing the data read in the thinning file specified by thinningPath
Throws:
java.io.IOException - if the file was not found

readBin

private int[][][] readBin(java.lang.String file,
                          int width,
                          int height,
                          int depth)
                   throws java.io.IOException
read raw data and save it to 1D-array

Parameters:
file - - path to file
Returns:
1D array containing all entries in the specified file
Throws:
java.io.IOException - - if file could not be found

readThinningInfo

private void readThinningInfo()
                       throws java.io.IOException
read thinning info file

Throws:
java.io.IOException