-
Christian Beckmann authoredChristian Beckmann authored
test.cc 2.39 KiB
/* test.cc
Copyright (C) 1999-2008 University of Oxford */
/* CCOPYRIGHT */
#include "libvis/miscplot.h"
#include "miscmaths/miscmaths.h"
#include "miscmaths/miscprob.h"
#include "utils/options.h"
#include <vector>
#include <time.h>
#include "newimage/newimageall.h"
#include "melhlprfns.h"
using namespace MISCPLOT;
using namespace MISCMATHS;
using namespace Utilities;
using namespace std;
// The two strings below specify the title and example usage that is
// printed out as the help or usage message
string title=string("fsl_BLAH")+
string("\nCopyright(c) 2008, University of Oxford (Christian F. Beckmann)\n")+
string(" \n \n")+
string(" \n");
string examples="fsl_BLAH [options]";
//Command line Options {
Option<string> fnin(string("-i,--in"), string(""),
string("input file name (matrix 3D or 4D image)"),
true, requires_argument);
Option<int> help(string("-h,--help"), 0,
string("display this help text"),
false,no_argument);
Option<int> xdim(string("-x,--xdim"), 10,
string("xdim"),
false,requires_argument);
Option<int> ydim(string("-y,--ydim"), 10,
string("ydim"),
false,requires_argument);
/*
}
*/
////////////////////////////////////////////////////////////////////////////
// Local functions
int do_work(int argc, char* argv[]) {
Matrix test;
cerr << " X: "<< xdim.value() << ", Y: "<< ydim.value() << endl;
test = zeros(xdim.value(),ydim.value());
cerr << "Created matrix of size " << test.Nrows() << " x " << test.Ncols() << endl;
return 0;
}
////////////////////////////////////////////////////////////////////////////
int main(int argc,char *argv[]){
Tracer tr("main");
OptionParser options(title, examples);
try{
// must include all wanted options here (the order determines how
// the help message is printed)
options.add(fnin);
options.add(help);
options.add(xdim);
options.add(ydim);
options.parse_command_line(argc, argv);
// line below stops the program if the help was requested or
// a compulsory option was not set
if ( (help.value()) || (!options.check_compulsory_arguments(true)) ){
options.usage();
exit(EXIT_FAILURE);
}else{
// Call the local functions
return do_work(argc,argv);
}
}catch(X_OptionError& e) {
options.usage();
cerr << endl << e.what() << endl;
exit(EXIT_FAILURE);
}catch(std::exception &e) {
cerr << e.what() << endl;
}
}