diff --git a/asl/gui.py b/asl/gui.py index 6a70665..2103429 100644 --- a/asl/gui.py +++ b/asl/gui.py @@ -233,7 +233,7 @@ def __init__(self, parent): self.nslices = 1 self.view = 0 self.figure = Figure(figsize=(3.5, 3.5), dpi=100, facecolor='black') - self.axes = self.figure.add_subplot(111, facecolor='black') + self.axes = self.figure.add_subplot(111, axis_bgcolor='black') self.axes.get_xaxis().set_ticklabels([]) self.axes.get_yaxis().set_ticklabels([]) self.canvas = FigureCanvas(self, -1, self.figure) diff --git a/asl_file.cc b/asl_file.cc index abb5924..1aa6f76 100644 --- a/asl_file.cc +++ b/asl_file.cc @@ -35,7 +35,10 @@ int main(int argc, char *argv[]) { //parse command line (puts these into the log file) ReadOptions &opts = ReadOptions::getInstance(); - opts.parse_command_line(argc, argv); + if (!opts.parse_command_line(argc, argv)) + { + return 0; + } //deal with input data type options bool isblocked = false; //indicates if data is in blocks of repeats (of all TIs) rather than TIs diff --git a/readoptions.cc b/readoptions.cc index 5c76189..fffc055 100644 --- a/readoptions.cc +++ b/readoptions.cc @@ -23,7 +23,7 @@ namespace OXASL { ReadOptions *ReadOptions::ropt = NULL; -void ReadOptions::parse_command_line(int argc, char **argv) +bool ReadOptions::parse_command_line(int argc, char **argv) { Tracer_Plus("ReadOptions::parse_command_line"); @@ -41,10 +41,20 @@ void ReadOptions::parse_command_line(int argc, char **argv) // logger.str() << argv[a] << " "; //logger.str() << endl << "---------------------------------------------" << endl << endl; - if (help.value() || !options.check_compulsory_arguments()) + if (help.value()) { options.usage(); + return false; + } + else if (version.value()) + { + cout << GIT_SHA1 << " (" << GIT_DATE << ")" << endl; + return false; + } + else if (!options.check_compulsory_arguments()) + { throw Exception("Not all of the compulsory arguments have been provided"); } + return true; } } diff --git a/readoptions.h b/readoptions.h index c4b1607..3b73c93 100644 --- a/readoptions.h +++ b/readoptions.h @@ -29,6 +29,7 @@ class ReadOptions static ReadOptions &getInstance(); ~ReadOptions() { delete ropt; } Option help; + Option version; Option datafile; Option maskfile; @@ -67,7 +68,7 @@ class ReadOptions Option pv_wm_file; Option kernel; - void parse_command_line(int argc, char **argv); + bool parse_command_line(int argc, char **argv); private: ReadOptions(); @@ -95,6 +96,11 @@ inline ReadOptions::ReadOptions() false, no_argument) , + version(string("-v,--version"), false, + string("display version identification"), + false, no_argument) + , + //input files datafile(string("--data,--datafile"), string("ASL datafile"), string("data file"), @@ -203,6 +209,7 @@ inline ReadOptions::ReadOptions() try { options.add(help); + options.add(version); options.add(datafile); options.add(maskfile);