|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.MiToBo.core.datatypes.MTBGraph
de.unihalle.informatik.MiToBo.core.datatypes.MTBNeuriteSkelGraph
public class MTBNeuriteSkelGraph
The class implements a neurite skeleton graph (NSG), based on the skeleton of a neurite region. The NSG is directed, in the way that exact one START node (mostly the point near the neuron cell body area) exists, which can have one or more output edges and no input edges. By the way, there are some other nodes from type BRANCH or END inside the graph. BRANCH nodes: have one input edge and two or more out edges END nodes: have exact one input edge and no output edges The NSG is build by skeleton traversing, beginning at one given node. The direction is implicit corrected, so that at every time there is a direct "flow" from the START node to all END nodes. So the START node is connected with every END node via exact one path. If the START nodes is changed, the directness of the graph is automatically corrected, and the old node becomes automatically a BRANCH or a END node. The edges hold the pixels of the skeleton between the nodes. It is possible to get all paths from the START node to all END nodes, get the longest path in the whole graph, and several other operations, needed for a NSG. The graph is always free of circles. If an circle exists in the underlying skeleton, the circle is disconnected in two paths (due to the approach of building the graph).
MTBGraph
,
MTBGraphEdge
,
MTBNeuriteSkelGraphNode
Field Summary | |
---|---|
private int |
background_color
|
private int |
color_graphEdge
Color of graph edge points. |
private int |
color_graphNode
Color of graph node points. |
private int |
color_skelBranch
Color of pre-detected branch points. |
private int |
color_skelSpecial
Color of pre-detected special points, for example a 2x2 skeleton region. |
private int |
color_skelVisitB
Color of visited graph branch points. |
private int |
color_skelVisitE
Color of visited graph edge points. |
private int[][] |
delta
X- and Y-coordinate differences of the 8-way neighbors. |
private int |
height
Skeleton image size in y-direction. |
private int |
maxSpineLength
|
private int |
regionID
Region ID of the corresponding neurite region to this neurite skeleton graph. |
private int |
skeleton_color
The color of the skeleton in the binary image. |
private int |
width
Skeleton image size in x-direction. |
Fields inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBGraph |
---|
directed, edges, nodes, numberOfEdges, numberOfNodes |
Constructor Summary | |
---|---|
MTBNeuriteSkelGraph()
Standard constructor. |
|
MTBNeuriteSkelGraph(int _maxSpineLength)
Constructor that creates an empty directed MTBNeuriteSkelGraph with defined maximum spine length. |
|
MTBNeuriteSkelGraph(java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> skelNodes,
java.util.Vector<MTBGraphEdge> skelEdges,
int _maxSpineLength,
int _width,
int _heigth)
Constructor to create an directed MTBNeuriteSkelGraph with the given MTBSkeletonGraphNodes and MTBGraphEdges. |
Method Summary | |
---|---|
private boolean |
build(int xx,
int yy,
MTBImageByte skelImg,
MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> parentNode)
Internal method to create the graph from the skeleton image. |
boolean |
buildSkeletonGraph(int x,
int y,
int w,
int h,
MTBImageByte skeletonImg,
int skelColor)
Build the skeleton graph from a given binary skeleton image and a given starting point to build up the graph. |
MTBNeuriteSkelGraph |
clone()
|
private void |
correctDirectness(MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> rootNode)
Method to correct the direction of every edge inside the skeleton graph from a given root node. |
private void |
depthFirstSearch(java.util.Vector<java.awt.geom.Point2D.Double> pixels,
java.util.Vector<java.lang.Integer> parents,
MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> startNode,
int label)
Depth-first-search to collect data from the neurite skeleton graph in a SWC file like format. |
java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> |
getAllPaths(boolean includeSpines)
Get the pixels of all paths of the neurite skeleton graph. |
void |
getAllPixels(java.util.Vector<java.awt.geom.Point2D.Double> pixels)
Get all pixels of the neurite skeleton graph from the nodes and edges. |
private void |
getAllPixels(java.util.Vector<java.awt.geom.Point2D.Double> pixels,
MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> tmpNode)
Get all pixels of the neurite skeleton graph from the nodes and edges. |
java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> |
getBranchNodes()
Get all branch nodes of the MTBNeuriteSkelGraph. |
java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> |
getEndNodes()
Get all end nodes of the MTBNeuriteSkelGraph. |
int |
getHeight()
Get skeleton graph image size in y direction. |
java.util.Vector<java.awt.geom.Point2D.Double> |
getLongestPath(boolean includeSpines)
Get the pixels of the longest path of the neurite skeleton graph. |
private void |
getPath(java.util.Vector<java.awt.geom.Point2D.Double> p,
MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> n)
Internal method to traverse the path and return the pixel list. |
int |
getRegionID()
Get the region id. |
java.util.Vector<java.awt.geom.Point2D.Double> |
getShortestPath(boolean includeSpines)
Get the pixels of the shortest path of the neurite skeleton graph. |
java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> |
getSkeletonGraphNodes()
Get all nodes of the MTBNeuriteSkelGraph as MTBNeuriteSkelGraphNodes. |
java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> |
getSpinePaths()
Get the pixels of all spine paths of the neurite skeleton graph. |
MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> |
getStartNode()
Get the start node of the MTBNeuriteSkelGraph. |
int |
getWidth()
Get skeleton graph image size in x direction. |
private MTBImageByte |
markBranchPoints(MTBImageByte skelImg)
Mark branch/special points as first step before building up the whole skeleton graph. |
void |
print()
Print the neurite skeleton graph informations. |
void |
setRegionID(int id)
Set the region id. |
void |
setStartNode(MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> node)
Set a new start node. |
MTBImageByte |
toByteImage()
Draw the skeleton graph into a binary image. |
MTBImageRGB |
toImage()
Visualize the skeleton graph as RGB image. |
MTBImageRGB |
toImage(MTBImageRGB rgbImage)
Draw the skeleton graph in the given RGB image. |
void |
toSWC(java.lang.String fileName,
MTBImageByte neuronImage)
Method to save neurite skeleton graph as SWC file. |
Methods inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBGraph |
---|
addEdge, addNode, getEdgeNum, getEdges, getGraphCost, getNodeNum, getNodes, isDirected, removeEdge, removeNode |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int background_color
private final int color_graphEdge
private final int color_graphNode
private final int color_skelBranch
private final int color_skelSpecial
private final int color_skelVisitB
private final int color_skelVisitE
private final int[][] delta
private int height
private int maxSpineLength
private int regionID
private int skeleton_color
private int width
Constructor Detail |
---|
public MTBNeuriteSkelGraph()
public MTBNeuriteSkelGraph(int _maxSpineLength)
_maxSpineLength
- public MTBNeuriteSkelGraph(java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> skelNodes, java.util.Vector<MTBGraphEdge> skelEdges, int _maxSpineLength, int _width, int _heigth) throws MTBNeuriteSkelGraphException
skelNodes
- vector of MTBNeuriteSkelGraphNodesskelEdges
- vector of MTBGraphEdges
MTBNeuriteSkelGraphException
Method Detail |
---|
private boolean build(int xx, int yy, MTBImageByte skelImg, MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> parentNode)
xx
- point coordinate in x-directionyy
- point coordinate in y-directionskelImg
- the binary skeleton imageparentNode
- parent node of the current point
public boolean buildSkeletonGraph(int x, int y, int w, int h, MTBImageByte skeletonImg, int skelColor)
Build the skeleton graph from a given binary skeleton image and a given starting point to build up the graph. Build definition: The graph is build from a given starting point (mostly a end point of the skeleton, near the neuron cell body). All other points are marked automatically by building up the graph. Branch points are marked as BRANCH nodes, end points are marked as END nodes and edge points are added to the edge data structure. BRANCH nodes: have one input edge and two or more out edges END nodes: have exact one input edge and no output edges By building up the graph, 4-way neighbors are visited first, diagonal neighbors are visited in the second step. The graph is always free of circles. If an circle exists in the underlying skeleton, the circle is disconnected in two paths (due to the approach of building the graph).
x
- starting point coordinate in x-directiony
- starting point coordinate in y-directionw
- width of the skeleton imageh
- height of the skeleton imageskeletonImg
- the binary skeleton imageskelColor
- color of the skeleton, the background is set to the opposite
color, for example the skeleton is 0, then the background is set
to 255 and vice versa
public MTBNeuriteSkelGraph clone()
clone
in class java.lang.Object
private void correctDirectness(MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> rootNode)
private void depthFirstSearch(java.util.Vector<java.awt.geom.Point2D.Double> pixels, java.util.Vector<java.lang.Integer> parents, MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> startNode, int label)
pixels
- empty vector where skeleton pixels will be storedparents
- empty vector where parents of each skeleton pixels will be storedstartNode
- start node for traversing graph and collect datalabel
- label for parent of start node (root)public java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> getAllPaths(boolean includeSpines)
includeSpines
-
public void getAllPixels(java.util.Vector<java.awt.geom.Point2D.Double> pixels)
Get all pixels of the neurite skeleton graph from the nodes and edges. Pixel collection starts at the start node of the skeleton graph. WARNING!!! The specific order within the list depends on the edge direction between the single nodes. Order of the single edges depends on the build process.
pixels
- empty list to be filledprivate void getAllPixels(java.util.Vector<java.awt.geom.Point2D.Double> pixels, MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> tmpNode)
Get all pixels of the neurite skeleton graph from the nodes and edges. WARNING!!! The specific order within the list depends on the edges and their direction between the single nodes. Order of the single edges depends on the build process.
pixels
- empty list to be filledtmpNode
- current node for pixel collectionpublic java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> getBranchNodes()
public java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> getEndNodes()
public int getHeight()
public java.util.Vector<java.awt.geom.Point2D.Double> getLongestPath(boolean includeSpines)
includeSpines
-
private void getPath(java.util.Vector<java.awt.geom.Point2D.Double> p, MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> n)
public int getRegionID()
public java.util.Vector<java.awt.geom.Point2D.Double> getShortestPath(boolean includeSpines)
includeSpines
-
public java.util.Vector<MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double>> getSkeletonGraphNodes()
public java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> getSpinePaths()
public MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> getStartNode()
public int getWidth()
private MTBImageByte markBranchPoints(MTBImageByte skelImg)
skelImg
- binary skeleton image
public void print()
print
in class MTBGraph
public void setRegionID(int id)
public void setStartNode(MTBNeuriteSkelGraphNode<java.awt.geom.Point2D.Double> node)
node
- new start nodepublic MTBImageByte toByteImage()
public MTBImageRGB toImage()
public MTBImageRGB toImage(MTBImageRGB rgbImage)
public void toSWC(java.lang.String fileName, MTBImageByte neuronImage)
fileName
- filename for saving the SWC fileneuronImage
- if radii for each skeleton point should be calculated, a image
must be given to calculate the distance map of the neuron region
and get radius of each skeleton point, can be null
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |