Converting Graphviz dot file to image file using dot utility

bsanghvi's picture

OpenBiomind generates a Graphviz dot file as an output of GraphFeatures task. In the GUI, we thought to provide a image of the graph too. This was simply achieved using the dot utility provided by Graphviz.

Following snippet shows a sample usage (working example can be seen in this snippet was modified from revision 46 of GraphFeaturesWizard):

// final String graphvizDotUtilityPath = …
// final String imageType = … // “png”, “gif”, or other supported type
// final String sourceDotFilePath = …
// final String outputImageFilePath = …

final List commandList = new ArrayList();
commandList.add(graphvizDotUtilityPath);
commandList.add(“-T” + imageType);
commandList.add(sourceDotFilePath);
commandList.add(“-o” + outputImageFilePath);

// java.lang.Process
// java.lang.ProcessBuilder
final Process process = new ProcessBuilder(commandList).start();

Following is the snapshot of a workbench after opening the graph (image):
Workbench-GraphFeatures