viper.comparison
Class ViperPE

java.lang.Object
  extended byviper.comparison.ViperPE

public class ViperPE
extends java.lang.Object

This class offers a function to compare two Descriptor data files.

Running the software

java viper.comparison.ViperPE -options
Options include:

Properties File Format

Author:
David Doermann, David Mihalcik, Felix Suhenko

Constructor Summary
ViperPE()
          Processes a properties file into ViperPE internal state variables.
 
Method Summary
static com.jrefinery.chart.JFreeChart createChart(java.lang.String name, com.jrefinery.data.Dataset data)
          Creates a new chart for the given data set
static java.util.Map getOptions(java.lang.String[] args)
          Parses the options into a hashmap.
static void main(java.lang.String[] args)
          The main program block of the command line version of the Ground Truth File Comparison software.
static java.io.PrintWriter openFileForWriting(java.lang.String fileName)
          Opens the file with the specified name for writing.
static DescriptorConfigs parseDescriptorConfig(java.lang.String configFileName, java.lang.String dataFileName)
          Reads in config information from a gtf file.
static DescriptorData parseDescriptorData(DescriptorConfigs cfgs, java.lang.String dataFileName, EvaluationParameters epf, java.io.PrintWriter log)
          Reads in data information from a gtf file.
static void printChartPng(java.lang.String fileName, com.jrefinery.chart.JFreeChart chart, int width, int height)
          Saves the given chart a PNG file.
static void printChartSvg(java.lang.String fileName, com.jrefinery.chart.JFreeChart chart, int width, int height)
          Prints out the results as an svg chart.
static void printGraphs(java.util.Map data, java.lang.String prefix, java.lang.String suffix)
          Prints out all the graphs for the given set of data.
static void printUsage()
          Print usage.
static void printUsage(int error, java.lang.Throwable trace)
          Prints out some of the basic flags.
static void printVersion()
          Prints out version information.
 void run()
          Runs the application.
 void setProperties(java.util.Properties props)
          Sets the properties associated with this run of the performance evaluator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViperPE

public ViperPE()
Processes a properties file into ViperPE internal state variables.

Method Detail

printUsage

public static void printUsage()
Print usage.


printUsage

public static void printUsage(int error,
                              java.lang.Throwable trace)
Prints out some of the basic flags. For more, see the javadoc or the README.

Parameters:
error - the error type
trace - the throwable associated with the error

printVersion

public static void printVersion()
Prints out version information. It does not include any RCS variables.


getOptions

public static java.util.Map getOptions(java.lang.String[] args)
Parses the options into a hashmap.

Parameters:
args - the command line arguments
Returns:
the argument map, or null if the arguments are malformed. (It also prints out usage in the latter case.)

main

public static void main(java.lang.String[] args)
The main program block of the command line version of the Ground Truth File Comparison software.

Parameters:
args - The command line arguments are specified at the top. For the properties, see the package listing.

setProperties

public void setProperties(java.util.Properties props)
                   throws BadDataException,
                          ImproperMetricException
Sets the properties associated with this run of the performance evaluator.

Parameters:
props - the properties
Throws:
BadDataException - if some of the properties contain errors in syntax of viper data
ImproperMetricException - if some of the properties contain references to unknowm metrics, or if they initialize the metrics incorrectly

openFileForWriting

public static java.io.PrintWriter openFileForWriting(java.lang.String fileName)
Opens the file with the specified name for writing. Overwrites the file if it exists. Silently fails if there is an I/O exception by setting to null. If filename is null, an empty string, or an invalid file, this returns null. If the string is a dash, "-", it returns System.out.

Parameters:
fileName - The file to open for writing.
Returns:
A new PrintWriter or null

parseDescriptorConfig

public static DescriptorConfigs parseDescriptorConfig(java.lang.String configFileName,
                                                      java.lang.String dataFileName)
                                               throws java.io.IOException,
                                                      BadDataException
Reads in config information from a gtf file.

Parameters:
configFileName - File name of the config file - only applicable to old file format, which can take multiple files and glue them together
dataFileName - The data file. If old format, will use config file if is not null, and this otherwise. If xml format, only uses data file.
Returns:
the parsed configuration information
Throws:
BadDataException - if the parseConfig or addDesConfig method throws it, or if an xml file is given two file names.
java.io.IOException - if there is an io exception while parsing

parseDescriptorData

public static DescriptorData parseDescriptorData(DescriptorConfigs cfgs,
                                                 java.lang.String dataFileName,
                                                 EvaluationParameters epf,
                                                 java.io.PrintWriter log)
                                          throws BadDataException,
                                                 java.io.IOException
Reads in data information from a gtf file.

Parameters:
cfgs - Configs, presumably from parseDescriptorConfig
dataFileName - The data file to parse.
epf - used to run the input filter
log - recipient of the various error and notification messsages
Returns:
the data taken from the given file that meets the filters
Throws:
BadDataException - if the parseConfig or addDesConfig method throws it, or if an xml file is given two file names.
java.io.IOException - if there is an io exception while parsing

run

public void run()
Runs the application.


printGraphs

public static void printGraphs(java.util.Map data,
                               java.lang.String prefix,
                               java.lang.String suffix)
Prints out all the graphs for the given set of data.

Parameters:
data - the data sets
prefix - the prefix for each chart filename
suffix - the suffix for each chart filename

printChartSvg

public static void printChartSvg(java.lang.String fileName,
                                 com.jrefinery.chart.JFreeChart chart,
                                 int width,
                                 int height)
                          throws java.io.IOException
Prints out the results as an svg chart.

Parameters:
fileName - the file to save the results
chart - the chart
width - the width to give the output file
height - the height for the output file
Throws:
java.io.IOException

printChartPng

public static void printChartPng(java.lang.String fileName,
                                 com.jrefinery.chart.JFreeChart chart,
                                 int width,
                                 int height)
                          throws java.io.IOException
Saves the given chart a PNG file.

Parameters:
fileName - the file to save to
chart - the chart to save
width - the width of the chart
height - the height of the chart
Throws:
java.io.IOException

createChart

public static com.jrefinery.chart.JFreeChart createChart(java.lang.String name,
                                                         com.jrefinery.data.Dataset data)
Creates a new chart for the given data set

Parameters:
name - the name of the chart
data - the data set
Returns:
the new chart