Commit 385e76fa authored by rhaase's avatar rhaase
Browse files

Added comments. Made some things public which may be useful

parent 8a9b03b1
......@@ -20,11 +20,20 @@ import java.util.ArrayList;
public class PathDrawer {
ImagePlus target;
/**
* Initialise a drawer
* @param target Image to draw in
*/
public PathDrawer(ImagePlus target)
{
this.target = target;
}
/**
* Draw a path
* @param path Path to draw
* @param color Color to use
*/
public void drawPath(ArrayList<Edge> path, Color color)
{
for (Edge edge : path)
......@@ -33,6 +42,12 @@ public class PathDrawer {
}
}
/**
* Convenience function to quickly draw all leafs of a graph
* @param skeletonAnalyser given object containing a graph
* @param imp Image to draw in
* @param color Color to draw with
*/
public static void drawAllLeafs(SkeletonAnalyser skeletonAnalyser, ImagePlus imp, Color color)
{
ArrayList<Vertex> leafs = skeletonAnalyser.getLeafs();
......@@ -45,6 +60,12 @@ public class PathDrawer {
}
/**
* Convenience function to quickly draw all Edges and Junctions of a given graph
* @param skeletonAnalyser given object containing a graph
* @param imp Image to draw in
* @param color Color to draw with
*/
public static void drawAllPathsToLargestJunction(SkeletonAnalyser skeletonAnalyser, ImagePlus imp, Color color)
{
Vertex largestJunction = skeletonAnalyser.getLargestJunction();
......@@ -69,7 +90,12 @@ public class PathDrawer {
}
}
private void drawEdge(Edge edge, Color color) {
/**
* Draw a single edge
* @param edge Edge to draw
* @param color Color to use
*/
public void drawEdge(Edge edge, Color color) {
drawVertex(edge.getV1(), color);
drawVertex(edge.getV2(), color);
......@@ -88,17 +114,27 @@ public class PathDrawer {
drawPolygon(polyline, color);
}
private void drawVertex(Vertex v, Color color) {
/**
* Draw a single vertex. The vertex is shown as circle at its center position
* @param vertex Vertex to draw
* @param color Color to use
*/
public void drawVertex(Vertex vertex, Color color) {
//drawPoint(v.getPoints().get(0), Color.red);
sc.fiji.analyzeSkeleton.Point average = SkeletonAnalyser.getCenterOfJunction(v);
Point average = SkeletonAnalyser.getCenterOfJunction(vertex);
drawPoint(average, color);
drawPoint(average, color, 1);
}
private void drawPoint(sc.fiji.analyzeSkeleton.Point point, Color color) {
double radius = 1;
/**
* Draw a single point as a circle with fixed radius
* @param point Point to draw
* @param color Color to use
* @param radius radius of the circle to draw
*/
public void drawPoint(Point point, Color color, double radius) {
Roi roi = new OvalRoi(point.x-radius / 2+0.5, point.y- radius / 2+0.5, radius+0.5, radius+0.5);
roi.setStrokeColor(color);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment