}
public Double evaluate(String tempDir, String file1, String file2, String metric) {
String commandTemplate = compareCommand.replace("%FILE1%", file1).replace("%FILE2%", file2);
CommandExecutor cmdEx = new CommandExecutor();
cmdEx.setWorkingDirectory(OS.getTmpPath());
String command = commandTemplate.replace("%METRIC%", metric);
try {
cmdEx.runCommand(command);
String out = cmdEx.getCommandError();
log.debug(command + " == " + out);
Double value = Scale.MAX_VALUE;
try {
if (out.contains(" ")) {
out = out.substring(0, out.indexOf(" "));
}
value = Double.valueOf(out.trim());
} catch (NumberFormatException e) {
log.error("unknown numberformat: " + out + " " + e.getMessage());
}
return value;
} catch (Exception e) {
log.error("error during image comparison " + command + " : " + cmdEx.getCommandError(), e);
return null;
}
}